[Kimchi-devel] [PATCH 3/3] Define the USB xhci controller in the template for Power Systems

Daniel Henrique Barboza dhbarboza82 at gmail.com
Thu Jul 9 14:21:39 UTC 2015


Reviewed-by: Daniel Barboza <dhbarboza82 at gmail.com>

On 07/08/2015 02:42 PM, Jose Ricardo Ziviani wrote:
>   - 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>




More information about the Kimchi-devel mailing list