From cd951ad2ec00f4a6a6f237d85eb0ee7e90207749 Mon Sep 17 00:00:00 2001 From: Osier Yang Date: Thu, 17 Feb 2011 11:18:47 +0800 Subject: [PATCH] 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 --- src/qemu/qemu_driver.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 82a2210963..ab664a046c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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: