[libvirt] [PATCH v2] qemu: avoid slash characters to the new domain name.

Ján Tomko jtomko at redhat.com
Mon Apr 23 07:51:37 UTC 2018


On Mon, Apr 23, 2018 at 12:27:40AM -0300, Julio Faracco wrote:
>The 'domrename' command needs to check if the new domain name contains
>the slash character. This character is not accepted by libvirt XML
>definition because it is an invalid char (see Cole's commit b1fc6a7b7).
>This commit enhace the 'domrename' command adding this check. The method
>virDomainDefPostParse() was the other methods to check the domain are
>not accessible.
>
>Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
>---
> src/qemu/qemu_driver.c | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>index 5673d9fd8..9b16bc9c9 100644
>--- a/src/qemu/qemu_driver.c
>+++ b/src/qemu/qemu_driver.c
>@@ -20773,6 +20773,9 @@ qemuDomainRenameCallback(virDomainObjPtr vm,
>     vm->def->name = new_dom_name;
>     new_dom_name = NULL;
>
>+    if (virDomainDefPostParse(vm->def, driver->caps, 0, driver->xmlopt, NULL) < 0)
>+        goto rollback;
>+

As its name suggests virDomainDefPostParse should be called after
parsing a domain definition from XML.

APIs doing small changes to domain definition should make sure that the
individual changes are okay, instead of invoking the full PostParse
machinery, which has the potential to change other stuff as well.

Jano

>     if (virDomainSaveConfig(cfg->configDir, driver->caps, vm->def) < 0)
>         goto rollback;
>
>-- 
>2.14.1
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180423/66a65bb8/attachment-0001.sig>


More information about the libvir-list mailing list