Class: OvirtSDK4::DiskService
- Inherits:
-
MeasurableService
- Object
- Service
- MeasurableService
- OvirtSDK4::DiskService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#copy(opts = {}) ⇒ Object
This operation copies a disk to the specified storage domain.
-
#export(opts = {}) ⇒ Object
Exports a disk to an export storage domain.
-
#get(opts = {}) ⇒ Disk
Retrieves the description of the disk.
-
#move(opts = {}) ⇒ Object
Moves a disk to another storage domain.
-
#permissions_service ⇒ AssignedPermissionsService
Reference to the service that manages the permissions assigned to the disk.
-
#refresh_lun(opts = {}) ⇒ Object
Refreshes a direct LUN disk with up-to-date information from the storage.
-
#remove(opts = {}) ⇒ Object
Removes a disk.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
-
#sparsify(opts = {}) ⇒ Object
Sparsify the disk.
-
#statistics_service ⇒ StatisticsService
Locates the
statistics
service. -
#update(disk, opts = {}) ⇒ Disk
This operation updates the disk with the appropriate parameters.
Methods inherited from Service
Instance Method Details
#copy(opts = {}) ⇒ Object
This operation copies a disk to the specified storage domain.
For example, copy of a disk can be facilitated using the following request:
POST /ovirt-engine/api/disks/123/copy
With a request body like this:
<action>
<storage_domain id="456"/>
<disk>
<name>mydisk</name>
</disk>
</action>
If the disk profile or the quota used currently by the disk aren’t defined for the new storage domain, then they can be explicitly specified. If they aren’t then the first available disk profile and the default quota are used.
For example, to explicitly use disk profile 987
and quota 753
send a request body like this:
<action>
<storage_domain id="456"/>
<disk_profile id="987"/>
<quota id="753"/>
</action>
33298 33299 33300 |
# File 'lib/ovirtsdk4/services.rb', line 33298 def copy(opts = {}) internal_action(:copy, nil, COPY, opts) end |
#export(opts = {}) ⇒ Object
Exports a disk to an export storage domain.
33330 33331 33332 |
# File 'lib/ovirtsdk4/services.rb', line 33330 def export(opts = {}) internal_action(:export, nil, EXPORT, opts) end |
#get(opts = {}) ⇒ Disk
Retrieves the description of the disk.
33359 33360 33361 |
# File 'lib/ovirtsdk4/services.rb', line 33359 def get(opts = {}) internal_get(GET, opts) end |
#move(opts = {}) ⇒ Object
Moves a disk to another storage domain.
For example, to move the disk with identifier 123
to a storage domain with identifier 456
send the following
request:
POST /ovirt-engine/api/disks/123/move
With the following request body:
<action>
<storage_domain id="456"/>
</action>
If the disk profile or the quota used currently by the disk aren’t defined for the new storage domain, then they can be explicitly specified. If they aren’t then the first available disk profile and the default quota are used.
For example, to explicitly use disk profile 987
and
quota 753
send a request body like this:
<action>
<storage_domain id="456"/>
<disk_profile id="987"/>
<quota id="753"/>
</action>
33442 33443 33444 |
# File 'lib/ovirtsdk4/services.rb', line 33442 def move(opts = {}) internal_action(:move, nil, MOVE, opts) end |
#permissions_service ⇒ AssignedPermissionsService
Reference to the service that manages the permissions assigned to the disk.
33599 33600 33601 |
# File 'lib/ovirtsdk4/services.rb', line 33599 def @permissions_service ||= AssignedPermissionsService.new(self, 'permissions') end |
#refresh_lun(opts = {}) ⇒ Object
Refreshes a direct LUN disk with up-to-date information from the storage.
Refreshing a direct LUN disk is useful when:
-
The LUN was added using the API without the host parameter, and therefore does not contain any information from the storage (see DisksService::add).
-
New information about the LUN is available on the storage and you want to update the LUN with it.
To refresh direct LUN disk 123
using host 456
, send the following request:
POST /ovirt-engine/api/disks/123/refreshlun
With the following request body:
<action>
<host id='456'/>
</action>
33490 33491 33492 |
# File 'lib/ovirtsdk4/services.rb', line 33490 def refresh_lun(opts = {}) internal_action(:refreshlun, nil, REFRESH_LUN, opts) end |
#remove(opts = {}) ⇒ Object
Removes a disk.
33515 33516 33517 |
# File 'lib/ovirtsdk4/services.rb', line 33515 def remove(opts = {}) internal_remove(REMOVE, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
33619 33620 33621 33622 33623 33624 33625 33626 33627 33628 33629 33630 33631 33632 33633 33634 33635 33636 |
# File 'lib/ovirtsdk4/services.rb', line 33619 def service(path) if path.nil? || path == '' return self end if path == 'permissions' return end if path.start_with?('permissions/') return .service(path[12..-1]) end if path == 'statistics' return statistics_service end if path.start_with?('statistics/') return statistics_service.service(path[11..-1]) end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |
#sparsify(opts = {}) ⇒ Object
Sparsify the disk.
Sparsification frees space in the disk image that is not used by its filesystem. As a result, the image will occupy less space on the storage.
Currently sparsification works only on disks without snapshots. Disks having derived disks are also not allowed.
33544 33545 33546 |
# File 'lib/ovirtsdk4/services.rb', line 33544 def sparsify(opts = {}) internal_action(:sparsify, nil, SPARSIFY, opts) end |
#statistics_service ⇒ StatisticsService
Locates the statistics
service.
33608 33609 33610 |
# File 'lib/ovirtsdk4/services.rb', line 33608 def statistics_service @statistics_service ||= StatisticsService.new(self, 'statistics') end |
#update(disk, opts = {}) ⇒ Disk
This operation updates the disk with the appropriate parameters.
The only field that can be updated is qcow_version
.
For example, update disk can be facilitated using the following request:
PUT /ovirt-engine/api/disks/123
With a request body like this:
<disk>
<qcow_version>qcow2_v3</qcow_version>
</disk>
Since the backend operation is asynchronous the disk element which will be returned to the user might not be synced with the changed properties.
33590 33591 33592 |
# File 'lib/ovirtsdk4/services.rb', line 33590 def update(disk, opts = {}) internal_update(disk, Disk, UPDATE, opts) end |