Class: OvirtSDK4::TemplateService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#cdroms_service ⇒ TemplateCdromsService
Returns a reference to the service that manages the CD-ROMs that are associated with the template.
-
#disk_attachments_service ⇒ TemplateDiskAttachmentsService
Returns a reference to the service that manages a specific disk attachment of the template.
-
#export(opts = {}) ⇒ Object
Exports a template to the data center export domain.
-
#export_to_export_domain(opts = {}) ⇒ Object
Exports a template to an export domain.
-
#export_to_path_on_host(opts = {}) ⇒ Object
Exports a template as an OVA file to a given path on a specified host.
-
#get(opts = {}) ⇒ Template
Returns the information about this template or template version.
-
#graphics_consoles_service ⇒ TemplateGraphicsConsolesService
Returns a reference to the service that manages the graphical consoles that are associated with the template.
-
#mediated_devices_service ⇒ TemplateMediatedDevicesService
Reference to the service that manages mediated devices associated with the template.
-
#nics_service ⇒ TemplateNicsService
Returns a reference to the service that manages the NICs that are associated with the template.
-
#permissions_service ⇒ AssignedPermissionsService
Returns a reference to the service that manages the permissions that are associated with the template.
-
#remove(opts = {}) ⇒ Object
Removes a virtual machine template.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
-
#tags_service ⇒ AssignedTagsService
Returns a reference to the service that manages the tags that are associated with the template.
-
#update(template, opts = {}) ⇒ Template
Updates the template.
-
#watchdogs_service ⇒ TemplateWatchdogsService
Returns a reference to the service that manages the watchdogs that are associated with the template.
Methods inherited from Service
Instance Method Details
#cdroms_service ⇒ TemplateCdromsService
Returns a reference to the service that manages the CD-ROMs that are associated with the template.
27344 27345 27346 |
# File 'lib/ovirtsdk4/services.rb', line 27344 def cdroms_service @cdroms_service ||= TemplateCdromsService.new(self, 'cdroms') end |
#disk_attachments_service ⇒ TemplateDiskAttachmentsService
Returns a reference to the service that manages a specific disk attachment of the template.
27354 27355 27356 |
# File 'lib/ovirtsdk4/services.rb', line 27354 def @disk_attachments_service ||= TemplateDiskAttachmentsService.new(self, 'diskattachments') end |
#export(opts = {}) ⇒ Object
Exports a template to the data center export domain.
For example, send the following request:
POST /ovirt-engine/api/templates/123/export
With a request body like this:
<action>
<storage_domain id="456"/>
<exclusive>true<exclusive/>
</action>
Since version 4.2 of the engine it is also possible to export a template as a virtual appliance (OVA).
For example, to export template 123
as an OVA file named myvm.ova
that is placed in the directory /home/ovirt/
on host myhost
:
POST /ovirt-engine/api/templates/123/export
With a request body like this:
<action>
<host>
<name>myhost</name>
</host>
<directory>/home/ovirt</directory>
<filename>myvm.ova</filename>
</action>
27137 27138 27139 |
# File 'lib/ovirtsdk4/services.rb', line 27137 def export(opts = {}) internal_action(:export, nil, EXPORT, opts) end |
#export_to_export_domain(opts = {}) ⇒ Object
Exports a template to an export domain.
27231 27232 27233 |
# File 'lib/ovirtsdk4/services.rb', line 27231 def export_to_export_domain(opts = {}) internal_action(:export, nil, EXPORT_TO_EXPORT_DOMAIN, opts) end |
#export_to_path_on_host(opts = {}) ⇒ Object
Exports a template as an OVA file to a given path on a specified host.
27275 27276 27277 |
# File 'lib/ovirtsdk4/services.rb', line 27275 def export_to_path_on_host(opts = {}) internal_action(:export, nil, EXPORT_TO_PATH_ON_HOST, opts) end |
#get(opts = {}) ⇒ Template
Returns the information about this template or template version.
27169 27170 27171 |
# File 'lib/ovirtsdk4/services.rb', line 27169 def get(opts = {}) internal_get(GET, opts) end |
#graphics_consoles_service ⇒ TemplateGraphicsConsolesService
Returns a reference to the service that manages the graphical consoles that are associated with the template.
27363 27364 27365 |
# File 'lib/ovirtsdk4/services.rb', line 27363 def graphics_consoles_service @graphics_consoles_service ||= TemplateGraphicsConsolesService.new(self, 'graphicsconsoles') end |
#mediated_devices_service ⇒ TemplateMediatedDevicesService
Reference to the service that manages mediated devices associated with the template.
27372 27373 27374 |
# File 'lib/ovirtsdk4/services.rb', line 27372 def mediated_devices_service @mediated_devices_service ||= TemplateMediatedDevicesService.new(self, 'mediateddevices') end |
#nics_service ⇒ TemplateNicsService
Returns a reference to the service that manages the NICs that are associated with the template.
27381 27382 27383 |
# File 'lib/ovirtsdk4/services.rb', line 27381 def nics_service @nics_service ||= TemplateNicsService.new(self, 'nics') end |
#permissions_service ⇒ AssignedPermissionsService
Returns a reference to the service that manages the permissions that are associated with the template.
27390 27391 27392 |
# File 'lib/ovirtsdk4/services.rb', line 27390 def @permissions_service ||= AssignedPermissionsService.new(self, 'permissions') end |
#remove(opts = {}) ⇒ Object
Removes a virtual machine template.
DELETE /ovirt-engine/api/templates/123
27199 27200 27201 |
# File 'lib/ovirtsdk4/services.rb', line 27199 def remove(opts = {}) internal_remove(REMOVE, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
27419 27420 27421 27422 27423 27424 27425 27426 27427 27428 27429 27430 27431 27432 27433 27434 27435 27436 27437 27438 27439 27440 27441 27442 27443 27444 27445 27446 27447 27448 27449 27450 27451 27452 27453 27454 27455 27456 27457 27458 27459 27460 27461 27462 27463 27464 27465 27466 27467 27468 27469 27470 27471 27472 |
# File 'lib/ovirtsdk4/services.rb', line 27419 def service(path) if path.nil? || path == '' return self end if path == 'cdroms' return cdroms_service end if path.start_with?('cdroms/') return cdroms_service.service(path[7..-1]) end if path == 'diskattachments' return end if path.start_with?('diskattachments/') return .service(path[16..-1]) end if path == 'graphicsconsoles' return graphics_consoles_service end if path.start_with?('graphicsconsoles/') return graphics_consoles_service.service(path[17..-1]) end if path == 'mediateddevices' return mediated_devices_service end if path.start_with?('mediateddevices/') return mediated_devices_service.service(path[16..-1]) end if path == 'nics' return nics_service end if path.start_with?('nics/') return nics_service.service(path[5..-1]) end if path == 'permissions' return end if path.start_with?('permissions/') return .service(path[12..-1]) end if path == 'tags' return end if path.start_with?('tags/') return .service(path[5..-1]) end if path == 'watchdogs' return watchdogs_service end if path.start_with?('watchdogs/') return watchdogs_service.service(path[10..-1]) end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |
#tags_service ⇒ AssignedTagsService
Returns a reference to the service that manages the tags that are associated with the template.
27399 27400 27401 |
# File 'lib/ovirtsdk4/services.rb', line 27399 def @tags_service ||= AssignedTagsService.new(self, 'tags') end |
#update(template, opts = {}) ⇒ Template
Updates the template.
The name
, description
, type
, memory
, cpu
, topology
, os
, high_availability
, display
,
stateless
, usb
, and timezone
elements can be updated after a template has been created.
For example, to update a template so that it has 1 GiB of memory send a request like this:
PUT /ovirt-engine/api/templates/123
With the following request body:
<template>
<memory>1073741824</memory>
</template>
The version_name
name attribute is the only one that can be updated within the version
attribute used for
template versions:
<template>
<version>
<version_name>mytemplate_2</version_name>
</version>
</template>
27335 27336 27337 |
# File 'lib/ovirtsdk4/services.rb', line 27335 def update(template, opts = {}) internal_update(template, Template, UPDATE, opts) end |
#watchdogs_service ⇒ TemplateWatchdogsService
Returns a reference to the service that manages the watchdogs that are associated with the template.
27408 27409 27410 |
# File 'lib/ovirtsdk4/services.rb', line 27408 def watchdogs_service @watchdogs_service ||= TemplateWatchdogsService.new(self, 'watchdogs') end |