[Kimchi-devel] [PATCH v3 3/4] Define the USB xhci controller in the template for Power Systems
Jose Ricardo Ziviani
joserz at linux.vnet.ibm.com
Mon Jul 13 14:47:32 UTC 2015
- When creating VMs using Kimchi in a Power System, the USB xhci
controller is defined by default to have PCI hotplug support.
Signed-off-by: Jose Ricardo Ziviani <joserz at linux.vnet.ibm.com>
---
src/kimchi/vmtemplate.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index 79e04ed..3e42971 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -22,6 +22,7 @@ import stat
import time
import urlparse
import uuid
+import platform
from lxml import etree
from lxml.builder import E
@@ -287,6 +288,19 @@ class VMTemplate(object):
self.info.get('memory') << 10,
cpu_topo)
+ def _get_usb_controller(self):
+ # powerkvm systems must include xhci controller model
+ distro, _, _ = platform.linux_distribution()
+ if distro != "IBM_PowerKVM":
+ return ''
+
+ return """
+ <controller type='usb' index='0' model='nec-xhci'>
+ <address type='pci' domain='0x0000'
+ bus='0x00' slot='0x0f' function='0x0'/>
+ </controller>
+ """
+
def to_vm_xml(self, vm_name, vm_uuid, **kwargs):
params = dict(self.info)
params['name'] = vm_name
@@ -323,6 +337,8 @@ class VMTemplate(object):
elif params['slots'] == 0:
params['slots'] = 1
+ params['usb_controller'] = self._get_usb_controller()
+
xml = """
<domain type='%(domain)s'>
%(qemu-stream-cmdline)s
@@ -352,6 +368,7 @@ class VMTemplate(object):
%(networks)s
%(graphics)s
%(input_output)s
+ %(usb_controller)s
<memballoon model='virtio' />
</devices>
</domain>
--
1.9.1
More information about the Kimchi-devel
mailing list