vmdesc: Add minimal support for CPU model selection
The `cpu` property of `VirtualMachine` objects indicates the value of the `mode` attribute of the `cpu` element in the domain XML configuration. The possible values are * host-model (default) * host-passthrough * custommaster
parent
faeccd5588
commit
167cc3b198
|
@ -74,6 +74,7 @@ class VirtualMachine(object):
|
|||
'fqdn',
|
||||
'ram',
|
||||
'vcpus',
|
||||
'cpu',
|
||||
'net_ifaces',
|
||||
'console',
|
||||
'graphics',
|
||||
|
@ -101,6 +102,7 @@ class VirtualMachine(object):
|
|||
self.fqdn = None
|
||||
self.ram = 256 * 2 ** 20
|
||||
self.vcpus = 1
|
||||
self.cpu = 'host-model'
|
||||
self.net_ifaces = []
|
||||
self.console = 'virtio'
|
||||
self.graphics = 'spice'
|
||||
|
@ -279,6 +281,9 @@ class VirtualMachine(object):
|
|||
elm_vcpu = etree.SubElement(root, 'vcpu', placement='static')
|
||||
elm_vcpu.text = str(self.vcpus)
|
||||
|
||||
if self.cpu:
|
||||
elm_cpu = etree.SubElement(root, 'cpu', mode=self.cpu)
|
||||
|
||||
elm_os = etree.SubElement(root, 'os')
|
||||
elm_type = etree.SubElement(elm_os, 'type', arch='x86_64')
|
||||
elm_type.text = 'hvm'
|
||||
|
|
Loading…
Reference in New Issue