[libvirt] [PATCH] Reject migration with both --live and --offline when migration requested from other clients/API.

Jiri Denemark jdenemar at redhat.com
Thu Mar 3 08:50:03 UTC 2016


The subject is too long, it should be shorter than 65 characters.

On Thu, Mar 03, 2016 at 01:11:50 -0500, Nitesh Konkar wrote:
> ---
>  src/libvirt-domain.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index 9491845..6a5034e 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -3616,6 +3616,13 @@ virDomainMigrate(virDomainPtr domain,
>                               VIR_MIGRATE_NON_SHARED_INC,
>                               error);
>  
> +    if ((flags & VIR_MIGRATE_OFFLINE) && (flags & VIR_MIGRATE_LIVE)) {
> +            virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
> +                           _("Options --live and --offline are "
> +                             "mutually exclusive"));
> +            goto error;
> +    }
> +

The APIs have no --live or --offline options, you should rewrite the
message without using virsh syntax. And moving this check inside the
"if (flags & VIR_MIGRATE_OFFLINE)" block below would be a bit better I
think.

>      if (flags & VIR_MIGRATE_OFFLINE) {
>          if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
>                                        VIR_DRV_FEATURE_MIGRATION_OFFLINE)) {
...

The same comment applies to all instances.

Jirka




More information about the libvir-list mailing list