[libvirt] [PATCH] hostdev: fix net config restore error

John Ferlan jferlan at redhat.com
Fri Apr 24 16:34:11 UTC 2015



On 04/15/2015 01:29 PM, Huanle Han wrote:
> Fix for such a case:
> 1. Domain A and B xml contain the same SRIOV net hostdev(<interface
> type='hostdev' /> with same pci address).
> 2. virsh start A (Successfully, and configure the SRIOV net with
> custom mac)
> 3. virsh start B (Fail because of the hostdev used by domain A or other
> reason.)
> In step 3, 'virHostdevNetConfigRestore' is called for the hostdev
> which is still used by domain A. It makes the mac/vlan of the SRIOV net
> change.
> 
> Code Change in this fix:
> 1. As the pci used by other domain have been removed from
> 'pcidevs' in previous loop, we only restore the nic config for
> the hostdev still in 'pcidevs'(used by this domain)
> 2. wrap a function 'virHostdevIsPCINetDevice', which detect whether the
> hostdev is a pci net device or not.
> 3. update the comments to make it more clear
> 
> Signed-off-by: Huanle Han <hanxueluo at gmail.com>
> ---
>  src/util/virhostdev.c | 70 ++++++++++++++++++++++++++++++++++-----------------
>  1 file changed, 47 insertions(+), 23 deletions(-)
> 

Got my confirmation from Laine via internal IRC that even though the
"overall" code is way more complicated than it needs to be, the patch
does do what it claims - so I've pushed the changes as two patches - the
first just to create the virHostdevIsPCINetDevice and the second for the
actual patch.

Thanks for the patch -

John




More information about the libvir-list mailing list