1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 06:50:22 +03:00

qemuDomainRename: Explicitly check if domain is renaming to itself

It may happen that user (mistakenly) wants to rename a domain to
itself. Which is no renaming at all. We should reject that with
some meaningful error message.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2015-08-14 15:36:05 +02:00
parent 1dc2587224
commit 0ace4d985a

View File

@ -19937,6 +19937,12 @@ static int qemuDomainRename(virDomainPtr dom,
goto endjob;
}
if (STREQ(vm->def->name, new_name)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("Can't rename domain to itself"));
goto cleanup;
}
if (VIR_STRDUP(new_dom_name, new_name) < 0)
goto endjob;