mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +00:00
Remove stale QEMU pidfiles
This commit is contained in:
parent
7a367cca30
commit
9c19a898f9
@ -1,3 +1,8 @@
|
|||||||
|
Tue Apr 21 20:14:03 BST 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
|
* src/qemu_driver.c: Remove pidfile when domain shuts down and
|
||||||
|
cleanup stale pidfile before domain startup.
|
||||||
|
|
||||||
Tue Apr 21 14:39:03 BST 2009 Daniel P. Berrange <berrange@redhat.com>
|
Tue Apr 21 14:39:03 BST 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
* po/POTFILES.in: Add vbox_tmpl.c file
|
* po/POTFILES.in: Add vbox_tmpl.c file
|
||||||
|
@ -1389,6 +1389,14 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
|||||||
if (qemuPrepareHostDevices(conn, vm->def) < 0)
|
if (qemuPrepareHostDevices(conn, vm->def) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if ((ret = virFileDeletePid(driver->stateDir, vm->def->name)) != 0) {
|
||||||
|
virReportSystemError(conn, ret,
|
||||||
|
_("Cannot remove stale PID file for %s"),
|
||||||
|
vm->def->name);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
vm->def->id = driver->nextvmid++;
|
vm->def->id = driver->nextvmid++;
|
||||||
if (qemudBuildCommandLine(conn, driver, vm->def,
|
if (qemudBuildCommandLine(conn, driver, vm->def,
|
||||||
qemuCmdFlags, &argv, &progenv,
|
qemuCmdFlags, &argv, &progenv,
|
||||||
@ -1512,6 +1520,8 @@ cleanup:
|
|||||||
static void qemudShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
|
static void qemudShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||||
struct qemud_driver *driver,
|
struct qemud_driver *driver,
|
||||||
virDomainObjPtr vm) {
|
virDomainObjPtr vm) {
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (!virDomainIsActive(vm))
|
if (!virDomainIsActive(vm))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1556,6 +1566,12 @@ static void qemudShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
VIR_WARN(_("Failed to remove domain status for %s"),
|
VIR_WARN(_("Failed to remove domain status for %s"),
|
||||||
vm->def->name);
|
vm->def->name);
|
||||||
}
|
}
|
||||||
|
if ((ret = virFileDeletePid(driver->stateDir, vm->def->name)) != 0) {
|
||||||
|
char ebuf[1024];
|
||||||
|
VIR_WARN(_("Failed to remove PID file for %s: %s"),
|
||||||
|
vm->def->name, virStrerror(errno, ebuf, sizeof ebuf));
|
||||||
|
}
|
||||||
|
|
||||||
vm->pid = -1;
|
vm->pid = -1;
|
||||||
vm->def->id = -1;
|
vm->def->id = -1;
|
||||||
vm->state = VIR_DOMAIN_SHUTOFF;
|
vm->state = VIR_DOMAIN_SHUTOFF;
|
||||||
|
Loading…
Reference in New Issue
Block a user