<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    On 08/21/2012 11:22 AM, Rajesh Kumar Mallah wrote:
    <blockquote
cite="mid:6723506.2925041345519327540.JavaMail.root@zmbox01.trade-india-local.com"
      type="cite">
      <style type="text/css">p { margin: 0; }</style>
      <div style="font-family: Arial; font-size: 10pt; color: rgb(0, 0,
        153);"><br>
        Dear Alex / List  ,<br>
        <br>
        Thanks for the response.<br>
        <br>
        The problem is regarding detaching from the guest not host.<br>
      </div>
    </blockquote>
    <br>
    I see, if you attach a PCI device into guest with 'managed'
    mode(managed='yes') then the device is automatically detached from
    guest and returned to host after guest exiting, for example.<br>
    <br>
    # lspci | grep Eth<br>
    00:19.0 Ethernet controller: Intel Corporation 82566DM-2 Gigabit
    Network Connection (rev 02)<br>
    <br>
    # readlink /sys/bus/pci/devices/0000\:00\:19.0/driver/ -f<br>
    /sys/bus/pci/drivers/e1000e<br>
    <br>
    # virsh start foo<br>
    Domain foo started<br>
    <br>
    # ping -c 3 xx.xx.xx.xx<br>
    PING xx.xx.xx.xx (xx.xx.xx.xx) 56(84) bytes of data.<br>
    64 bytes from nx-in-f160.1e100.net (xx.xx.xx.xx): icmp_seq=1 ttl=49
    time=87.8 ms <br>
    64 bytes from nx-in-f160.1e100.net (xx.xx.xx.xx): icmp_seq=2 ttl=49
    time=85.2 ms <br>
    64 bytes from nx-in-f160.1e100.net (xx.xx.xx.xx): icmp_seq=3 ttl=49
    time=91.8 ms<br>
    --- xx.xx.xx.xx ping statistics ---<br>
    3 packets transmitted, 3 received, 0% packet loss, time 2093ms<br>
    rtt min/avg/max/mdev = 85.240/88.327/91.881/2.731 ms<br>
    <br>
    # cat hostdev.xml <br>
    <hostdev mode='subsystem' type='pci' managed='yes'><br>
       <source><br>
          <address domain='0x0000' bus='0x00' slot='0x19'
    function='0x0'/><br>
       </source><br>
    </hostdev><br>
    <br>
    # virsh attach-device foo hostdev.xml <br>
    Device attached successfully<br>
    <br>
    # readlink /sys/bus/pci/devices/0000\:00\:19.0/driver/ -f<br>
    /sys/bus/pci/drivers/pci-stub<br>
    <br>
    # ping -c 3 xx.xx.xx.xx<br>
    connect: Network is unreachable<br>
    <br>
    # virsh destroy foo<br>
    Domain foo destroyed<br>
    <br>
    # readlink /sys/bus/pci/devices/0000\:00\:19.0/driver/ -f<br>
    /sys/bus/pci/drivers/e1000e<br>
    <br>
    # ping -c 3 xx.xx.xx.xx<br>
    PING xx.xx.xx.xx (xx.xx.xx.xx) 56(84) bytes of data. <br>
    64 bytes from xx.xx.xx.xx: icmp_seq=1 ttl=49 time=79.7 ms <br>
    64 bytes from xx.xx.xx.xx: icmp_seq=2 ttl=49 time=83.2 ms <br>
    64 bytes from xx.xx.xx.xx: icmp_seq=3 ttl=49 time=84.5 ms <br>
    <br>
    --- xx.xx.xx.xx ping statistics ---<br>
    3 packets transmitted, 3 received, 0% packet loss, time 2087ms<br>
    rtt min/avg/max/mdev = 79.714/82.480/84.513/2.040 ms<br>
    <br>
    Notes, need to wait for local network recovery again then check
    network connectivity.<br>
    <br>
    If your network still is disconnect, it may be a bug IMHO, please
    show your libvirt<br>
    and qemu-kvm version, or my example is not what you want, please let
    me know.<br>
    <br>
    Thanks,<br>
    Alex<br>
    <br>
    <blockquote
cite="mid:6723506.2925041345519327540.JavaMail.root@zmbox01.trade-india-local.com"
      type="cite">
      <div style="font-family: Arial; font-size: 10pt; color: rgb(0, 0,
        153);">In our case since ixgbevf driver is NOT present in the
        host hence the virtual <br>
        interfaces never really attach themselves to the host.<br>
        <span><br>
          Regards,<br>
          Rajesh Kumar Mallah<br>
          Tel. 91-11-46710500 (Ext:303)<br>
          Cell +919811255597<br>
          Website: <a class="moz-txt-link-freetext" href="http://www.tradeindia.com/">http://www.tradeindia.com/</a><br>
          \|/ \|/ \|/   stop printing   \|/ \|/ \|/<br>
           |   |   |    start planting   |   |   |<br>
          <br>
        </span><br>
        ----- "Alex Jia" <a class="moz-txt-link-rfc2396E" href="mailto:ajia@redhat.com"><ajia@redhat.com></a> wrote:
        <br>
        | From: "Alex Jia" <a class="moz-txt-link-rfc2396E" href="mailto:ajia@redhat.com"><ajia@redhat.com></a><br>
        | To: "Rajesh Kumar Mallah" <a class="moz-txt-link-rfc2396E" href="mailto:mallah@tradeindia.com"><mallah@tradeindia.com></a><br>
        | Cc: <a class="moz-txt-link-abbreviated" href="mailto:libvirt-users@redhat.com">libvirt-users@redhat.com</a><br>
        | Sent: Tuesday, August 21, 2012 8:31:21 AM<br>
        | Subject: Re: [libvirt-users] automatically detaching PCI host
        devices from guest for SRIOV usage.<br>
        |<br>
        | On 08/20/2012 08:34 PM, Rajesh Kumar Mallah wrote:
        <blockquote
cite="mid:25600302.2901631345466078933.JavaMail.root@zmbox01.trade-india-local.com">
          <pre>Dear List ,

We are using intel 82599EB based SRIOV capable 10GbE cards
on the host machine.The VFs are being assigned to the guest 
in pass through mode and are providing the network connectivity 
as expected.

However when we shutdown the guest the connectivity does not
comes back via the VFs on the guest in next boot unless
the VFs are detached from the *guest* *before* initiating a
shutdown of the guests.
</pre>
        </blockquote>
        Dear Rajesh,<br>
        | <br>
        | Please see the following comments.<br>
        | <br>
        |
        <blockquote
cite="mid:25600302.2901631345466078933.JavaMail.root@zmbox01.trade-india-local.com">
          <pre>( 
the detach is explicitly done via virsh command 
/usr/local/libvirt/bin/virsh  detach-device guest01   ~/nic.xml
nic.xml contained
<hostdev mode='subsystem' type='pci' managed='yes'>
   <source>
      <address domain='0x0000' bus='0x04' slot='0x10' function='0x0'/>
   </source>
   <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</hostdev>
)

The question is anyone else facing similar problem and
if so what solution was used?

Secondly , is there anyway to automate the detaching of the
VFs from the guest when the guest is put in the shutdown 
sequence ? (or for that matter destroyed).
</pre>
        </blockquote>
        <br>
        | When <b><big><big><code>managed</code></big></big></b> is <b>"yes"</b>
        for a PCI device, it is automatically detached from the host
        before being passed on to the guest, and automatically <b>reattached</b>
        to the host after the <b>guest exits</b> such as shutdown a
        guest.<br>
        | <br>
        | Regards,<br>
        | Alex<br>
        | <br>
        |
        <blockquote
cite="mid:25600302.2901631345466078933.JavaMail.root@zmbox01.trade-india-local.com">
          <pre>Regards,
Rajesh Kumar Mallah
Tel. 91-11-46710500 (Ext:303)
Cell +919811255597
Website: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.tradeindia.com/" target="_blank">http://www.tradeindia.com/</a>
\|/ \|/ \|/   stop printing   \|/ \|/ \|/
 |   |   |    start planting   |   |   |

_______________________________________________
libvirt-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:libvirt-users@redhat.com" target="_blank">libvirt-users@redhat.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/libvirt-users" target="_blank">https://www.redhat.com/mailman/listinfo/libvirt-users</a>
</pre>
        </blockquote>
        <br>
        | </div>
    </blockquote>
    <br>
  </body>
</html>