mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 18:05:20 +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,
|
||||
virDomainObjPtr vm)
|
||||
{
|
||||
int rc = -1;
|
||||
char ebuf[1024];
|
||||
char *file = NULL;
|
||||
|
||||
if (virAsprintf(&file, "%s/%s.xml", driver->stateDir, vm->def->name) < 0) {
|
||||
@ -277,19 +277,14 @@ qemudRemoveDomainStatus(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (unlink(file) < 0 && errno != ENOENT && errno != ENOTDIR) {
|
||||
qemudReportError(conn, vm, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to unlink status file %s"), file);
|
||||
goto cleanup;
|
||||
}
|
||||
if (unlink(file) < 0 && errno != ENOENT && errno != ENOTDIR)
|
||||
VIR_WARN(_("Failed to remove domain XML for %s: %s"),
|
||||
vm->def->name, virStrerror(errno, buf, sizeof(ebuf)));
|
||||
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))
|
||||
goto cleanup;
|
||||
|
||||
rc = 0;
|
||||
cleanup:
|
||||
VIR_FREE(file);
|
||||
return rc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -2224,15 +2219,7 @@ retry:
|
||||
vm->def->name);
|
||||
}
|
||||
|
||||
if (qemudRemoveDomainStatus(conn, driver, vm) < 0) {
|
||||
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));
|
||||
}
|
||||
qemudRemoveDomainStatus(conn, driver, vm);
|
||||
|
||||
vm->pid = -1;
|
||||
vm->def->id = -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user