|
|
9119d9 |
From 62a0658c8081f1b42b532265379404803d979d0a Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <62a0658c8081f1b42b532265379404803d979d0a@dist-git>
|
|
|
9119d9 |
From: Shanzhi Yu <shyu@redhat.com>
|
|
|
9119d9 |
Date: Wed, 22 Oct 2014 09:54:37 +0200
|
|
|
9119d9 |
Subject: [PATCH] qemu: call qemuDomainObjBeginJob/qemuDomainObjEndJob in
|
|
|
9119d9 |
qemuDomainSetInterfaceParameters
|
|
|
9119d9 |
|
|
|
9119d9 |
add call qemuDomainObjBeginJob/qemuDomainObjEndJob in
|
|
|
9119d9 |
qemuDomainSetInterfaceParameters
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Shanzhi Yu <shyu@redhat.com>
|
|
|
9119d9 |
(cherry picked from commit 99fe8755b919a4df9e48b6994da4c0c2907dfc83)
|
|
|
9119d9 |
|
|
|
9119d9 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1146511
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/qemu/qemu_driver.c | 30 +++++++++++++++++++-----------
|
|
|
9119d9 |
1 file changed, 19 insertions(+), 11 deletions(-)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
index 12a32ec..90f81a0 100644
|
|
|
9119d9 |
--- a/src/qemu/qemu_driver.c
|
|
|
9119d9 |
+++ b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
@@ -10140,16 +10140,19 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
|
|
|
9119d9 |
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
|
|
|
9119d9 |
goto cleanup;
|
|
|
9119d9 |
|
|
|
9119d9 |
+ if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
|
|
9119d9 |
+ goto cleanup;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, vm, &flags,
|
|
|
9119d9 |
&persistentDef) < 0)
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
+ goto endjob;
|
|
|
9119d9 |
|
|
|
9119d9 |
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
|
|
9119d9 |
net = virDomainNetFind(vm->def, device);
|
|
|
9119d9 |
if (!net) {
|
|
|
9119d9 |
virReportError(VIR_ERR_INVALID_ARG,
|
|
|
9119d9 |
_("Can't find device %s"), device);
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
+ goto endjob;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
}
|
|
|
9119d9 |
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
|
|
9119d9 |
@@ -10157,14 +10160,14 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
|
|
|
9119d9 |
if (!persistentNet) {
|
|
|
9119d9 |
virReportError(VIR_ERR_INVALID_ARG,
|
|
|
9119d9 |
_("Can't find device %s"), device);
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
+ goto endjob;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
if ((VIR_ALLOC(bandwidth) < 0) ||
|
|
|
9119d9 |
(VIR_ALLOC(bandwidth->in) < 0) ||
|
|
|
9119d9 |
(VIR_ALLOC(bandwidth->out) < 0))
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
+ goto endjob;
|
|
|
9119d9 |
|
|
|
9119d9 |
for (i = 0; i < nparams; i++) {
|
|
|
9119d9 |
virTypedParameterPtr param = ¶ms[i];
|
|
|
9119d9 |
@@ -10198,7 +10201,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
|
|
|
9119d9 |
|
|
|
9119d9 |
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
|
|
9119d9 |
if (VIR_ALLOC(newBandwidth) < 0)
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
+ goto endjob;
|
|
|
9119d9 |
|
|
|
9119d9 |
/* virNetDevBandwidthSet() will clear any previous value of
|
|
|
9119d9 |
* bandwidth parameters, so merge with old bandwidth parameters
|
|
|
9119d9 |
@@ -10206,7 +10209,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
|
|
|
9119d9 |
if (bandwidth->in ||
|
|
|
9119d9 |
(!inboundSpecified && net->bandwidth && net->bandwidth->in)) {
|
|
|
9119d9 |
if (VIR_ALLOC(newBandwidth->in) < 0)
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
+ goto endjob;
|
|
|
9119d9 |
|
|
|
9119d9 |
memcpy(newBandwidth->in,
|
|
|
9119d9 |
bandwidth->in ? bandwidth->in : net->bandwidth->in,
|
|
|
9119d9 |
@@ -10215,7 +10218,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
|
|
|
9119d9 |
if (bandwidth->out ||
|
|
|
9119d9 |
(!outboundSpecified && net->bandwidth && net->bandwidth->out)) {
|
|
|
9119d9 |
if (VIR_ALLOC(newBandwidth->out) < 0)
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
+ goto endjob;
|
|
|
9119d9 |
|
|
|
9119d9 |
memcpy(newBandwidth->out,
|
|
|
9119d9 |
bandwidth->out ? bandwidth->out : net->bandwidth->out,
|
|
|
9119d9 |
@@ -10223,7 +10226,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
if (virNetDevBandwidthSet(net->ifname, newBandwidth, false) < 0)
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
+ goto endjob;
|
|
|
9119d9 |
|
|
|
9119d9 |
virNetDevBandwidthFree(net->bandwidth);
|
|
|
9119d9 |
if (newBandwidth->in || newBandwidth->out) {
|
|
|
9119d9 |
@@ -10237,11 +10240,11 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
|
|
|
9119d9 |
virNetDevBandwidthFree(net->data.network.actual->bandwidth);
|
|
|
9119d9 |
if (virNetDevBandwidthCopy(&net->data.network.actual->bandwidth,
|
|
|
9119d9 |
net->bandwidth) < 0)
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
+ goto endjob;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
+ goto endjob;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
|
|
9119d9 |
@@ -10266,10 +10269,15 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0)
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
+ goto endjob;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
ret = 0;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ endjob:
|
|
|
9119d9 |
+ if (!qemuDomainObjEndJob(driver, vm))
|
|
|
9119d9 |
+ vm = NULL;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
cleanup:
|
|
|
9119d9 |
virNetDevBandwidthFree(bandwidth);
|
|
|
9119d9 |
virNetDevBandwidthFree(newBandwidth);
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.1.3
|
|
|
9119d9 |
|