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.
23942 23943 23944 |
# File 'lib/ovirtsdk4/services.rb', line 23942 def @disk_attachments_service ||= StorageDomainVmDiskAttachmentsService.new(self, 'diskattachments') end |
#disks_service ⇒ StorageDomainContentDisksService
Locates the disks
service.
23951 23952 23953 |
# File 'lib/ovirtsdk4/services.rb', line 23951 def disks_service @disks_service ||= StorageDomainContentDisksService.new(self, 'disks') end |
#get(opts = {}) ⇒ Vm
Returns the representation of the object managed by this service.
23717 23718 23719 |
# File 'lib/ovirtsdk4/services.rb', line 23717 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).
23835 23836 23837 |
# File 'lib/ovirtsdk4/services.rb', line 23835 def import(opts = {}) internal_action(:import, nil, IMPORT, opts) end |
#register(opts = {}) ⇒ Object
Executes the register
method.
23901 23902 23903 |
# File 'lib/ovirtsdk4/services.rb', line 23901 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
23933 23934 23935 |
# File 'lib/ovirtsdk4/services.rb', line 23933 def remove(opts = {}) internal_remove(REMOVE, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
23962 23963 23964 23965 23966 23967 23968 23969 23970 23971 23972 23973 23974 23975 23976 23977 23978 23979 |
# File 'lib/ovirtsdk4/services.rb', line 23962 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 |