[PATCH] qemu_migration: check for interface type 'hostdev'
Michal Prívozník
mprivozn at redhat.com
Thu Jul 29 09:42:21 UTC 2021
On 7/28/21 6:17 PM, Kristina Hanicova wrote:
> When we try to migrate vm, we check if it contains only devices
> that are able to migrate. If a hostdev device is not able to
> migrate we raise an error with <hostdev/>, but it can actually be
> <interface/>, so we need to check if hostdev device was created
> by us from interface and show the right error message.
>
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1942315
>
> Signed-off-by: Kristina Hanicova <khanicov at redhat.com>
> ---
> src/qemu/qemu_migration.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 4d651aeb1a..34eee9c8b6 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -1272,9 +1272,15 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *def)
> }
>
> /* all other PCI hostdevs can't be migrated */
> - virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
> - _("cannot migrate a domain with <hostdev mode='subsystem' type='%s'>"),
> - virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
> + if (hostdev->parentnet) {
> + virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
> + _("cannot migrate a domain with <interface type='%s'>"),
> + virDomainNetTypeToString(hostdev->parentnet->type));
Small nit, I wonder whether we should report actual type here. Looking
into virDomainNetDefFormat() it looks like for a running VM we do report
actual type (unless inactive or migratable XML was requested). Thus I
think the error message should follow that logic. Otherwise we might
report "cannot migrate a domain with interface type=network" while in
fact in 'virsh dumpxml' there is just interface type='hostdev' (the
type='network' is in inactive XML).
Laine, what's your opinion?
Michal
More information about the libvir-list
mailing list