Method: OvirtSDK4::DiskAttachmentsService#add

Defined in:

#add(attachment, opts = {}) ⇒ DiskAttachment

Adds a new disk attachment to the virtual machine. The attachment parameter can contain just a reference, if the disk already exists:

  <disk id="123"/>

Or it can contain the complete representation of the disk, if the disk doesn’t exist yet:


In this case the disk will be created and then attached to the virtual machine.

In both cases, use the following URL for a virtual machine with an id 345:

POST /ovirt-engine/api/vms/345/diskattachments
The server accepts requests that do not contain the active attribute, but the effect is undefined. In some cases the disk will be automatically activated and in other cases it won’t. To avoid issues it is strongly recommended to always include the active attribute with the desired value.


  • attachment (DiskAttachment)

    The disk attachment to add to the virtual machine.

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

    Additional options.

Options Hash (opts):

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


# File 'lib/ovirtsdk4/services.rb', line 7289

def add(attachment, opts = {})
  internal_add(attachment, DiskAttachment, ADD, opts)