Class: OvirtSDK4::DiskAttachmentsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#add(attachment, opts = {}) ⇒ DiskAttachment
Adds a new disk attachment to the virtual machine.
-
#add_providing_disk_id(attachment, opts = {}) ⇒ DiskAttachment
Adds a new
attachment
. -
#add_signature1(attachment, opts = {}) ⇒ DiskAttachment
Adds a new
attachment
. -
#attachment_service(id) ⇒ DiskAttachmentService
Reference to the service that manages a specific attachment.
-
#list(opts = {}) ⇒ Array<DiskAttachment>
List the disk that are attached to the virtual machine.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
Methods inherited from Service
Instance Method Details
#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
Important
|
The server accepts requests that don’t 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.
|
6483 6484 6485 |
# File 'lib/ovirtsdk4/services.rb', line 6483 def add(, opts = {}) internal_add(, DiskAttachment, ADD, opts) end |
#add_providing_disk_id(attachment, opts = {}) ⇒ DiskAttachment
Adds a new attachment
.
6541 6542 6543 |
# File 'lib/ovirtsdk4/services.rb', line 6541 def add_providing_disk_id(, opts = {}) internal_add(, DiskAttachment, ADD_PROVIDING_DISK_ID, opts) end |
#add_signature1(attachment, opts = {}) ⇒ DiskAttachment
Adds a new attachment
.
6568 6569 6570 |
# File 'lib/ovirtsdk4/services.rb', line 6568 def add_signature1(, opts = {}) internal_add(, DiskAttachment, ADD_SIGNATURE1, opts) end |
#attachment_service(id) ⇒ DiskAttachmentService
Reference to the service that manages a specific attachment.
6579 6580 6581 |
# File 'lib/ovirtsdk4/services.rb', line 6579 def (id) DiskAttachmentService.new(self, id) end |
#list(opts = {}) ⇒ Array<DiskAttachment>
List the disk that are attached to the virtual machine.
The order of the returned list of disks attachments isn’t guaranteed.
6514 6515 6516 |
# File 'lib/ovirtsdk4/services.rb', line 6514 def list(opts = {}) internal_get(LIST, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 |
# File 'lib/ovirtsdk4/services.rb', line 6590 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return (path) end return (path[0..(index - 1)]).service(path[(index +1)..-1]) end |