提交 cd951ad2 编写于 作者: O Osier Yang

qemu: Error prompt when saving a shutoff domain

"qemudDomainSaveFlag" goto wrong label "endjob", which will cause
error when security manager trying to restore label (regression).

As it's more reasonable to check if vm is shutoff immediately, and
return right away if it is, remove the checking in "qemudDomainSaveFlag",
and add checking in "qemudDomainSave".

* src/qemu/qemu_driver.c
上级 51ff630f
......@@ -4303,7 +4303,9 @@ endjob:
return ret;
}
/* this internal function expects the driver lock to already be held on entry */
/* This internal function expects the driver lock to already be held on
* entry and the vm must be active.
*/
static int qemudDomainSaveFlag(struct qemud_driver *driver, virDomainPtr dom,
virDomainObjPtr vm, const char *path,
int compressed)
......@@ -4332,12 +4334,6 @@ static int qemudDomainSaveFlag(struct qemud_driver *driver, virDomainPtr dom,
if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
goto cleanup;
if (!virDomainObjIsActive(vm)) {
qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
goto endjob;
}
priv->jobActive = QEMU_JOB_SAVE;
memset(&priv->jobInfo, 0, sizeof(priv->jobInfo));
......@@ -4656,6 +4652,12 @@ static int qemudDomainSave(virDomainPtr dom, const char *path)
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
goto cleanup;
}
ret = qemudDomainSaveFlag(driver, dom, vm, path, compressed);
cleanup:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册