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.
22828 22829 22830 |
# File 'lib/ovirtsdk4/services.rb', line 22828 def @disk_attachments_service ||= StorageDomainVmDiskAttachmentsService.new(self, 'diskattachments') end |
#disks_service ⇒ StorageDomainContentDisksService
Locates the disks
service.
22837 22838 22839 |
# File 'lib/ovirtsdk4/services.rb', line 22837 def disks_service @disks_service ||= StorageDomainContentDisksService.new(self, 'disks') end |
#get(opts = {}) ⇒ Vm
Returns the representation of the object managed by this service.
22603 22604 22605 |
# File 'lib/ovirtsdk4/services.rb', line 22603 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).
22721 22722 22723 |
# File 'lib/ovirtsdk4/services.rb', line 22721 def import(opts = {}) internal_action(:import, nil, IMPORT, opts) end |
#register(opts = {}) ⇒ Object
Executes the register
method.
22787 22788 22789 |
# File 'lib/ovirtsdk4/services.rb', line 22787 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
22819 22820 22821 |
# File 'lib/ovirtsdk4/services.rb', line 22819 def remove(opts = {}) internal_remove(REMOVE, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
22848 22849 22850 22851 22852 22853 22854 22855 22856 22857 22858 22859 22860 22861 22862 22863 22864 22865 |
# File 'lib/ovirtsdk4/services.rb', line 22848 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 |