class OvirtSDK4::DiskAttachmentsService
Constants
- ADD
- ADD_PROVIDING_DISK_ID
- ADD_SIGNATURE1
- LIST
Public Instance Methods
Adds a new disk attachment to the virtual machine. The `attachment` parameter can contain just a reference, if the disk already exists:
- source,xml
<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:
- source,xml
<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`:
- source
POST /ovirt-engine/api/vms/345/diskattachments
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.
@param attachment [DiskAttachment] The disk attachment to add to the virtual machine.
@param opts [Hash] Additional options.
@option opts [Hash] :headers ({}) Additional HTTP headers.
@option opts [Hash] :query ({}) Additional URL query parameters.
@option opts [Integer] :timeout (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.
@option opts [Boolean] :wait (true) If `true` wait for the response.
@return [DiskAttachment]
# File lib/ovirtsdk4/services.rb, line 7289 def add(attachment, opts = {}) internal_add(attachment, DiskAttachment, ADD, opts) end
Adds a new `attachment`.
@param attachment [DiskAttachment] The disk attachment to add to the virtual machine.
@param opts [Hash] Additional options.
@option opts [Hash] :headers ({}) Additional HTTP headers.
@option opts [Hash] :query ({}) Additional URL query parameters.
@option opts [Integer] :timeout (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.
@option opts [Boolean] :wait (true) If `true` wait for the response.
@return [DiskAttachment]
# File lib/ovirtsdk4/services.rb, line 7347 def add_providing_disk_id(attachment, opts = {}) internal_add(attachment, DiskAttachment, ADD_PROVIDING_DISK_ID, opts) end
Adds a new `attachment`.
@param attachment [DiskAttachment] The disk attachment to add to the virtual machine.
@param opts [Hash] Additional options.
@option opts [Hash] :headers ({}) Additional HTTP headers.
@option opts [Hash] :query ({}) Additional URL query parameters.
@option opts [Integer] :timeout (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.
@option opts [Boolean] :wait (true) If `true` wait for the response.
@return [DiskAttachment]
# File lib/ovirtsdk4/services.rb, line 7374 def add_signature1(attachment, opts = {}) internal_add(attachment, DiskAttachment, ADD_SIGNATURE1, opts) end
Reference to the service that manages a specific attachment.
@param id [String] The identifier of the `attachment`.
@return [DiskAttachmentService] A reference to the `attachment` service.
# File lib/ovirtsdk4/services.rb, line 7385 def attachment_service(id) DiskAttachmentService.new(self, id) end
List
the disk that are attached to the virtual machine.
The order of the returned list of disks attachments isn't guaranteed.
@param opts [Hash] Additional options.
@option opts [String] :follow Indicates which inner links should be followed. The objects referenced by these links will be fetched as part
of the current request. See <<documents/003_common_concepts/follow, here>> for details.
@option opts [Hash] :headers ({}) Additional HTTP headers.
@option opts [Hash] :query ({}) Additional URL query parameters.
@option opts [Integer] :timeout (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.
@option opts [Boolean] :wait (true) If `true` wait for the response.
@return [Array<DiskAttachment>]
# File lib/ovirtsdk4/services.rb, line 7320 def list(opts = {}) internal_get(LIST, opts) end
Locates the service corresponding to the given path.
@param path [String] The path of the service.
@return [Service] A reference to the service.
# File lib/ovirtsdk4/services.rb, line 7396 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return attachment_service(path) end return attachment_service(path[0..(index - 1)]).service(path[(index + 1)..-1]) end