[libvirt] [PATCH v2] util: only register callbacks for CREATE operations in virnetdevmacvlan.c
Laine Stump
laine at laine.org
Wed Apr 18 15:54:55 UTC 2012
On 04/18/2012 07:09 AM, D. Herrendoerfer wrote:
> From: "D. Herrendoerfer" <d.herrendoerfer at herrendoerfer.name>
>
> currently upon a migration a callback is created when a 802.1qbg link
> is set to PREASSOCIATE, this should not happen because this is
> a no-op on most switches, and does not lead to an ASSOCIATE state.
> This patch only creates callbacks when CREATE is requested.
> A VM restore also leads to an association creation and it is also
> covered here.
> Migration and libvirtd restart scenarios are already handeled elsewhere.
>
> Signed-off-by: D. Herrendoerfer <d.herrendoerfer at herrendoerfer.name>
> ---
> src/util/virnetdevmacvlan.c | 11 ++++++++---
> 1 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
> index 17ea883..1890759 100644
> --- a/src/util/virnetdevmacvlan.c
> +++ b/src/util/virnetdevmacvlan.c
> @@ -945,9 +945,14 @@ create_name:
> goto disassociate_exit;
> }
>
> - if (virNetDevMacVLanVPortProfileRegisterCallback(cr_ifname, macaddress,
> - linkdev, vmuuid, virtPortProfile, vmOp) < 0 )
> - goto disassociate_exit;
> + if (vmOp == VIR_NETDEV_VPORT_PROFILE_OP_CREATE ||
> + vmOp == VIR_NETDEV_VPORT_PROFILE_OP_RESTORE ) {
> + /* Only directly register upon a create/restore -
> + migration and restart are handled elsewhere */
> + if (virNetDevMacVLanVPortProfileRegisterCallback(cr_ifname, macaddress,
> + linkdev, vmuuid, virtPortProfile, vmOp) < 0 )
> + goto disassociate_exit;
> + }
>
> return rc;
>
ACK and pushed (prior to seeing Stefan's message, but as I understand
it, 802.1qbh doesn't use these callbacks at all, and this particular
patch is only *decreasing* the number of added callbacks, so if anything
it should make the situation better :-)
Note that it looks like these callbacks are being registered for any
direct interface with a non-null port profile, not just for 802.1qbg. If
others don't need it (can someone verify that? If so, I'll send the
patch), we should add a qualifying if() (possibly at this same place) to
only register if the portprofile type is 802.1qbh, i.e.
if ((virPortProfile->virtPortType ==
VIR_NETDEV_VPORT_PROFILE_8021QBG) &&
(vmOp == VIR_NETDEV_VPORT_PROFILE_OP_CREATE ||
vmOp == VIR_NETDEV_VPORT_PROFILE_OP_RESTORE)) {
...
More information about the libvir-list
mailing list