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.
24081 24082 24083 |
# File 'lib/ovirtsdk4/services.rb', line 24081 def @disk_attachments_service ||= StorageDomainVmDiskAttachmentsService.new(self, 'diskattachments') end |
#disks_service ⇒ StorageDomainContentDisksService
Locates the disks
service.
24090 24091 24092 |
# File 'lib/ovirtsdk4/services.rb', line 24090 def disks_service @disks_service ||= StorageDomainContentDisksService.new(self, 'disks') end |
#get(opts = {}) ⇒ Vm
Returns the representation of the object managed by this service.
23856 23857 23858 |
# File 'lib/ovirtsdk4/services.rb', line 23856 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).
23974 23975 23976 |
# File 'lib/ovirtsdk4/services.rb', line 23974 def import(opts = {}) internal_action(:import, nil, IMPORT, opts) end |
#register(opts = {}) ⇒ Object
Executes the register
method.
24040 24041 24042 |
# File 'lib/ovirtsdk4/services.rb', line 24040 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
24072 24073 24074 |
# File 'lib/ovirtsdk4/services.rb', line 24072 def remove(opts = {}) internal_remove(REMOVE, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
24101 24102 24103 24104 24105 24106 24107 24108 24109 24110 24111 24112 24113 24114 24115 24116 24117 24118 |
# File 'lib/ovirtsdk4/services.rb', line 24101 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 |