Class: OvirtSDK4::AttachedStorageDomainDisksService

Inherits:
Service
  • Object
show all
Defined in:
lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb

Instance Method Summary collapse

Methods inherited from Service

#inspect, #to_s

Instance Method Details

#add(disk, opts = {}) ⇒ Disk

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 add operation of the service that manages the disks of the system. To register an unregistered disk use the register operation of the service that manages that disk.

Parameters:

  • disk (Disk)

    The disk to add or register.

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :unregistered (Boolean)

    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:

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

    <disk>
      <name>mydisk</name>
      <format>cow</format>
      <provisioned_size>1073741824</provisioned_size>
    </disk>

    The default value is false.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: 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.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



3424
3425
3426
# File 'lib/ovirtsdk4/services.rb', line 3424

def add(disk, opts = {})
  internal_add(disk, Disk, ADD, opts)
end

#disk_service(id) ⇒ AttachedStorageDomainDiskService

Reference to the service that manages a specific disk.

Parameters:

  • id (String)

    The identifier of the disk.

Returns:



3467
3468
3469
# File 'lib/ovirtsdk4/services.rb', line 3467

def disk_service(id)
  AttachedStorageDomainDiskService.new(self, id)
end

#list(opts = {}) ⇒ Array<Disk>

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

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :follow (String)

    Indicates which inner links should be followed. The objects referenced by these links will be fetched as part of the current request. See here for details.

  • :max (Integer)

    Sets the maximum number of disks to return. If not specified all the disks are returned.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: 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.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



3456
3457
3458
# File 'lib/ovirtsdk4/services.rb', line 3456

def list(opts = {})
  internal_get(LIST, opts)
end

#service(path) ⇒ Service

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.



3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
# File 'lib/ovirtsdk4/services.rb', line 3478

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