qemu: allow migration of generic <hostdev> with <teaming>

Commit 010ed0856b and commit db64acfbda introduced the ability to use
the <teaming> element in a generic <hostdev> (previously it could only
be used with <interface type='hostdev'>). However, the patch omitted
one crucial detail - along with parsing the <teaming> element in
<hostdev>, and adding the necessary info to the qemu commandline, we
also need to modify qemuMigrationSrcIsAllowedHostdev() to allow
migration when the generic <hostdev> has a <teaming> element.

https://bugzilla.redhat.com/1927984

Fixes: 010ed0856bb06f439e6fdf44e4f529f53441c398
Reported-by: Yalan Zhang <yalzhang@redhat.com>
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Laine Stump 2021-02-23 17:21:56 -05:00
parent 4d94734ba8
commit 98e67d4d8c

View File

@ -1247,13 +1247,17 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *def)
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
/*
* if this is a network interface with <teaming
* type='transient'>, migration *is* allowed because
* the device will be auto-unplugged by QEMU during
* migration.
* if the device has a <teaming type='transient'>
* element, then migration *is* allowed because the
* device will be auto-unplugged by QEMU during
* migration. Generic <hostdev> and <interface
* type='hostdev'> have their teaming configuration
* stored in different places.
*/
if (hostdev->parentnet && hostdev->parentnet->teaming &&
hostdev->parentnet->teaming->type == VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT) {
if ((hostdev->teaming &&
hostdev->teaming->type == VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT) ||
(hostdev->parentnet && hostdev->parentnet->teaming &&
hostdev->parentnet->teaming->type == VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT)) {
continue;
}