On Thu, May 19, 2016 at 11:45 PM, Laine Stump <laine(a)laine.org> wrote:
On 05/18/2016 05:30 PM, Shivaprasad G Bhat wrote:
> This function was not used so far. Now, that we begin to use it, make
> sure to
> check the address before actually releasing the address.
>
> Signed-off-by: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
> ---
> src/conf/domain_addr.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
> index 35c7cd4..7ea9e4d 100644
> --- a/src/conf/domain_addr.c
> +++ b/src/conf/domain_addr.c
> @@ -497,8 +497,24 @@ int
> virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs,
> virPCIDeviceAddressPtr addr)
> {
> + /* permit any kind of connection type in validation, since we
> + * already had it, and are giving it back.
> + */
> + virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPES_MASK;
> + int ret = -1;
> + char *addrStr = NULL;
> +
> + if (!(addrStr = virDomainPCIAddressAsString(addr)))
> + goto cleanup;
> +
> + if (!virDomainPCIAddressValidate(addrs, addr, addrStr, flags, false))
> + goto cleanup;
>
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).
virDomainPCIAddressReleaseSlot valiadates the address before releasing
today. I didnt want to skip the checks which used to happen before.
+
> addrs->buses[addr->bus].slots[addr->slot] &= ~(1 <<
addr->function);
> - return 0;
> + ret = 0;
> + cleanup:
> + VIR_FREE(addrStr);
> + return ret;
> }
> int
>
> --
> libvir-list mailing list
> libvir-list(a)redhat.com
>
https://www.redhat.com/mailman/listinfo/libvir-list
>
>