On Tue, Jun 19, 2018 at 19:03:24 +0200, Michal Prívozník wrote: > On 06/19/2018 05:05 PM, Jiri Denemark wrote: > > On Tue, Jun 19, 2018 at 08:38:02 +0200, Michal Privoznik wrote: > >> There are two sets of functions here: > >> 1) some functions talk on both monitor and agent monitor, > >> 2) some functions only talk on agent monitor. > >> > >> For functions from set 1) we need to use > >> qemuDomainObjBeginJobWithAgent() and for functions from set 2) we > >> need to use qemuDomainObjBeginAgentJob() only. > >> > >> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> > >> --- > >> src/qemu/qemu_driver.c | 91 ++++++++++++++++++++++++++++++++------------------ > >> 1 file changed, 58 insertions(+), 33 deletions(-) > >> > >> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c > >> index 3abbe41895..cffd4c928a 100644 > >> --- a/src/qemu/qemu_driver.c > >> +++ b/src/qemu/qemu_driver.c ... > >> @@ -4949,6 +4967,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, > >> virDomainDefPtr def; > >> virDomainDefPtr persistentDef; > >> bool hotpluggable = !!(flags & VIR_DOMAIN_VCPU_HOTPLUGGABLE); > >> + bool useAgent = !!(flags & VIR_DOMAIN_VCPU_GUEST); > >> int ret = -1; > >> > >> virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | > >> @@ -4963,13 +4982,14 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, > >> if (virDomainSetVcpusFlagsEnsureACL(dom->conn, vm->def, flags) < 0) > >> goto cleanup; > >> > >> - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) > >> + if ((!useAgent && qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) || > >> + (useAgent && qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_MODIFY) < 0)) > >> goto cleanup; > > > > And here. > > Actually no. This one is different to the previous two places. This one > is either grab domain job OR agent job but not both at the same time > (which is what previous places do). Ah right, I misread qemuDomainObjBeginAgentJob as qemuDomainObjBeginJobWithAgent. In this case, I'd just modify the code a bit to make it clearer the two cases are mutually exclusive, e.g.: int rc; if (useAgent) rc = qemuDomainObjBeginAgentJob(); else rc = qemuDomainObjBeginJob(); if (rc < 0) goto cleanup; Jirka -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list