<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 19, 2016 at 11:45 PM, Laine Stump <span dir="ltr"><<a href="mailto:laine@laine.org" target="_blank">laine@laine.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>On 05/18/2016 05:30 PM, Shivaprasad G Bhat wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
This function was not used so far. Now, that we begin to use it, make sure to<br>
check the address before actually releasing the address.<br>
<br>
Signed-off-by: Shivaprasad G Bhat <<a href="mailto:sbhat@linux.vnet.ibm.com" target="_blank">sbhat@linux.vnet.ibm.com</a>><br>
---<br>
  src/conf/domain_addr.c |   18 +++++++++++++++++-<br>
  1 file changed, 17 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c<br>
index 35c7cd4..7ea9e4d 100644<br>
--- a/src/conf/domain_addr.c<br>
+++ b/src/conf/domain_addr.c<br>
@@ -497,8 +497,24 @@ int<br>
  virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs,<br>
                                 virPCIDeviceAddressPtr addr)<br>
  {<br>
+    /* permit any kind of connection type in validation, since we<br>
+     * already had it, and are giving it back.<br>
+     */<br>
+    virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPES_MASK;<br>
+    int ret = -1;<br>
+    char *addrStr = NULL;<br>
+<br>
+    if (!(addrStr = virDomainPCIAddressAsString(addr)))<br>
+        goto cleanup;<br>
+<br>
+    if (!virDomainPCIAddressValidate(addrs, addr, addrStr, flags, false))<br>
+        goto cleanup;<br>
</blockquote>
<br></div></div>
I don't think this is necessary. virDomainPCIAddressValidate() is used to verify that it's okay to plug a particular device into a particular slot. But since the device is already in the slot, that's a moot point. The only thing that needs to be verified is that libvirt has information that this device is in the given slot (which I'm assuming is done at a higher level).<div><div><br></div></div></blockquote><div><br></div><div>virDomainPCIAddressReleaseSlot valiadates the address before releasing today. I didnt want to skip the checks which used to happen before. <br></div><div><br></div><div>  </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+<br>
      addrs->buses[addr->bus].slots[addr->slot] &= ~(1 << addr->function);<br>
-    return 0;<br>
+    ret = 0;<br>
+ cleanup:<br>
+    VIR_FREE(addrStr);<br>
+    return ret;<br>
  }<br>
    int<br>
<br>
--<br>
libvir-list mailing list<br>
<a href="mailto:libvir-list@redhat.com" target="_blank">libvir-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/libvir-list" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/libvir-list</a><br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div></div>