Class: OvirtSDK4::StorageDomainDisksService

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

    This parameter has been deprecated since version 4.2 of the engine-name.

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



23283
23284
23285
# File 'lib/ovirtsdk4/services.rb', line 23283

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

#disk_service(id) ⇒ StorageDomainDiskService

A reference to the service that manages a specific disk.

Parameters:

  • id (String)

    The identifier of the disk.

Returns:



23340
23341
23342
# File 'lib/ovirtsdk4/services.rb', line 23340

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

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

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

The order of the returned list of disks is not guaranteed.

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.

  • :unregistered (Boolean)

    Indicates whether to retrieve a list of registered or unregistered disks in the storage domain. To get a list of unregistered disks in the storage domain the call should indicate the unregistered flag. For example, to get a list of unregistered disks the REST API call should look like this:

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

    The default value of the unregistered flag is false. The request only applies to storage domains that are attached.

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



23329
23330
23331
# File 'lib/ovirtsdk4/services.rb', line 23329

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.



23351
23352
23353
23354
23355
23356
23357
23358
23359
23360
# File 'lib/ovirtsdk4/services.rb', line 23351

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