class OvirtSDK4::InstanceTypesService
Constants
- ADD
- LIST
Public Instance Methods
Creates a new instance type.
This requires only a name attribute and can include all hardware configurations of the virtual machine.
- source
POST /ovirt-engine/api/instancetypes
With a request body like this:
- source,xml
<instance_type>
<name>myinstancetype</name>
</template>
Creating an instance type with all hardware configurations with a request body like this:
- source,xml
<instance_type>
<name>myinstancetype</name> <console> <enabled>true</enabled> </console> <cpu> <topology> <cores>2</cores> <sockets>2</sockets> <threads>1</threads> </topology> </cpu> <custom_cpu_model>AMD Opteron_G2</custom_cpu_model> <custom_emulated_machine>q35</custom_emulated_machine> <display> <monitors>1</monitors> <single_qxl_pci>true</single_qxl_pci> <smartcard_enabled>true</smartcard_enabled> <type>spice</type> </display> <high_availability> <enabled>true</enabled> <priority>1</priority> </high_availability> <io> <threads>2</threads> </io> <memory>4294967296</memory> <memory_policy> <ballooning>true</ballooning> <guaranteed>268435456</guaranteed> </memory_policy> <migration> <auto_converge>inherit</auto_converge> <compressed>inherit</compressed> <policy id="00000000-0000-0000-0000-000000000000"/> </migration> <migration_downtime>2</migration_downtime> <os> <boot> <devices> <device>hd</device> </devices> </boot> </os> <rng_device> <rate> <bytes>200</bytes> <period>2</period> </rate> <source>urandom</source> </rng_device> <soundcard_enabled>true</soundcard_enabled> <usb> <enabled>true</enabled> <type>native</type> </usb> <virtio_scsi> <enabled>true</enabled> </virtio_scsi>
</instance_type>
@param instance_type [InstanceType] The `instance_type` to add.
@param opts [Hash] Additional options.
@option opts [Hash] :headers ({}) Additional HTTP headers.
@option opts [Hash] :query ({}) Additional URL query parameters.
@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly
given then the timeout set globally for the connection will be used.
@option opts [Boolean] :wait (true) If `true` wait for the response.
@return [InstanceType]
# File lib/ovirtsdk4/services.rb, line 14584 def add(instance_type, opts = {}) internal_add(instance_type, InstanceType, ADD, opts) end
Locates the `instance_type` service.
@param id [String] The identifier of the `instance_type`.
@return [InstanceTypeService] A reference to the `instance_type` service.
# File lib/ovirtsdk4/services.rb, line 14638 def instance_type_service(id) InstanceTypeService.new(self, id) end
Lists all existing instance types in the system.
The order of the returned list of instance types isn't guaranteed.
@param opts [Hash] Additional options.
@option opts [Boolean] :case_sensitive Indicates if the search performed using the `search` parameter should be performed
taking case into account. The default value is `true`, which means that case is taken into account. If you want to search ignoring case set it to `false`.
@option opts [String] :follow Indicates which inner links should be followed. The objects referenced by these links will be fetched as part
of the current request. See <<documents/003_common_concepts/follow, here>> for details.
@option opts [Integer] :max Sets the maximum number of instance types to return. If not specified all the instance
types are returned.
@option opts [String] :search A query string used to restrict the returned templates.
@option opts [Hash] :headers ({}) Additional HTTP headers.
@option opts [Hash] :query ({}) Additional URL query parameters.
@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly
given then the timeout set globally for the connection will be used.
@option opts [Boolean] :wait (true) If `true` wait for the response.
@return [Array<InstanceType>]
# File lib/ovirtsdk4/services.rb, line 14627 def list(opts = {}) internal_get(LIST, opts) end
Locates the service corresponding to the given path.
@param path [String] The path of the service.
@return [Service] A reference to the service.
# File lib/ovirtsdk4/services.rb, line 14649 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return instance_type_service(path) end return instance_type_service(path[0..(index - 1)]).service(path[(index + 1)..-1]) end