1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-26 03:21:44 +03:00

qemu: fix missing cleanup on error in qemuSaveImageStartVM

Commit 52521de8332c2323bd ("qemu: Use qemuDomainSaveStatus") replaced a call
to virDomainObjSave() with qemuDomainSaveStatus() as a part of cleanup. Since
qemuDomainSaveStatus() does not indicate any failure through its return code,
the error handling cleanup code got eliminated in the process. Thus upon
failure, we will no longer killing the started qemu process. This commit fixes
this by reverting the change that was introduced with the above commit.

Fixes: 52521de8332c2323bd ("qemu: Use qemuDomainSaveStatus")

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Ani Sinha 2021-12-15 18:37:21 +05:30 committed by Jiri Denemark
parent f8915af663
commit 0d5b08e56d

View File

@ -586,6 +586,7 @@ qemuSaveImageStartVM(virConnectPtr conn,
VIR_AUTOCLOSE intermediatefd = -1; VIR_AUTOCLOSE intermediatefd = -1;
g_autoptr(virCommand) cmd = NULL; g_autoptr(virCommand) cmd = NULL;
g_autofree char *errbuf = NULL; g_autofree char *errbuf = NULL;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virQEMUSaveHeader *header = &data->header; virQEMUSaveHeader *header = &data->header;
g_autoptr(qemuDomainSaveCookie) cookie = NULL; g_autoptr(qemuDomainSaveCookie) cookie = NULL;
int rc = 0; int rc = 0;
@ -679,7 +680,10 @@ qemuSaveImageStartVM(virConnectPtr conn,
"%s", _("failed to resume domain")); "%s", _("failed to resume domain"));
goto cleanup; goto cleanup;
} }
qemuDomainSaveStatus(vm); if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) {
VIR_WARN("Failed to save status on vm %s", vm->def->name);
goto cleanup;
}
} else { } else {
int detail = (start_paused ? VIR_DOMAIN_EVENT_SUSPENDED_PAUSED : int detail = (start_paused ? VIR_DOMAIN_EVENT_SUSPENDED_PAUSED :
VIR_DOMAIN_EVENT_SUSPENDED_RESTORED); VIR_DOMAIN_EVENT_SUSPENDED_RESTORED);