<div dir="ltr"><span id="docs-internal-guid-f7be1860-0399-935e-2e4a-ef1fc840a66b"><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;vertical-align:baseline;white-space:pre-wrap">Hi all</span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap">I just encountered a problem in libvirt while was trying to attach and detach a sr-iov vf to my VM</span></p>
<br><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap">The version of my libvirt is 1.1.1-0ubuntu8.5 </span></p>
<br><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap">I tried to attach the device using following xml</span></p>
<br><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap"><interface type='hostdev' managed='yes'></span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">    <mac address='5c:01:fd:12:34:58'/></span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">    <source></span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">        <address type='pci' domain='0x0000' bus='0x04' slot='0x01' function='0x1'/></span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">    </source></span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap"></interface></span></p>
<br><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap">When i attached device it worked properly and i managed to ping another host.</span></p>
<br><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;vertical-align:baseline;white-space:pre-wrap">virsh # attach-device t5 1.xml</span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;vertical-align:baseline;white-space:pre-wrap">Device attached successfully</span></p><br>
<span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"> But when i detached it still i had network traffic in my VM but libvirt (virsh) said that </span></p>
<br><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">virsh # detach-device t5 1.xml</span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">Device detached successfully</span></p>
<br><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap">The next time i tried to attach it libvirt said that </span></p>
<br><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">virsh # attach-device t5 1.xml</span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">error: Failed to attach device from 1.xml</span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">error: Requested operation is not valid: PCI device 0000:04:01.1 is in use by domain t5</span></p>
<br><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap">and when i continue this action after the ‘domain’ i receive some strange characters which might come from the memory space (memory content) like some addresses, links or some characters </span></p>
<br><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap">I tried it with different VMs and different guest OSs that the same happend.</span></p>
<br><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap">The same action was done with another host running libvirt version </span></p>
<br><span style="font-size:15px;font-family:Ubuntu;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Ubuntu;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">Installed: 1.0.2-0ubuntu11.13.04.5~cloud1</span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Ubuntu;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap"> Candidate: 1.0.2-0ubuntu11.13.04.5~cloud1</span><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap"></span></p>
<br><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"> and it worked pretty OK. No problem. </span></p>
<br><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap">Do you have any idea what is wrong?</span></p>
<br><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap">More information:</span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">Kernel : 3.8.0-37-generic </span></p>
<br><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap"> /etc/libvirt/qemu.conf :  security_driver = "none”</span></p>
<br><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">root@compute01:~# ethtool -i eth5</span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">driver: bnx2x</span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">version: 1.78.58</span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">firmware-version: bc 7.4.22 phy 1.34</span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">bus-info: 0000:04:00.1</span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">supports-statistics: yes</span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">supports-test: yes</span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">supports-eeprom-access: yes</span></p>
<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap">supports-register-dump: yes</span></p>
<br><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap"></span><br><span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap"></span><br>
<span style="font-size:13px;font-family:Arial;font-weight:bold;font-style:italic;vertical-align:baseline;white-space:pre-wrap"></span></span></div>