[libvirt] [PATCH v5 0/2] Avoid slash characteres for 'domrename' command.
The commits enhace the 'domrename' command of QEMU and Test drivers to avoid slashes chars inside the new domain name. Julio Faracco (2): qemu: avoid slash characters to the new domain name. test: avoid slash characters to the new domain name. src/qemu/qemu_driver.c | 6 ++++++ src/test/test_driver.c | 6 ++++++ 2 files changed, 12 insertions(+) -- 2.17.0
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. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1333232 Signed-off-by: Julio Faracco <jcfaracco@gmail.com> --- 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 7484b00e23..79a1ddcebf 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20752,6 +20752,12 @@ qemuDomainRenameCallback(virDomainObjPtr vm, virCheckFlags(0, ret); + if (strchr(new_name, '/')) { + virReportError(VIR_ERR_XML_ERROR, + _("name %s cannot contain '/'"), new_name); + return -1; + } + cfg = virQEMUDriverGetConfig(driver); if (VIR_STRDUP(new_dom_name, new_name) < 0) -- 2.17.0
As QEMU driver, test driver does not accept slashes inside domain names. This commit fixes this problem checking slashes inside the new name when 'domrename' is executed. Signed-off-by: Julio Faracco <jcfaracco@gmail.com> --- src/test/test_driver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index a1888c0c9f..974369f28a 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2638,6 +2638,12 @@ testDomainRenameCallback(virDomainObjPtr privdom, virCheckFlags(0, -1); + if (strchr(new_name, '/')) { + virReportError(VIR_ERR_XML_ERROR, + _("name %s cannot contain '/'"), new_name); + return -1; + } + if (VIR_STRDUP(new_dom_name, new_name) < 0) goto cleanup; -- 2.17.0
On 05/01/2018 11:56 AM, Julio Faracco wrote:
The commits enhace the 'domrename' command of QEMU and Test drivers to avoid slashes chars inside the new domain name.
Julio Faracco (2): qemu: avoid slash characters to the new domain name. test: avoid slash characters to the new domain name.
src/qemu/qemu_driver.c | 6 ++++++ src/test/test_driver.c | 6 ++++++ 2 files changed, 12 insertions(+)
Series, Reviewed-by: John Ferlan <jferlan@redhat.com> John I'll push when 4.4.0 opens for action!
Thanks, John! -- Julio Cesar Faracco 2018-05-01 19:56 GMT-03:00 John Ferlan <jferlan@redhat.com>:
On 05/01/2018 11:56 AM, Julio Faracco wrote:
The commits enhace the 'domrename' command of QEMU and Test drivers to avoid slashes chars inside the new domain name.
Julio Faracco (2): qemu: avoid slash characters to the new domain name. test: avoid slash characters to the new domain name.
src/qemu/qemu_driver.c | 6 ++++++ src/test/test_driver.c | 6 ++++++ 2 files changed, 12 insertions(+)
Series,
Reviewed-by: John Ferlan <jferlan@redhat.com>
John
I'll push when 4.4.0 opens for action!
On 05/01/2018 11:56 AM, Julio Faracco wrote:
The commits enhace the 'domrename' command of QEMU and Test drivers to avoid slashes chars inside the new domain name.
Julio Faracco (2): qemu: avoid slash characters to the new domain name. test: avoid slash characters to the new domain name.
src/qemu/qemu_driver.c | 6 ++++++ src/test/test_driver.c | 6 ++++++ 2 files changed, 12 insertions(+)
This is now pushed - I leave it up to you to update the bz. The commit id for the relevant patch is: commit 4e1a9702194eab22cb7b5fb34bd84fc47800223d Author: Julio Faracco <jcfaracco@gmail.com> Date: Tue May 1 12:56:08 2018 -0300 qemu: avoid slash characters to the new domain name. ... $ git describe 4e1a9702194eab22cb7b5fb34bd84fc47800223d v4.3.0-18-g4e1a970219 $ John
Done, John! -- Julio Cesar Faracco 2018-05-03 12:27 GMT-03:00 John Ferlan <jferlan@redhat.com>:
On 05/01/2018 11:56 AM, Julio Faracco wrote:
The commits enhace the 'domrename' command of QEMU and Test drivers to avoid slashes chars inside the new domain name.
Julio Faracco (2): qemu: avoid slash characters to the new domain name. test: avoid slash characters to the new domain name.
src/qemu/qemu_driver.c | 6 ++++++ src/test/test_driver.c | 6 ++++++ 2 files changed, 12 insertions(+)
This is now pushed - I leave it up to you to update the bz. The commit id for the relevant patch is:
commit 4e1a9702194eab22cb7b5fb34bd84fc47800223d Author: Julio Faracco <jcfaracco@gmail.com> Date: Tue May 1 12:56:08 2018 -0300
qemu: avoid slash characters to the new domain name.
...
$ git describe 4e1a9702194eab22cb7b5fb34bd84fc47800223d v4.3.0-18-g4e1a970219 $
John
participants (2)
-
John Ferlan -
Julio Faracco