if (qemuProcessStopCPUs(driver, vm, reason, QEMU_ASYNC_JOB_NONE) < 0)
goto endjob;
}
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto endjob;
+ qemuDomainSaveStatus(vm);
ret = 0;
endjob:
goto endjob;
}
}
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto endjob;
+ qemuDomainSaveStatus(vm);
ret = 0;
endjob:
}
def->memballoon->period = period;
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto endjob;
+ qemuDomainSaveStatus(vm);
}
if (persistentDef) {
{
qemuDomainObjPrivate *priv = vm->privateData;
virObjectEvent *event = NULL;
- g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
bool removeInactive = false;
unsigned long flags = VIR_DUMP_MEMORY_ONLY;
virObjectEventStateQueue(driver->domainEventState, event);
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) {
- VIR_WARN("Unable to save status on vm %s after state change",
- vm->def->name);
- }
+ qemuDomainSaveStatus(vm);
if (virDomainLockProcessPause(driver->lockManager, vm, &priv->lockState) < 0)
VIR_WARN("Unable to release lease on %s", vm->def->name);
virDomainObj *vm,
const char *devAlias)
{
- g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virDomainDeviceDef dev;
VIR_DEBUG("Removing device %s from domain %p %s",
goto endjob;
}
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- VIR_WARN("unable to save domain status after removing device %s",
- devAlias);
+ qemuDomainSaveStatus(vm);
endjob:
qemuDomainObjEndJob(driver, vm);
const char *devAlias,
bool connected)
{
- g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virDomainChrDeviceState newstate;
virObjectEvent *event = NULL;
virDomainDeviceDef dev;
dev.data.chr->state = newstate;
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- VIR_WARN("unable to save status of domain %s after updating state of "
- "channel %s", vm->def->name, devAlias);
+ qemuDomainSaveStatus(vm);
if (STREQ_NULLABLE(dev.data.chr->target.name, "org.qemu.guest_agent.0")) {
if (newstate == VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED) {
virDomainDef *def,
int vcpu,
virQEMUDriver *driver,
- virQEMUDriverConfig *cfg,
virBitmap *cpumap)
{
virBitmap *tmpmap = NULL;
vcpuinfo->cpumask = tmpmap;
tmpmap = NULL;
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto cleanup;
+ qemuDomainSaveStatus(vm);
if (g_snprintf(paramField, VIR_TYPED_PARAM_FIELD_LENGTH,
VIR_DOMAIN_TUNABLE_CPU_VCPUPIN, vcpu) < 0) {
}
if (def &&
- qemuDomainPinVcpuLive(vm, def, vcpu, driver, cfg, pcpumap) < 0)
+ qemuDomainPinVcpuLive(vm, def, vcpu, driver, pcpumap) < 0)
goto endjob;
if (persistentDef) {
virBitmapFree(def->cputune.emulatorpin);
def->cputune.emulatorpin = virBitmapNewCopy(pcpumap);
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto endjob;
+ qemuDomainSaveStatus(vm);
str = virBitmapFormat(pcpumap);
if (virTypedParamsAddString(&eventParams, &eventNparams,
if (virProcessSetAffinity(iothrid->thread_id, pcpumap, false) < 0)
goto endjob;
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto endjob;
+ qemuDomainSaveStatus(vm);
if (g_snprintf(paramField, VIR_TYPED_PARAM_FIELD_LENGTH,
VIR_DOMAIN_TUNABLE_CPU_IOTHREADSPIN, iothread_id) < 0) {
}
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto endjob;
+ qemuDomainSaveStatus(vm);
}
if (persistentDef) {
* changed even if we failed to attach the device. For example,
* a new controller may be created.
*/
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- return -1;
+ qemuDomainSaveStatus(vm);
}
/* Finally, if no error until here, we can save config. */
* device we're going to update. */
if ((ret = qemuDomainUpdateDeviceLive(vm, dev_copy, dom, force)) < 0)
goto endjob;
- /*
- * update domain status forcibly because the domain status may be
- * changed even if we failed to attach the device. For example,
- * a new controller may be created.
- */
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) {
- ret = -1;
- goto endjob;
- }
+
+ qemuDomainSaveStatus(vm);
}
/* Finally, if no error until here, we can save config. */
if (rc == 0 && qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)
goto cleanup;
- /*
- * update domain status forcibly because the domain status may be
- * changed even if we failed to attach the device. For example,
- * a new controller may be created.
- */
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto cleanup;
+ qemuDomainSaveStatus(vm);
}
/* Finally, if no error until here, we can save config. */
if (def) {
ret = virDomainCgroupSetupDomainBlkioParameters(priv->cgroup, def,
params, nparams);
-
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto endjob;
+ qemuDomainSaveStatus(vm);
}
if (ret < 0)
goto endjob;
params, nparams) < 0)
goto endjob;
- if (def &&
- virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto endjob;
+ if (def)
+ qemuDomainSaveStatus(vm);
if (persistentDef &&
virDomainDefSave(persistentDef, driver->xmlopt, cfg->configDir) < 0)
-1, mode, nodeset) < 0)
goto endjob;
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto endjob;
+ qemuDomainSaveStatus(vm);
}
if (persistentDef) {
VIR_TRISTATE_BOOL_YES : VIR_TRISTATE_BOOL_NO;
}
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto endjob;
+ qemuDomainSaveStatus(vm);
}
if (persistentDef) {
}
}
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto endjob;
+ qemuDomainSaveStatus(vm);
if (eventNparams) {
event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
goto endjob;
}
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto endjob;
+ qemuDomainSaveStatus(vm);
}
if (persistentNet) {
{
virQEMUDriver *driver = dom->conn->privateData;
virDomainDiskDef *disk = NULL;
- g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
bool pivot = !!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT);
bool async = !!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC);
g_autoptr(qemuBlockJobData) job = NULL;
job->state = QEMU_BLOCKJOB_STATE_ABORTING;
}
- ignore_value(virDomainObjSave(vm, driver->xmlopt, cfg->stateDir));
+ qemuDomainSaveStatus(vm);
if (!async) {
qemuBlockJobUpdate(vm, job, QEMU_ASYNC_JOB_NONE);
qemuDomainSetGroupBlockIoTune(def, &info);
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto endjob;
+ qemuDomainSaveStatus(vm);
if (eventNparams) {
event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
qemuDomainModifyLifecycleAction(def, type, action);
- if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto endjob;
+ qemuDomainSaveStatus(vm);
}
if (persistentDef) {
QEMU_DOMAIN_PRIVATE(vm)->agentTimeout = timeout;
- if (virDomainObjIsActive(vm) &&
- virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
- goto cleanup;
+ qemuDomainSaveStatus(vm);
ret = 0;