Class: OvirtSDK4::StorageDomainVmService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#disk_attachments_service ⇒ StorageDomainVmDiskAttachmentsService
Returns a reference to the service that manages the disk attachments of the virtual machine.
-
#disks_service ⇒ StorageDomainContentDisksService
Locates the
disks
service. -
#get(opts = {}) ⇒ Vm
Returns the representation of the object managed by this service.
-
#import(opts = {}) ⇒ Object
Imports a virtual machine from an export storage domain.
-
#register(opts = {}) ⇒ Object
Executes the
register
method. -
#remove(opts = {}) ⇒ Object
Deletes a virtual machine from an export storage domain.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
Methods inherited from Service
Instance Method Details
#disk_attachments_service ⇒ StorageDomainVmDiskAttachmentsService
Returns a reference to the service that manages the disk attachments of the virtual machine.
22742 22743 22744 |
# File 'lib/ovirtsdk4/services.rb', line 22742 def @disk_attachments_service ||= StorageDomainVmDiskAttachmentsService.new(self, 'diskattachments') end |
#disks_service ⇒ StorageDomainContentDisksService
Locates the disks
service.
22751 22752 22753 |
# File 'lib/ovirtsdk4/services.rb', line 22751 def disks_service @disks_service ||= StorageDomainContentDisksService.new(self, 'disks') end |
#get(opts = {}) ⇒ Vm
Returns the representation of the object managed by this service.
22517 22518 22519 |
# File 'lib/ovirtsdk4/services.rb', line 22517 def get(opts = {}) internal_get(GET, opts) end |
#import(opts = {}) ⇒ Object
Imports a virtual machine from an export storage domain.
For example, send a request like this:
POST /ovirt-engine/api/storagedomains/123/vms/456/import
With a request body like this:
<action>
<storage_domain>
<name>mydata</name>
</storage_domain>
<cluster>
<name>mycluster</name>
</cluster>
</action>
To import a virtual machine as a new entity add the clone
parameter:
<action>
<storage_domain>
<name>mydata</name>
</storage_domain>
<cluster>
<name>mycluster</name>
</cluster>
<clone>true</clone>
<vm>
<name>myvm</name>
</vm>
</action>
Include an optional disks
parameter to choose which disks to import. For example, to import the disks
of the template that have the identifiers 123
and 456
send the following request body:
<action>
<cluster>
<name>mycluster</name>
</cluster>
<vm>
<name>myvm</name>
</vm>
<disks>
<disk id="123"/>
<disk id="456"/>
</disks>
</action>
If you register an entity without specifying the cluster ID or name, the cluster name from the entity’s OVF will be used (unless the register request also includes the cluster mapping).
22635 22636 22637 |
# File 'lib/ovirtsdk4/services.rb', line 22635 def import(opts = {}) internal_action(:import, nil, IMPORT, opts) end |
#register(opts = {}) ⇒ Object
Executes the register
method.
22701 22702 22703 |
# File 'lib/ovirtsdk4/services.rb', line 22701 def register(opts = {}) internal_action(:register, nil, REGISTER, opts) end |
#remove(opts = {}) ⇒ Object
Deletes a virtual machine from an export storage domain.
For example, to delete the virtual machine 456
from the storage domain 123
, send a request like this:
DELETE /ovirt-engine/api/storagedomains/123/vms/456
22733 22734 22735 |
# File 'lib/ovirtsdk4/services.rb', line 22733 def remove(opts = {}) internal_remove(REMOVE, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
22762 22763 22764 22765 22766 22767 22768 22769 22770 22771 22772 22773 22774 22775 22776 22777 22778 22779 |
# File 'lib/ovirtsdk4/services.rb', line 22762 def service(path) if path.nil? || path == '' return self end if path == 'diskattachments' return end if path.start_with?('diskattachments/') return .service(path[16..-1]) end if path == 'disks' return disks_service end if path.start_with?('disks/') return disks_service.service(path[6..-1]) end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |