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(a)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