Class: OvirtSDK4::InstanceTypesService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#add(instance_type, opts = {}) ⇒ InstanceType
Creates a new instance type.
-
#instance_type_service(id) ⇒ InstanceTypeService
Locates the
instance_type
service. -
#list(opts = {}) ⇒ Array<InstanceType>
Lists all existing instance types in the system.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
Methods inherited from Service
Instance Method Details
#add(instance_type, opts = {}) ⇒ InstanceType
Creates a new instance type.
This requires only a name attribute and can include all hardware configurations of the virtual machine.
POST /ovirt-engine/api/instancetypes
With a request body like this:
<instance_type>
<name>myinstancetype</name>
</template>
Creating an instance type with all hardware configurations with a request body like this:
<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>
13311 13312 13313 |
# File 'lib/ovirtsdk4/services.rb', line 13311 def add(instance_type, opts = {}) internal_add(instance_type, InstanceType, ADD, opts) end |
#instance_type_service(id) ⇒ InstanceTypeService
Locates the instance_type
service.
13365 13366 13367 |
# File 'lib/ovirtsdk4/services.rb', line 13365 def instance_type_service(id) InstanceTypeService.new(self, id) end |
#list(opts = {}) ⇒ Array<InstanceType>
Lists all existing instance types in the system.
The order of the returned list of instance types isn’t guaranteed.
13354 13355 13356 |
# File 'lib/ovirtsdk4/services.rb', line 13354 def list(opts = {}) internal_get(LIST, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 |
# File 'lib/ovirtsdk4/services.rb', line 13376 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 |