qemu: Improve domainSetTime error info report

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@redhat.com>
This commit is contained in:
Shanzhi Yu 2014-09-30 21:36:23 +08:00 committed by Michal Privoznik
parent b4022de33a
commit a4771c5860

View File

@ -17377,13 +17377,6 @@ qemuDomainSetTime(virDomainPtr dom,
priv = vm->privateData; 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) if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup; goto cleanup;
@ -17393,6 +17386,13 @@ qemuDomainSetTime(virDomainPtr dom,
goto endjob; 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)) if (!qemuDomainAgentAvailable(priv, true))
goto endjob; goto endjob;