if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup;
+ if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
+ goto cleanup;
+
if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, vm, &flags,
&persistentDef) < 0)
- goto cleanup;
+ goto endjob;
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
net = virDomainNetFind(vm->def, device);
if (!net) {
virReportError(VIR_ERR_INVALID_ARG,
_("Can't find device %s"), device);
- goto cleanup;
+ goto endjob;
}
}
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
if (!persistentNet) {
virReportError(VIR_ERR_INVALID_ARG,
_("Can't find device %s"), device);
- goto cleanup;
+ goto endjob;
}
}
if ((VIR_ALLOC(bandwidth) < 0) ||
(VIR_ALLOC(bandwidth->in) < 0) ||
(VIR_ALLOC(bandwidth->out) < 0))
- goto cleanup;
+ goto endjob;
for (i = 0; i < nparams; i++) {
virTypedParameterPtr param = ¶ms[i];
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (VIR_ALLOC(newBandwidth) < 0)
- goto cleanup;
+ goto endjob;
/* virNetDevBandwidthSet() will clear any previous value of
* bandwidth parameters, so merge with old bandwidth parameters
if (bandwidth->in ||
(!inboundSpecified && net->bandwidth && net->bandwidth->in)) {
if (VIR_ALLOC(newBandwidth->in) < 0)
- goto cleanup;
+ goto endjob;
memcpy(newBandwidth->in,
bandwidth->in ? bandwidth->in : net->bandwidth->in,
if (bandwidth->out ||
(!outboundSpecified && net->bandwidth && net->bandwidth->out)) {
if (VIR_ALLOC(newBandwidth->out) < 0)
- goto cleanup;
+ goto endjob;
memcpy(newBandwidth->out,
bandwidth->out ? bandwidth->out : net->bandwidth->out,
}
if (virNetDevBandwidthSet(net->ifname, newBandwidth, false) < 0)
- goto cleanup;
+ goto endjob;
virNetDevBandwidthFree(net->bandwidth);
if (newBandwidth->in || newBandwidth->out) {
virNetDevBandwidthFree(net->data.network.actual->bandwidth);
if (virNetDevBandwidthCopy(&net->data.network.actual->bandwidth,
net->bandwidth) < 0)
- goto cleanup;
+ goto endjob;
}
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
- goto cleanup;
+ goto endjob;
}
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
}
if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0)
- goto cleanup;
+ goto endjob;
}
ret = 0;
+
+ endjob:
+ if (!qemuDomainObjEndJob(driver, vm))
+ vm = NULL;
+
cleanup:
virNetDevBandwidthFree(bandwidth);
virNetDevBandwidthFree(newBandwidth);