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
* custom
master
Dustin 2015-07-22 23:09:42 -05:00
parent faeccd5588
commit 167cc3b198
1 changed files with 5 additions and 0 deletions

View File

@ -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'