mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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:
parent
1dc2587224
commit
0ace4d985a
@ -19937,6 +19937,12 @@ static int qemuDomainRename(virDomainPtr dom,
|
|||||||
goto endjob;
|
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)
|
if (VIR_STRDUP(new_dom_name, new_name) < 0)
|
||||||
goto endjob;
|
goto endjob;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user