[libvirt] [PATCH] qemuxml2argvtest: Don't overwrite driver stateDir

Michal Privoznik posted 1 patch 7 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/887ffbce43144314d730a6a3cdd7396318a148ce.1489136599.git.mprivozn@redhat.com
tests/qemuxml2argvtest.c | 3 ---
1 file changed, 3 deletions(-)
[libvirt] [PATCH] qemuxml2argvtest: Don't overwrite driver stateDir
Posted by Michal Privoznik 7 years, 1 month ago
This is a very historic artefact. Back in the old days of
830ba76c3e when we had macros to add arguments onto qemu command
line (!) we thought it was a good idea to let qemu write out the
PID file. So we passed -pidfile $stateDir/$domName onto the
command line. Thus, in order for tests to work we needed stable
stateDir in the qemu driver. Unfortunately, after 16efa11aa696
where stateDir is mkdtemp()-d, this approach lead to a leak of
temp dir.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 tests/qemuxml2argvtest.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index d2d267fce..00b0e25cd 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -581,9 +581,6 @@ mymain(void)
     if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509certdir, "/etc/pki/libvirt-chardev") < 0)
         return EXIT_FAILURE;
 
-    VIR_FREE(driver.config->stateDir);
-    if (VIR_STRDUP_QUIET(driver.config->stateDir, "/nowhere") < 0)
-        return EXIT_FAILURE;
     VIR_FREE(driver.config->hugetlbfs);
     if (VIR_ALLOC_N(driver.config->hugetlbfs, 2) < 0)
         return EXIT_FAILURE;
-- 
2.11.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemuxml2argvtest: Don't overwrite driver stateDir
Posted by Martin Kletzander 7 years, 1 month ago
On Fri, Mar 10, 2017 at 10:03:44AM +0100, Michal Privoznik wrote:
>This is a very historic artefact. Back in the old days of
>830ba76c3e when we had macros to add arguments onto qemu command
>line (!) we thought it was a good idea to let qemu write out the
>PID file. So we passed -pidfile $stateDir/$domName onto the
>command line. Thus, in order for tests to work we needed stable
>stateDir in the qemu driver. Unfortunately, after 16efa11aa696
>where stateDir is mkdtemp()-d, this approach lead to a leak of
>temp dir.
>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> tests/qemuxml2argvtest.c | 3 ---
> 1 file changed, 3 deletions(-)
>

ACK

>diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
>index d2d267fce..00b0e25cd 100644
>--- a/tests/qemuxml2argvtest.c
>+++ b/tests/qemuxml2argvtest.c
>@@ -581,9 +581,6 @@ mymain(void)
>     if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509certdir, "/etc/pki/libvirt-chardev") < 0)
>         return EXIT_FAILURE;
>
>-    VIR_FREE(driver.config->stateDir);
>-    if (VIR_STRDUP_QUIET(driver.config->stateDir, "/nowhere") < 0)
>-        return EXIT_FAILURE;
>     VIR_FREE(driver.config->hugetlbfs);
>     if (VIR_ALLOC_N(driver.config->hugetlbfs, 2) < 0)
>         return EXIT_FAILURE;
>--
>2.11.0
>
>--
>libvir-list mailing list
>libvir-list@redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list