class OvirtSDK4::DiskService

Constants

GET
REMOVE
UPDATE

Public Instance Methods

copy(opts = {}) click to toggle source

This operation copies a disk to the specified storage domain.

For example, copy of a disk can be facilitated 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>


@param opts [Hash] Additional options.

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

@option opts [Disk] :disk Description of the resulting disk. The only accepted value is the `name` attribute, which will be the name

used for the new disk. For example, to copy disk `123` using `myname` as the name for the new disk, send
a request like this:

....
POST /ovirt-engine/disks/123
....

With a request body like this:

[source,xml]
----
<action>
  <disk>
    <name>mydisk<name>
  </disk>
  <storage_domain id="456"/>
</action>
----

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

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

attributes. For example, to copy a disk to the storage domain named `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 30215
def copy(opts = {})
  internal_action(:copy, nil, opts)
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 should 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 30239
def export(opts = {})
  internal_action(:export, nil, opts)
end
get(opts = {}) click to toggle source

Retrieves the description of 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 30264
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>


@param opts [Hash] Additional options.

@option opts [Boolean] :async Indicates if the move 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 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 30305
def move(opts = {})
  internal_action(:move, nil, 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 30409
def permissions_service
  AssignedPermissionsService.new(@connection, "#{@path}/permissions")
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 30330
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 30429
def service(path)
  if path.nil? || path == ''
    return self
  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 30354
def sparsify(opts = {})
  internal_action(:sparsify, nil, 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 30418
def statistics_service
  StatisticsService.new(@connection, "#{@path}/statistics")
end
to_s() click to toggle source

Returns an string representation of this service.

@return [String]

# File lib/ovirtsdk4/services.rb, line 30453
def to_s
  "#<#{DiskService}:#{@path}>"
end
update(disk, opts = {}) click to toggle source

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:

source

PUT /ovirt-engine/api/disks/123


With a request body like this:

source,xml

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

@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 30400
def update(disk, opts = {})
  internal_update(disk, Disk, UPDATE, opts)
end