[libvirt] [PATCHv2] util: only register callbacks for CREATE operations in virnetdevmacvlan.c
D. Herrendoerfer
d.herrendoerfer at herrendoerfer.name
Wed Apr 18 11:21:20 UTC 2012
On Apr 18, 2012, at 10:53 AM, Laine Stump wrote:
> From: "D. Herrendoerfer" <d.herrendoerfer at herrendoerfer.name>
>
> I believe the following is the correct patch for this - when a guest
> is started from a snapshot or from a saved image, qemuProcessStart is
> called with VIR_NETDEV_VPORT_PROFILE_OP_RESTORE. From my reading of
> the code, the callback will have been removed when the guest was
> previously saved, so it will need to be re-added when it's restored.
>
Yes. I tested for this. In any case of a disassociation the callback
is properly removed.
> Dirk - please test this and let me know if it behaves properly.
>
I just posted an update to my initial patch - sorry for the delay, but
I wanted to make
sure this does not create any other regressions.
My patch is basically identical to yours.
> ---------------------------------
>
> 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 or RESTORE is requested. Migration
> and libvirtd restart scenarios are already handled elsewhere.
>
> Signed-off-by: D. Herrendoerfer <d.herrendoerfer at herrendoerfer.name>
> ---
> src/util/virnetdevmacvlan.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
> index 326e29c..879d846 100644
> --- a/src/util/virnetdevmacvlan.c
> +++ b/src/util/virnetdevmacvlan.c
> @@ -945,9 +945,18 @@ create_name:
> goto disassociate_exit;
> }
>
> - if (virNetDevMacVLanVPortProfileRegisterCallback(cr_ifname,
> macaddress,
> - linkdev, vmuuid,
> virtPortProfile, vmOp) < 0 )
> + if (vmOp == VIR_NETDEV_VPORT_PROFILE_OP_CREATE ||
> + vmOp == VIR_NETDEV_VPORT_PROFILE_OP_RESTORE) {
> + /* Only directly register upon a create or restore
> (restarting
> + * a saved image) - migration and libvirtd restart are
> handled
> + * elsewhere.
> + */
> + if (virNetDevMacVLanVPortProfileRegisterCallback(cr_ifname,
> macaddress,
> + linkdev,
> vmuuid,
> +
> virtPortProfile,
> + vmOp) < 0 )
> goto disassociate_exit;
> + }
>
> return rc;
>
> --
> 1.7.10
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
DirkH
More information about the libvir-list
mailing list