mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-09 05:01:28 +00:00
Remove redundant virFileDeletePID() call
qemudShutdownVMDaemon() calls qemudRemoveDomainStatus(), which then calls virFileDeletePID(). qemudShutdownVMDaemon() then unnecessarily calls virFileDeletePID() again. Remove this second usage of it, and also slightly refactor qemudRemoveDomainStatus() to VIR_WARN appropriate error messages. Signed-off-by: Chris Lalancette <clalance@redhat.com>
This commit is contained in:
parent
979218cdd9
commit
9231aa7d95
@ -269,7 +269,7 @@ qemudRemoveDomainStatus(virConnectPtr conn,
|
|||||||
struct qemud_driver *driver,
|
struct qemud_driver *driver,
|
||||||
virDomainObjPtr vm)
|
virDomainObjPtr vm)
|
||||||
{
|
{
|
||||||
int rc = -1;
|
char ebuf[1024];
|
||||||
char *file = NULL;
|
char *file = NULL;
|
||||||
|
|
||||||
if (virAsprintf(&file, "%s/%s.xml", driver->stateDir, vm->def->name) < 0) {
|
if (virAsprintf(&file, "%s/%s.xml", driver->stateDir, vm->def->name) < 0) {
|
||||||
@ -277,19 +277,14 @@ qemudRemoveDomainStatus(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlink(file) < 0 && errno != ENOENT && errno != ENOTDIR) {
|
if (unlink(file) < 0 && errno != ENOENT && errno != ENOTDIR)
|
||||||
qemudReportError(conn, vm, NULL, VIR_ERR_INTERNAL_ERROR,
|
VIR_WARN(_("Failed to remove domain XML for %s: %s"),
|
||||||
_("Failed to unlink status file %s"), file);
|
vm->def->name, virStrerror(errno, buf, sizeof(ebuf)));
|
||||||
goto cleanup;
|
if (virFileDeletePid(driver->stateDir, vm->def->name) != 0)
|
||||||
}
|
VIR_WARN(_("Failed to remove PID file for %s: %s"),
|
||||||
|
vm->def->name, virStrerror(errno, ebuf, sizeof(ebuf)));
|
||||||
|
|
||||||
if(virFileDeletePid(driver->stateDir, vm->def->name))
|
return 0;
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
rc = 0;
|
|
||||||
cleanup:
|
|
||||||
VIR_FREE(file);
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2224,15 +2219,7 @@ retry:
|
|||||||
vm->def->name);
|
vm->def->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemudRemoveDomainStatus(conn, driver, vm) < 0) {
|
qemudRemoveDomainStatus(conn, driver, vm);
|
||||||
VIR_WARN(_("Failed to remove domain status for %s"),
|
|
||||||
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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user