class OvirtSDK4::DiskService

Constants

CONVERT
COPY
EXPORT
GET
MOVE
REDUCE
REFRESH_LUN
REMOVE
SPARSIFY
UPDATE

Public Instance Methods

convert(opts = {}) click to toggle source

Converts disk format and/or preallocation mode.

For example, to convert the disk format from preallocated-cow to a sparse-raw image, send a request like the following:

source

POST /ovirt-engine/api/disks/123/convert


With the following request body:

source,xml

<action>
  <disk>
    <sparse>true</sparse>
    <format>raw</format>
  </disk>
</action>

Note: In order to sparsify a disk, two conversions might be needed if the disk is on a Block Storage Domain. For example: If a disk is RAW, converting it to QCOW will result in a larger disk. In order to reduce the size, it is possible to convert the disk again to QCOW and keep the same allocation policy.

@param opts [Hash] Additional options.

@option opts [Disk] :disk The description of the disk.

@option opts [String] :follow Indicates which inner links should be followed. The objects referenced by these links will be fetched as part

of the current request. See <<documents/003_common_concepts/follow, here>> for details.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

# File lib/ovirtsdk4/services.rb, line 37181
def convert(opts = {})
  internal_action(:convert, nil, CONVERT, opts)
end
copy(opts = {}) click to toggle source

This operation copies a disk to the specified storage domain.

For example, a disk can be copied using the following request:

source

POST /ovirt-engine/api/disks/123/copy


With a request body like this:

source,xml

<action>

<storage_domain id="456"/>
<disk>
  <name>mydisk</name>
</disk>

</action>


If the disk profile or the quota currently used by the disk are not defined for the new storage domain, they can be explicitly specified. If they are not specified, the first available disk profile and the default quota are used.

For example, to specify disk profile `987` and quota `753`, send a request body like this:

source,xml

<action>

<storage_domain id="456"/>
<disk_profile id="987"/>
<quota id="753"/>

</action>


@param opts [Hash] Additional options.

@option opts [Boolean] :async Indicates if the copy should be performed asynchronously.

@option opts [Disk] :disk

@option opts [DiskProfile] :disk_profile Disk profile for the disk in the new storage domain.

Disk profiles are defined for storage domains,
so the old disk profile will not exist in the new storage domain.
If this parameter is not used, the first disk profile from the new storage domain
to which the user has permissions will be assigned to the disk.

@option opts [Boolean] :filter Indicates if the results should be filtered according to the permissions of the user.

@option opts [Quota] :quota Quota for the disk in the new storage domain.

This optional parameter can be used to specify new quota for the disk,
because the current quota may not be defined for the new storage domain.
If this parameter is not used and the old quota is not defined for the new storage domain,
the default (unlimited) quota will be assigned to the disk.

@option opts [StorageDomain] :storage_domain The storage domain where the new disk is created. This can be specified using the `id` or `name`

attributes. For example, to copy a disk to the storage domain called `mydata`, send a request like this:

....
POST /ovirt-engine/api/storagedomains/123/disks/789
....

With a request body like this:

[source,xml]
----
<action>
  <storage_domain>
    <name>mydata</name>
  </storage_domain>
</action>
----

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

# File lib/ovirtsdk4/services.rb, line 37281
def copy(opts = {})
  internal_action(:copy, nil, COPY, opts)
end
disk_snapshots_service() click to toggle source

Reference to the service that manages the DiskSnapshots.

For example, to list all disk snapshots under the disks resource '123':

.… GET /ovirt-engine/api/disks/123/disksnapshots .…

For example, to retrieve a specific disk snapshot '789' under the disk resource '123': .… GET /ovirt-engine/api/disks/123/disksnapshots/789 .…

@return [DiskSnapshotsService] A reference to `disk_snapshots` service.

# File lib/ovirtsdk4/services.rb, line 37649
def disk_snapshots_service
  @disk_snapshots_service ||= DiskSnapshotsService.new(self, 'disksnapshots')
end
export(opts = {}) click to toggle source

Exports a disk to an export storage domain.

@param opts [Hash] Additional options.

@option opts [Boolean] :async Indicates if the export should be performed asynchronously.

@option opts [Boolean] :filter Indicates if the results should be filtered according to the permissions of the user.

@option opts [StorageDomain] :storage_domain The export storage domain where the disk will be exported to.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

# File lib/ovirtsdk4/services.rb, line 37313
def export(opts = {})
  internal_action(:export, nil, EXPORT, opts)
end
get(opts = {}) click to toggle source

Retrieves the description of the disk.

@param opts [Hash] Additional options.

@option opts [Boolean] :all_content Indicates if all of the attributes of the disk should be included in the response.

By default the following disk attributes are excluded:

- `vms`

For example, to retrieve the complete representation of disk '123':

....
GET /ovirt-engine/api/disks/123?all_content=true
....

@option opts [String] :follow Indicates which inner links should be followed. The objects referenced by these links will be fetched as part

of the current request. See <<documents/003_common_concepts/follow, here>> for details.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

@return [Disk]

# File lib/ovirtsdk4/services.rb, line 37355
def get(opts = {})
  internal_get(GET, opts)
end
move(opts = {}) click to toggle source

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:

source

POST /ovirt-engine/api/disks/123/move


With the following request body:

source,xml

<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:

source,xml

<action>

<storage_domain id="456"/>
<disk_profile id="987"/>
<quota id="753"/>

</action>


@param opts [Hash] Additional options.

@option opts [Boolean] :async Indicates if the move should be performed asynchronously.

@option opts [DiskProfile] :disk_profile Disk profile for the disk in the new storage domain.

Disk profiles are defined for storage domains,
so the old disk profile will not exist in the new storage domain.
If this parameter is not used, the first disk profile from the new storage domain
to which the user has permissions will be assigned to the disk.

@option opts [Boolean] :filter Indicates if the results should be filtered according to the permissions of the user.

@option opts [Quota] :quota Quota for the disk in the new storage domain.

This optional parameter can be used to specify new quota for the disk,
because the current quota may not be defined for the new storage domain.
If this parameter is not used and the old quota is not defined for the new storage domain,
the default (unlimited) quota will be assigned to the disk.

@option opts [StorageDomain] :storage_domain The storage domain where the disk will be moved to.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

# File lib/ovirtsdk4/services.rb, line 37438
def move(opts = {})
  internal_action(:move, nil, MOVE, opts)
end
permissions_service() click to toggle source

Reference to the service that manages the permissions assigned to the disk.

@return [AssignedPermissionsService] A reference to `permissions` service.

# File lib/ovirtsdk4/services.rb, line 37658
def permissions_service
  @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')
end
reduce(opts = {}) click to toggle source

Reduces the size of the disk image.

Invokes reduce on the logical volume (i.e. this is only applicable for block storage domains). This is applicable for floating disks and disks attached to non-running virtual machines. There is no need to specify the size as the optimal size is calculated automatically.

@param opts [Hash] Additional options.

@option opts [Boolean] :async Indicates if the remove should be performed asynchronously.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

# File lib/ovirtsdk4/services.rb, line 37468
def reduce(opts = {})
  internal_action(:reduce, nil, REDUCE, opts)
end
refresh_lun(opts = {}) click to toggle source

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 xref:services-disks-methods-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:

source

POST /ovirt-engine/api/disks/123/refreshlun


With the following request body:

source,xml

<action>

<host id='456'/>

</action>


@param opts [Hash] Additional options.

@option opts [Host] :host The host that will be used to refresh the direct LUN disk.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

# File lib/ovirtsdk4/services.rb, line 37516
def refresh_lun(opts = {})
  internal_action(:refreshlun, nil, REFRESH_LUN, opts)
end
remove(opts = {}) click to toggle source

Removes a disk.

@param opts [Hash] Additional options.

@option opts [Boolean] :async Indicates if the remove should be performed asynchronously. @option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

# File lib/ovirtsdk4/services.rb, line 37541
def remove(opts = {})
  internal_remove(REMOVE, opts)
end
service(path) click to toggle source

Locates the service corresponding to the given path.

@param path [String] The path of the service.

@return [Service] A reference to the service.

# File lib/ovirtsdk4/services.rb, line 37678
def service(path)
  if path.nil? || path == ''
    return self
  end
  if path == 'disksnapshots'
    return disk_snapshots_service
  end
  if path.start_with?('disksnapshots/')
    return disk_snapshots_service.service(path[14..-1])
  end
  if path == 'permissions'
    return permissions_service
  end
  if path.start_with?('permissions/')
    return permissions_service.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 = {}) click to toggle source

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.

@param opts [Hash] Additional options.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

# File lib/ovirtsdk4/services.rb, line 37570
def sparsify(opts = {})
  internal_action(:sparsify, nil, SPARSIFY, opts)
end
statistics_service() click to toggle source

Locates the `statistics` service.

@return [StatisticsService] A reference to `statistics` service.

# File lib/ovirtsdk4/services.rb, line 37667
def statistics_service
  @statistics_service ||= StatisticsService.new(self, 'statistics')
end
update(disk, opts = {}) click to toggle source

Updates the parameters of the specified disk.

This operation allows updating the following floating disk properties:

  • For Image disks: `provisioned_size`, `alias`, `description`, `wipe_after_delete`, `shareable`, `backup` and `disk_profile`.

  • For LUN disks: `alias`, `description` and `shareable`.

  • Cinder integration has been replaced by Managed Block Storage.

  • For Managed Block disks: `provisioned_size`, `alias` and `description`.

  • For VM attached disks, the `qcow_version` can also be updated.

For example, a disk's update can be done by using the following request:

source

PUT /ovirt-engine/api/disks/123


With a request body like this:

source,xml

<disk>

<qcow_version>qcow2_v3</qcow_version>
<alias>new-alias</alias>
<description>new-desc</description>

</disk>


Since the backend operation is asynchronous, the disk element that is returned to the user might not be synced with the changed properties.

@param disk [Disk] The update to apply to the disk. @param opts [Hash] Additional options.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

@return [Disk]

# File lib/ovirtsdk4/services.rb, line 37629
def update(disk, opts = {})
  internal_update(disk, Disk, UPDATE, opts)
end