]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuProcessReconnect: Fill in pid file path
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 3 Mar 2015 10:51:19 +0000 (11:51 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 3 Mar 2015 11:10:15 +0000 (12:10 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=1197600

So, libvirt uses pid file to track pid of started qemus. Whenever
a domain is started, its pid is put into corresponding pid file.
The pid file path is generated based on domain name and stored
into domain object internals. However, it's not stored in the
status XML and therefore lost on daemon restarts. Hence, later,
when domain is being shut down, the daemon does not know which
pid file to unlink, and the correct pid file is left behind. To
avoid this, lets generate the pid file path again in
qemuProcessReconnect().

Reported-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_process.c

index c433e0623f447b8c37b839714d272940f0374a53..d1f089ddd52a5cb0a45218bcdeb37e5529210083 100644 (file)
@@ -3762,6 +3762,11 @@ qemuProcessReconnect(void *opaque)
     cfg = virQEMUDriverGetConfig(driver);
     priv = obj->privateData;
 
+    /* XXX If we ever gonna change pid file pattern, come up with
+     * some intelligence here to deal with old paths. */
+    if (!(priv->pidfile = virPidFileBuildPath(cfg->stateDir, obj->def->name)))
+        goto killvm;
+
     if (qemuDomainObjBeginJob(driver, obj, QEMU_JOB_MODIFY) < 0)
         goto killvm;