check domain's status before call virQEMUCapsGet to report a accurate
error when domain is shut off
Resolve:
https://bugzilla.redhat.com/show_bug.cgi?id=1147847
Signed-off-by: Shanzhi Yu <shyu(a)redhat.com>
---
src/qemu/qemu_driver.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e873d45..da492d7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17360,13 +17360,6 @@ qemuDomainSetTime(virDomainPtr dom,
priv = vm->privateData;
- if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_RTC_RESET_REINJECTION)) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
- _("cannot set time: qemu doesn't support "
- "rtc-reset-reinjection command"));
- goto cleanup;
- }
-
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup;
@@ -17376,6 +17369,13 @@ qemuDomainSetTime(virDomainPtr dom,
goto endjob;
}
+ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_RTC_RESET_REINJECTION)) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("cannot set time: qemu doesn't support "
+ "rtc-reset-reinjection command"));
+ goto endjob;
+ }
+
if (!qemuDomainAgentAvailable(priv, true))
goto endjob;
--
1.9.3