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.
22572 22573 22574 |
# File 'lib/ovirtsdk4/services.rb', line 22572 def @disk_attachments_service ||= StorageDomainVmDiskAttachmentsService.new(self, 'diskattachments') end |
#disks_service ⇒ StorageDomainContentDisksService
Locates the disks
service.
22581 22582 22583 |
# File 'lib/ovirtsdk4/services.rb', line 22581 def disks_service @disks_service ||= StorageDomainContentDisksService.new(self, 'disks') end |
#get(opts = {}) ⇒ Vm
Returns the representation of the object managed by this service.
22355 22356 22357 |
# File 'lib/ovirtsdk4/services.rb', line 22355 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>
22469 22470 22471 |
# File 'lib/ovirtsdk4/services.rb', line 22469 def import(opts = {}) internal_action(:import, nil, IMPORT, opts) end |
#register(opts = {}) ⇒ Object
Executes the register
method.
22531 22532 22533 |
# File 'lib/ovirtsdk4/services.rb', line 22531 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
22563 22564 22565 |
# File 'lib/ovirtsdk4/services.rb', line 22563 def remove(opts = {}) internal_remove(REMOVE, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
22592 22593 22594 22595 22596 22597 22598 22599 22600 22601 22602 22603 22604 22605 22606 22607 22608 22609 |
# File 'lib/ovirtsdk4/services.rb', line 22592 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 |