[libvirt] [PATCH] virsh: help: Drop 'id' from possible values for <domain> argument

Erik Skultety posted 1 patch 6 years, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/9b805452eef1b9b3bb7f36654bea44edd02add3e.1505116562.git.eskultet@redhat.com
tools/virsh-domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH] virsh: help: Drop 'id' from possible values for <domain> argument
Posted by Erik Skultety 6 years, 7 months ago
At the moment, we can only rename inactive domains.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1490164

Signed-off-by: Erik Skultety <eskultet@redhat.com>
---

Theoretically, we could also remove this check from qemu_driver.c as it's a
useless check, given that a VM which passes the 'active' check is going to be a
persistent domain:

if (!vm->persistent) {
    virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                   _("cannot rename a transient domain"));
    goto endjob;
}

Also, virshCommandOptDomainBy could be used instead of virshCommandOptDomain in
this case, but we might as well enable rename for active domains as well, who
knows and I don't think this is worth any more attention that just a help string
tweak.

 tools/virsh-domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index f235c66b0..84c8dccae 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -10151,7 +10151,7 @@ static const vshCmdInfo info_domrename[] = {
 };

 static const vshCmdOptDef opts_domrename[] = {
-    VIRSH_COMMON_OPT_DOMAIN_FULL,
+    VIRSH_COMMON_OPT_DOMAIN(N_("domain name or uuid")),
     {.name = "new-name",
      .type = VSH_OT_DATA,
      .flags = VSH_OFLAG_REQ,
--
2.13.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virsh: help: Drop 'id' from possible values for <domain> argument
Posted by Daniel P. Berrange 6 years, 7 months ago
On Mon, Sep 11, 2017 at 10:01:45AM +0200, Erik Skultety wrote:
> At the moment, we can only rename inactive domains.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1490164
> 
> Signed-off-by: Erik Skultety <eskultet@redhat.com>
> ---
> 
> Theoretically, we could also remove this check from qemu_driver.c as it's a
> useless check, given that a VM which passes the 'active' check is going to be a
> persistent domain:
> 
> if (!vm->persistent) {
>     virReportError(VIR_ERR_OPERATION_INVALID, "%s",
>                    _("cannot rename a transient domain"));
>     goto endjob;
> }
> 
> Also, virshCommandOptDomainBy could be used instead of virshCommandOptDomain in
> this case, but we might as well enable rename for active domains as well, who
> knows and I don't think this is worth any more attention that just a help string
> tweak.
> 
>  tools/virsh-domain.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index f235c66b0..84c8dccae 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -10151,7 +10151,7 @@ static const vshCmdInfo info_domrename[] = {
>  };
> 
>  static const vshCmdOptDef opts_domrename[] = {
> -    VIRSH_COMMON_OPT_DOMAIN_FULL,
> +    VIRSH_COMMON_OPT_DOMAIN(N_("domain name or uuid")),
>      {.name = "new-name",
>       .type = VSH_OT_DATA,
>       .flags = VSH_OFLAG_REQ,

NACK.

Virsh is a tool that runs client side, where as the check for non-running
status is done server side. An old virsh may be talking to a new libvirtd
which allows it for running guests. IOW, virsh should not make this kind
of assumption about the QEMU driver impl

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virsh: help: Drop 'id' from possible values for <domain> argument
Posted by Erik Skultety 6 years, 7 months ago
On Mon, Sep 11, 2017 at 09:29:54AM +0100, Daniel P. Berrange wrote:
> On Mon, Sep 11, 2017 at 10:01:45AM +0200, Erik Skultety wrote:
> > At the moment, we can only rename inactive domains.
> >
> > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1490164
> >
> > Signed-off-by: Erik Skultety <eskultet@redhat.com>
> > ---
> >
> > Theoretically, we could also remove this check from qemu_driver.c as it's a
> > useless check, given that a VM which passes the 'active' check is going to be a
> > persistent domain:
> >
> > if (!vm->persistent) {
> >     virReportError(VIR_ERR_OPERATION_INVALID, "%s",
> >                    _("cannot rename a transient domain"));
> >     goto endjob;
> > }
> >
> > Also, virshCommandOptDomainBy could be used instead of virshCommandOptDomain in
> > this case, but we might as well enable rename for active domains as well, who
> > knows and I don't think this is worth any more attention that just a help string
> > tweak.
> >
> >  tools/virsh-domain.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> > index f235c66b0..84c8dccae 100644
> > --- a/tools/virsh-domain.c
> > +++ b/tools/virsh-domain.c
> > @@ -10151,7 +10151,7 @@ static const vshCmdInfo info_domrename[] = {
> >  };
> >
> >  static const vshCmdOptDef opts_domrename[] = {
> > -    VIRSH_COMMON_OPT_DOMAIN_FULL,
> > +    VIRSH_COMMON_OPT_DOMAIN(N_("domain name or uuid")),
> >      {.name = "new-name",
> >       .type = VSH_OT_DATA,
> >       .flags = VSH_OFLAG_REQ,
>
> NACK.
>
> Virsh is a tool that runs client side, where as the check for non-running
> status is done server side. An old virsh may be talking to a new libvirtd
> which allows it for running guests. IOW, virsh should not make this kind
> of assumption about the QEMU driver impl

Do-oh! I clearly don't "libvirt" anymore, you're right, thanks.

Erik

>
> Regards,
> Daniel
> --
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list