<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:927926909;
        mso-list-type:hybrid;
        mso-list-template-ids:768751750 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hello all,<o:p></o:p></p>
<p class="MsoNormal">     I find this curious behavior that libvirt will automatically insert a USB controller and a memballoon virtio driver into the domain’s XML, when defineXML is called. IOW, the original XML did not have these 2 devices but they are present
 right after defineXML is called. Why should libvirt add a USB controller?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">DETAILS:<o:p></o:p></p>
<p class="MsoNormal">Here is a little Python snippet to show that behavior:<o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">import libvirt<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">conn = libvirt.open('qemu:///system')<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">xml_list = open('/tmp/vm.xml', "r").readlines()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">in_xml = ''.join(xml_list)
</span><span style="font-family:Wingdings">ß</span><span style="font-family:"Courier New"">
</span><b><span style="color:red">This XML string does not have a USB or a memballoon</span></b><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">dom = conn.defineXML(in_xml)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">out_xml = dom.XMLDesc()
</span><span style="font-family:Wingdings">ß</span><span style="font-family:"Courier New"">
</span><b><span style="color:red">But this XML string does!</span></b><span style="font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">print out_xml</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The file /tmp/vm.xml does not have a memballoon or a USB device. Neither, of course, does in_xml string. But out_xml has:<o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">    <controller type='usb' index='0'><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">    </controller><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">    <memballoon model='virtio'><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">    </memballoon><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I don’t see anything in libvirt.conf that explains this. This is libvirt version: 1.2.8, package: 16.el7_1.5 (Red Hat, Inc....). The host is RHEL 7.1.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The memballoon part is understandable once I found: <a href="https://www.redhat.com/archives/libvir-list/2010-August/msg00132.html">
https://www.redhat.com/archives/libvir-list/2010-August/msg00132.html</a> <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">However, why should libvirt add a USB controller gratuitously? Is this controllable from the conf file?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
<p class="MsoNormal">Sundar<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<hr>
<font face="Arial" color="Black" size="2"><br>
Confidentiality Notice.<br>
This message may contain information that is confidential or otherwise protected from disclosure. If you are not the intended recipient, you are hereby notified that any use, disclosure, dissemination, distribution, or copying of this message, or any attachments,
 is strictly prohibited. If you have received this message in error, please advise the sender by reply e-mail, and delete the message and any attachments. Thank you.<br>
</font>
</body>
</html>