Method: OvirtSDK4::DiskAttachmentsService#add
- Defined in:
- lib/ovirtsdk4/services.rb
#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_attachment>
<bootable>true</bootable>
<pass_discard>true</pass_discard>
<interface>ide</interface>
<active>true</active>
<disk id="123"/>
</disk_attachment>
Or it can contain the complete representation of the disk, if the disk doesn’t exist yet:
<disk_attachment>
<bootable>true</bootable>
<pass_discard>true</pass_discard>
<interface>ide</interface>
<active>true</active>
<disk>
<name>mydisk</name>
<provisioned_size>1024</provisioned_size>
...
</disk>
</disk_attachment>
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 HTTP/1.1
|
Important
|
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.
|
7199 7200 7201 |
# File 'lib/ovirtsdk4/services.rb', line 7199 def add(, opts = {}) internal_add(, DiskAttachment, ADD, opts) end |