From fbb94044eabf1853af605314da96b533f7c3d44e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 27 Feb 2015 14:06:47 +0100 Subject: [PATCH] Pass virDomainObjPtr to qemuDomainAgentAvailable Not just the DomainObj's private data. --- src/qemu/qemu_domain.c | 4 +++- src/qemu/qemu_domain.h | 2 +- src/qemu/qemu_driver.c | 24 ++++++++++++------------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2ab9f3b5e5..551a897216 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2804,9 +2804,11 @@ qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, } bool -qemuDomainAgentAvailable(qemuDomainObjPrivatePtr priv, +qemuDomainAgentAvailable(virDomainObjPtr vm, bool reportError) { + qemuDomainObjPrivatePtr priv = vm->privateData; + if (priv->agentError) { if (reportError) { virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s", diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index b2c38815ba..fe3e2b1e23 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -395,7 +395,7 @@ bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, virDomainDefPtr src, virDomainDefPtr dst); -bool qemuDomainAgentAvailable(qemuDomainObjPrivatePtr priv, +bool qemuDomainAgentAvailable(virDomainObjPtr vm, bool reportError); int qemuDomainJobInfoUpdateTime(qemuDomainJobInfoPtr jobInfo) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 76dd7a8d06..83a4e18ae6 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1943,7 +1943,7 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags) goto cleanup; agentForced = agentRequested && !acpiRequested; - if (!qemuDomainAgentAvailable(priv, agentForced)) { + if (!qemuDomainAgentAvailable(vm, agentForced)) { if (agentForced) goto endjob; useAgent = false; @@ -2058,7 +2058,7 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags) if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) goto cleanup; - if (useAgent && !qemuDomainAgentAvailable(priv, true)) + if (useAgent && !qemuDomainAgentAvailable(vm, true)) goto endjob; if (!virDomainObjIsActive(vm)) { @@ -4766,7 +4766,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, goto endjob; } - if (!qemuDomainAgentAvailable(priv, true)) + if (!qemuDomainAgentAvailable(vm, true)) goto endjob; if (nvcpus > vm->def->vcpus) { @@ -5490,7 +5490,7 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) goto cleanup; - if (!qemuDomainAgentAvailable(priv, true)) + if (!qemuDomainAgentAvailable(vm, true)) goto endjob; if (!virDomainObjIsActive(vm)) { @@ -12893,7 +12893,7 @@ qemuDomainSnapshotFSFreeze(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, qemuDomainObjPrivatePtr priv = vm->privateData; int frozen; - if (!qemuDomainAgentAvailable(priv, true)) + if (!qemuDomainAgentAvailable(vm, true)) return -1; qemuDomainObjEnterAgent(vm); @@ -12913,7 +12913,7 @@ qemuDomainSnapshotFSThaw(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, int thawed; virErrorPtr err = NULL; - if (!qemuDomainAgentAvailable(priv, report)) + if (!qemuDomainAgentAvailable(vm, report)) return -1; qemuDomainObjEnterAgent(vm); @@ -17615,7 +17615,7 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) goto cleanup; - if (!qemuDomainAgentAvailable(priv, true)) + if (!qemuDomainAgentAvailable(vm, true)) goto endjob; if (!virDomainObjIsActive(vm)) { @@ -17735,7 +17735,7 @@ qemuDomainQemuAgentCommand(virDomainPtr domain, if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) goto cleanup; - if (!qemuDomainAgentAvailable(priv, true)) + if (!qemuDomainAgentAvailable(vm, true)) goto endjob; if (!virDomainObjIsActive(vm)) { @@ -17844,7 +17844,7 @@ qemuDomainFSTrim(virDomainPtr dom, if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) goto cleanup; - if (!qemuDomainAgentAvailable(priv, true)) + if (!qemuDomainAgentAvailable(vm, true)) goto endjob; if (!virDomainObjIsActive(vm)) { @@ -18028,7 +18028,7 @@ qemuDomainGetTime(virDomainPtr dom, goto endjob; } - if (!qemuDomainAgentAvailable(priv, true)) + if (!qemuDomainAgentAvailable(vm, true)) goto endjob; qemuDomainObjEnterAgent(vm); @@ -18087,7 +18087,7 @@ qemuDomainSetTime(virDomainPtr dom, goto endjob; } - if (!qemuDomainAgentAvailable(priv, true)) + if (!qemuDomainAgentAvailable(vm, true)) goto endjob; qemuDomainObjEnterAgent(vm); @@ -19064,7 +19064,7 @@ qemuDomainGetFSInfo(virDomainPtr dom, goto endjob; } - if (!qemuDomainAgentAvailable(priv, true)) + if (!qemuDomainAgentAvailable(vm, true)) goto endjob; qemuDomainObjEnterAgent(vm);