class OvirtSDK4::AttachedStorageDomainDisksService

Constants

ADD
LIST

Public Instance Methods

add(disk, opts = {}) click to toggle source

Adds or registers a disk.

IMPORTANT: Since version 4.2 of the engine this operation is deprecated, and preserved only for backwards compatibility. It will be removed in the future. To add a new disk use the xref:services-disks-methods-add operation of the service that manages the disks of the system. To register an unregistered disk use the xref:services-attached_storage_domain_disk-methods-register operation of the service that manages that disk.

@param disk [Disk] The disk to add or register.

@param opts [Hash] Additional options.

@option opts [Boolean] :unregistered Indicates if a new disk should be added or if an existing unregistered disk should be registered. If the

value is `true` then the identifier of the disk to register needs to be provided. For example, to register
the disk with id `456` send a request like this:

....
POST /ovirt-engine/api/storagedomains/123/disks?unregistered=true
....

With a request body like this:

[source,xml]
----
<disk id="456"/>
----

If the value is `false` then a new disk will be created in the storage domain. In that case the
`provisioned_size`, `format` and `name` attributes are mandatory. For example, to create a new
_copy on write_ disk of 1 GiB, send a request like this:

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

With a request body like this:

[source,xml]
----
<disk>
  <name>mydisk</name>
  <format>cow</format>
  <provisioned_size>1073741824</provisioned_size>
</disk>
----

The default value is `false`.

@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 4003
def add(disk, opts = {})
  internal_add(disk, Disk, ADD, opts)
end
disk_service(id) click to toggle source

Reference to the service that manages a specific disk.

@param id [String] The identifier of the `disk`.

@return [AttachedStorageDomainDiskService] A reference to the `disk` service.

# File lib/ovirtsdk4/services.rb, line 4046
def disk_service(id)
  AttachedStorageDomainDiskService.new(self, id)
end
list(opts = {}) click to toggle source

Retrieve the list of disks that are available in the storage domain.

@param opts [Hash] Additional options.

@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 [Integer] :max Sets the maximum number of disks to return. If not specified all the disks are returned.

@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 [Array<Disk>]

# File lib/ovirtsdk4/services.rb, line 4035
def list(opts = {})
  internal_get(LIST, 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 4057
def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return disk_service(path)
  end
  return disk_service(path[0..(index - 1)]).service(path[(index + 1)..-1])
end