On Mon, Aug 17, 2015 at 11:16:29PM +0200, Michal Privoznik wrote:
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.
Or just return 0 :) (that way it's a feature)
Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4c05324..083e4ff 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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; -- 2.4.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list