On Tue, May 10, 2022 at 17:21:21 +0200, Jiri Denemark wrote:
> Moves most of the code from qemuMigrationDstPrepareAny to a new
> qemuMigrationDstPrepareFresh so that qemuMigrationDstPrepareAny can be
> shared with post-copy resume.
> 
> Signed-off-by: Jiri Denemark <jdene...@redhat.com>
> ---
>  src/qemu/qemu_migration.c | 165 ++++++++++++++++++++++++--------------
>  1 file changed, 103 insertions(+), 62 deletions(-)
> 
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 8ed1c2c2b6..f1e3774034 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c

[...]

> @@ -3499,6 +3461,85 @@ qemuMigrationDstPrepareAny(virQEMUDriver *driver,
>  }
>  
>  
> +static int
> +qemuMigrationDstPrepareAny(virQEMUDriver *driver,
> +                           virConnectPtr dconn,
> +                           const char *cookiein,
> +                           int cookieinlen,
> +                           char **cookieout,
> +                           int *cookieoutlen,
> +                           virDomainDef **def,
> +                           const char *origname,
> +                           virStreamPtr st,
> +                           const char *protocol,
> +                           unsigned short port,
> +                           bool autoPort,
> +                           const char *listenAddress,
> +                           size_t nmigrate_disks,
> +                           const char **migrate_disks,
> +                           int nbdPort,
> +                           const char *nbdURI,
> +                           qemuMigrationParams *migParams,
> +                           unsigned long flags)
> +{
> +    g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
> +
> +    if (flags & VIR_MIGRATE_OFFLINE) {
> +        if (flags & (VIR_MIGRATE_NON_SHARED_DISK |
> +                     VIR_MIGRATE_NON_SHARED_INC)) {
> +            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
> +                           _("offline migration cannot handle "
> +                             "non-shared storage"));
> +            return -1;
> +        }
> +        if (!(flags & VIR_MIGRATE_PERSIST_DEST)) {
> +            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
> +                           _("offline migration must be specified with "
> +                             "the persistent flag set"));
> +            return -1;
> +        }
> +        if (st) {
> +            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
> +                           _("tunnelled offline migration does not "
> +                             "make sense"));
> +            return -1;
> +        }
> +    }
> +
> +    if (flags & VIR_MIGRATE_POSTCOPY &&
> +        (!(flags & VIR_MIGRATE_LIVE) ||
> +         flags & VIR_MIGRATE_PAUSED)) {
> +        virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
> +                       _("post-copy migration is not supported with non-live 
> "
> +                         "or paused migration"));
> +        return -1;
> +    }

Please remove linebreaks in the error messages in moved code.

Reviewed-by: Peter Krempa <pkre...@redhat.com>

Reply via email to