<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 03/31/2016 11:58 AM, Moshe Levi
      wrote:<br>
    </div>
    <blockquote
cite="mid:AM4PR05MB182670E898457A69D8289C83D0990@AM4PR05MB1826.eurprd05.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta name="Generator" content="Microsoft Word 15 (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:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 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;
        color:black;}
h4
        {mso-style-priority:9;
        mso-style-link:"Heading 4 Char";
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
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;
        color:black;}
span.Heading4Char
        {mso-style-name:"Heading 4 Char";
        mso-style-priority:9;
        mso-style-link:"Heading 4";
        font-family:"Times New Roman",serif;
        font-weight:bold;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@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:1229917838;
        mso-list-type:hybrid;
        mso-list-template-ids:2125207760 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]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D">Thanks Laine,<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Adding  the
            driver_name o the config did the trick,  thanks
          </span><span style="font-family:Wingdings;color:#1F497D">J</span><span
            style="color:#1F497D">
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Regarding the
            vifo error it seem that openstack does roleback if operation
            failed so that why you see the virDomainAttachDeviceFlags<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Anyhow I found
            that the in qemu 2.1 suspend is not working (I got error [1]
            )  so I upgrade to qemu 2.5 and then suspend work but it
            failed on resume.
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">So Just to
            clarify vfio is not supporting “attach device” right?  is
            qemu going to support it?
          </span></p>
      </div>
    </blockquote>
    <br>
    Not at all. attach device works just fine with vfio (that's how
    hotplug is done). I've just been using it myself in some testing.
    (note that vfio has been supported since kernel 3.6 and libvirt
    1.0.5, i.e. a "very long time")<br>
    <br>
    <br>
    <blockquote
cite="mid:AM4PR05MB182670E898457A69D8289C83D0990@AM4PR05MB1826.eurprd05.prod.outlook.com"
      type="cite">
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Now I wonder if
            I need to hardcode in the hostdev config to be with
            driver_name=kvm…
          </span></p>
      </div>
    </blockquote>
    <br>
    <br>
    I certainly hope not. You would be viciously attacked by the keeper
    of vfio for your transgression! :-)<br>
    <br>
    Seriously, there should be no reason whatsoever to force driver
    name='kvm'. This was made configurable *only* as a fallback in case
    errors were encountered with vfio during its early days. As a matter
    of fact, I'm pretty sure that RHEL7 has legacy kvm device assignment
    completely disabled. If you are needing to force legacy kvm device
    assignment to make your setup work, then there is a bug somewhere
    that needs to be investigated and squashed.<br>
    <br>
    <br>
    <br>
    <blockquote
cite="mid:AM4PR05MB182670E898457A69D8289C83D0990@AM4PR05MB1826.eurprd05.prod.outlook.com"
      type="cite">
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">[1]
            -ERROR:qom/object.c:725:object_unref: assertion failed:
            (obj->ref > 0)<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <div style="border:none;border-left:solid blue 1.5pt;padding:0in
          0in 0in 4.0pt">
          <div>
            <div style="border:none;border-top:solid #E1E1E1
              1.0pt;padding:3.0pt 0in 0in 0in">
              <p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span
                  style="color:windowtext"> sendmail
                  [<a class="moz-txt-link-freetext" href="mailto:justsendmailnothingelse@gmail.com">mailto:justsendmailnothingelse@gmail.com</a>]
                  <b>On Behalf Of </b>Laine Stump<br>
                  <b>Sent:</b> Wednesday, March 30, 2016 9:25 PM<br>
                  <b>To:</b> Libvirt <a class="moz-txt-link-rfc2396E" href="mailto:libvir-list@redhat.com"><libvir-list@redhat.com></a><br>
                  <b>Cc:</b> Moshe Levi <a class="moz-txt-link-rfc2396E" href="mailto:moshele@mellanox.com"><moshele@mellanox.com></a><br>
                  <b>Subject:</b> Re: [libvirt] Host device assignment
                  driver name vfio/ kvm<o:p></o:p></span></p>
            </div>
          </div>
          <p class="MsoNormal"><o:p> </o:p></p>
          <div>
            <p class="MsoNormal">On 03/29/2016 07:45 AM, Moshe Levi
              wrote:<span style="font-size:12.0pt"><o:p></o:p></span></p>
          </div>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <p class="MsoNormal">Hi,<o:p></o:p></p>
            <p class="MsoNormal"> <o:p></o:p></p>
            <p class="MsoNormal">I was  testing <a
                moz-do-not-send="true" name="elementsHostDev">Host
                device assignment</a>  in OpenStack environment where
              the driver name is vfio or kvm.
              <o:p></o:p></p>
            <p class="MsoNormal"> <o:p></o:p></p>
            <p class="MsoNormal">My setup is as follow: <o:p></o:p></p>
            <p class="MsoListParagraph"
              style="text-indent:-.25in;mso-list:l0 level1 lfo2"><!--[if !supportLists]--><span
                style="mso-list:Ignore">1.<span style="font:7.0pt
                  "Times New Roman"">      
                </span></span><!--[endif]--><span dir="LTR"></span>Fedora
              21<o:p></o:p></p>
            <p class="MsoListParagraph"
              style="text-indent:-.25in;mso-list:l0 level1 lfo2"><!--[if !supportLists]--><span
                style="mso-list:Ignore">2.<span style="font:7.0pt
                  "Times New Roman"">      
                </span></span><!--[endif]--><span dir="LTR"></span>Libvirt
              1.3.0 which I compiled<o:p></o:p></p>
            <p class="MsoListParagraph"
              style="text-indent:-.25in;mso-list:l0 level1 lfo2"><!--[if !supportLists]--><span
                style="mso-list:Ignore">3.<span style="font:7.0pt
                  "Times New Roman"">      
                </span></span><!--[endif]--><span dir="LTR"></span>OpenStack
              master <o:p></o:p></p>
            <p class="MsoNormal"> <o:p></o:p></p>
            <p class="MsoNormal">I have also other setups with older
              Libvirt version and the same OpenStack environment.
              <o:p></o:p></p>
            <p class="MsoNormal"> <o:p></o:p></p>
            <p class="MsoNormal">I notice that on my fedora environment
              the driver name is vfio were in my old environment the
              driver name is kvm.<o:p></o:p></p>
            <p class="MsoNormal"> <o:p></o:p></p>
            <p class="MsoNormal">According to Libvirt documentation
              default is "vfio" on systems where the VFIO driver is
              available and loaded, see [1]<o:p></o:p></p>
            <p class="MsoNormal">I remove the vfio modules by removing
              vfio, vfio_iommu_type1, vfio_pci but when I boot a vm the
              drive name is vfio<o:p></o:p></p>
            <p class="MsoNormal">How can change the driver name to be
              kvm?<o:p></o:p></p>
          </blockquote>
          <p class="MsoNormal"><span
              style="font-size:12.0pt;font-family:"Times New
              Roman",serif"><br>
              libvirt tries very hard to use vfio rather than legacy
              kvm, because legacy kvm is old, deprecated, and "declared
              bad" :-). But it won't changed it to vfio if you've
              explicitly said that you want to use kvm. If you really
              want to use legacy kvm device assignment, manually set
              that in the config. When you do that, if the system you're
              running on doesn't support it, it will error out rather
              than switching.<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <p class="MsoNormal"> <o:p></o:p></p>
            <p class="MsoNormal">Another thing that I encounter is an
              error when suspending VM (in OpenStack environment)  when
              the driver name is  vfio.<o:p></o:p></p>
            <p class="MsoNormal">In such case I am getting  the
              following error from Libvirt:<o:p></o:p></p>
            <p class="MsoNormal">2016-03-28 11:42:59.527 1966 ERROR
              oslo_messaging.rpc.dispatcher   File
              "/usr/lib64/python2.7/site-packages/libvirt.py", line 560,
              in attachDeviceFlags<o:p></o:p></p>
            <p class="MsoNormal">2016-03-28 11:42:59.527 1966 ERROR
              oslo_messaging.rpc.dispatcher     if ret == -1: raise
              libvirtError ('virDomainAttachDeviceFlags() failed',
              dom=self)<o:p></o:p></p>
            <p class="MsoNormal">2016-03-28 11:42:59.527 1966 ERROR
              oslo_messaging.rpc.dispatcher libvirtError: internal
              error: unable to execute QEMU command 'device_add': Device
              initialization failed.<o:p></o:p></p>
            <p class="MsoNormal"> <o:p></o:p></p>
            <p class="MsoNormal">I would appreciate for some pointers on
              what can cause this issue.<o:p></o:p></p>
          </blockquote>
          <p class="MsoNormal"><span
              style="font-size:12.0pt;font-family:"Times New
              Roman",serif"><br>
              Assuming that openstack uses libvirt's virDomainSave API I
              would expect suspending a guest to fail if it had an
              assigned device (since libvirt implements this by
              "migrating to disk", and qemu doesn't allow migration of a
              guest with an assigned device. But your problem is that
              it's trying to *attach* a device, which I wouldn't
              consider to be a part of a save or suspend or whatever
              operation. Is it possible to get more information about
              what leads up to this?<br>
              <br>
              <br>
              <br>
              <o:p></o:p></span></p>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <p class="MsoNormal"> <o:p></o:p></p>
            <p class="MsoNormal">[1] <a moz-do-not-send="true"
                href="https://libvirt.org/formatdomain.html#elementsHostDev">
                https://libvirt.org/formatdomain.html#elementsHostDev</a><o:p></o:p></p>
            <p class="MsoNormal"> <o:p></o:p></p>
            <p class="MsoNormal"> <o:p></o:p></p>
            <p class="MsoNormal"> <o:p></o:p></p>
            <p class="MsoNormal"><span
                style="font-size:12.0pt;font-family:"Times New
                Roman",serif"><br>
                <br>
                <br>
                <o:p></o:p></span></p>
            <pre>--<o:p></o:p></pre>
            <pre>libvir-list mailing list<o:p></o:p></pre>
            <pre><a moz-do-not-send="true" href="mailto:libvir-list@redhat.com">libvir-list@redhat.com</a><o:p></o:p></pre>
            <pre><a moz-do-not-send="true" href="https://www.redhat.com/mailman/listinfo/libvir-list">https://www.redhat.com/mailman/listinfo/libvir-list</a><o:p></o:p></pre>
          </blockquote>
          <p class="MsoNormal"><span
              style="font-size:12.0pt;font-family:"Times New
              Roman",serif"><o:p> </o:p></span></p>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>