On 06/14/2017 04:29 AM, ZhiPeng Lu wrote:> Before libvirt that calls
virNetDevMacVLanCreateWithVPortProfile sets mac address> or vlan of a Virtual
Function(VF) linked to a macvtap passthrough device of migration> destination
host in migration start step. If we ping the migrating vm,> we get the network
does not pass. Because VFs of migration source and destination> have the same
MAC address. The patch later calling qemuMigrationVPAssociatePortProfiles> sets
mac address of VF in migration finish step instead of start step.> The patch
aims to reduce packet loss rate.>I missed this patch when you initially sent
it, and see that nobody else>responded...>What you're doing here shouldn't be
needed. During migration, a macvtap>device should be created with ~IFF_UP, and
not brought online until>qemuInterfaceStartDevice() is called just prior to
starting the guest>CPUs on the destination by this time the guest CPUs on the
source have>already been stopped (and the guest's macvtap interfaces on the
source>have been set offline). Until a device is IFF_UP, it shouldn't send
out>any traffic with its MAC address.
----Probably not understanding what I mean when the network packet loss
happens.
This patch describes the time before the guest CPU on the source has been
stopped and the macvtap device was IFF_UP.
if we send network data from the destination, the network packet loss.
>If you look at the macvtap device on the destination and it has IFF_UP>set
>prior to the completion of migration, then there is a bug in libvirt>that we
>need to fix. Otherwise, I think any packet loss you're seeing is>coming from
>something else.>> Signed-off-by: ZhiPeng Lu <[email protected]>> --->
>src/qemu/qemu_migration.c | 18 ++++++++++++++++-->
>src/util/virnetdevmacvlan.c | 17 +++++++++++------> 2 files changed, 27
>insertions(+), 8 deletions(-)>> diff --git a/src/qemu/qemu_migration.c
>b/src/qemu/qemu_migration.c> index 09adb04..795ed71 100644> ---
>a/src/qemu/qemu_migration.c> +++ b/src/qemu/qemu_migration.c> @@ -5004,7
>+5004,7 @@ qemuMigrationPerform(virQEMUDriverPtr driver,> }> > static int>
>-qemuMigrationVPAssociatePortProfiles(virDomainDefPtr def)>
>+qemuMigrationVPAssociatePortProfiles(virDomainDefPtr def, const char
>*stateDir)
芦志朋 luzhipeng
IT开发工程师 IT Development
Engineer
操作系统产品部/中心研究院/系统产品 OS Product Dept./Central R&D Institute/System Product
深圳市南山区科技南路55号中兴通讯研发大楼33楼
33/F, R&D Building, ZTE
Corporation Hi-tech Road South,
Hi-tech
Industrial Park Nanshan District, Shenzhen, P.R.China, 518057
T: +86 755 xxxxxxxx F:+86 755 xxxxxxxx
M: +86 xxxxxxxxxxx
E: [email protected]
www.zte.com.cn
原始邮件
发件人: <[email protected]>
收件人: <[email protected]>
抄送人:芦志朋10108272
日 期 :2017年07月17日 05:01
主 题 :Re: [libvirt] [v2 RESEND PATCH] qemu: reduce packet loss rate for vmwith
macvtap passthrough mode in migration
On 06/14/2017 04:29 AM, ZhiPeng Lu wrote:
> Before libvirt that calls virNetDevMacVLanCreateWithVPortProfile sets mac
> address
> or vlan of a Virtual Function(VF) linked to a macvtap passthrough device of
> migration
> destination host in migration start step. If we ping the migrating vm,
> we get the network does not pass. Because VFs of migration source and
> destination
> have the same MAC address. The patch later calling
> qemuMigrationVPAssociatePortProfiles
> sets mac address of VF in migration finish step instead of start step.
> The patch aims to reduce packet loss rate.
I missed this patch when you initially sent it, and see that nobody else
responded...
What you're doing here shouldn't be needed. During migration, a macvtap
device should be created with ~IFF_UP, and not brought online until
qemuInterfaceStartDevice() is called just prior to starting the guest
CPUs on the destination by this time the guest CPUs on the source have
already been stopped (and the guest's macvtap interfaces on the source
have been set offline). Until a device is IFF_UP, it shouldn't send out
any traffic with its MAC address.
If you look at the macvtap device on the destination and it has IFF_UP
set prior to the completion of migration, then there is a bug in libvirt
that we need to fix. Otherwise, I think any packet loss you're seeing is
coming from something else.
>
> Signed-off-by: ZhiPeng Lu <[email protected]>
> ---
> src/qemu/qemu_migration.c | 18 ++++++++++++++++--
> src/util/virnetdevmacvlan.c | 17 +++++++++++------
> 2 files changed, 27 insertions(+), 8 deletions(-)
>
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 09adb04..795ed71 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -5004,7 +5004,7 @@ qemuMigrationPerform(virQEMUDriverPtr driver,
> }
>
> static int
> -qemuMigrationVPAssociatePortProfiles(virDomainDefPtr def)
> +qemuMigrationVPAssociatePortProfiles(virDomainDefPtr def, const char
> *stateDir)
> {
> size_t i
> int last_good_net = -1
> @@ -5013,6 +5013,20 @@ qemuMigrationVPAssociatePortProfiles(virDomainDefPtr
> def)
> for (i = 0 i < def->nnets i++) {
> net = def->nets[i]
> if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_DIRECT) {
> + if ((!virDomainNetGetActualVirtPortProfile(net) ||
> (virDomainNetGetActualVirtPortProfile(net) &&
> + virDomainNetGetActualVirtPortProfile(net)->virtPortType !=
> VIR_NETDEV_VPORT_PROFILE_8021QBG &&
> + virDomainNetGetActualVirtPortProfile(net)->virtPortType !=
> VIR_NETDEV_VPORT_PROFILE_8021QBH)) &&
> + virDomainNetGetActualDirectMode(net) ==
> + VIR_NETDEV_MACVLAN_MODE_PASSTHRU) {
> + if
> (virNetDevSaveNetConfig(virDomainNetGetActualDirectDev(net),
> + -1, stateDir, false) < 0) {
> + goto err_exit
> + }
> + if
> (virNetDevSetNetConfig(virDomainNetGetActualDirectDev(net),
> + -1, NULL, virDomainNetGetActualVlan(net), &net->mac,
> false) < 0) {
> + goto err_exit
> + }
> + }
> if (virNetDevVPortProfileAssociate(net->ifname,
>
> virDomainNetGetActualVirtPortProfile(net),
> &net->mac,
> @@ -5187,7 +5201,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
> goto endjob
> }
>
> - if (qemuMigrationVPAssociatePortProfiles(vm->def) < 0)
> + if (qemuMigrationVPAssociatePortProfiles(vm->def, cfg->stateDir) < 0)
> goto endjob
>
> if (mig->network && qemuDomainMigrateOPDRelocate(driver, vm, mig) < 0)
> diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
> index 7222b0f..682dcd1 100644
> --- a/src/util/virnetdevmacvlan.c
> +++ b/src/util/virnetdevmacvlan.c
> @@ -1020,12 +1020,17 @@ virNetDevMacVLanCreateWithVPortProfile(const char
> *ifnameRequested,
> */
> setVlan = false
> }
> -
> - if (virNetDevSaveNetConfig(linkdev, -1, stateDir, setVlan) < 0)
> - return -1
> -
> - if (virNetDevSetNetConfig(linkdev, -1, NULL, vlan, macaddress,
> setVlan) < 0)
> - return -1
> + if (vmOp != VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START &&
> + virtPortProfile && (virtPortProfile->virtPortType ==
> VIR_NETDEV_VPORT_PROFILE_8021QBH ||
> + virtPortProfile->virtPortType ==
> VIR_NETDEV_VPORT_PROFILE_8021QBG)) {
> + if (virNetDevSaveNetConfig(linkdev, -1, stateDir, setVlan) < 0) {
> + return -1
> + }
> + if (virNetDevSetNetConfig(linkdev, -1, NULL, vlan, macaddress,
> + setVlan) < 0) {
> + return -1
> + }
> + }
> }
>
> if (ifnameRequested) {--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list