The virDomainObjFormat and virDomainSaveStatus methods both call into virDomainDefFormat, so should be providing a non-NULL virCapsPtr instance. Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> --- src/bhyve/bhyve_process.c | 15 +++++++++++-- src/conf/domain_conf.c | 10 +++++---- src/conf/domain_conf.h | 4 +++- src/libxl/libxl_domain.c | 2 +- src/libxl/libxl_driver.c | 14 ++++++------ src/libxl/libxl_migration.c | 4 ++-- src/lxc/lxc_driver.c | 12 +++++------ src/lxc/lxc_process.c | 4 ++-- src/qemu/qemu_blockjob.c | 2 +- src/qemu/qemu_domain.c | 4 ++-- src/qemu/qemu_driver.c | 52 ++++++++++++++++++++++----------------------- src/qemu/qemu_migration.c | 6 +++--- src/qemu/qemu_process.c | 36 +++++++++++++++---------------- 13 files changed, 90 insertions(+), 75 deletions(-) diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 42255d2..9763d71 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -115,11 +115,15 @@ virBhyveProcessStart(virConnectPtr conn, bhyveConnPtr privconn = conn->privateData; bhyveDomainObjPrivatePtr priv = vm->privateData; int ret = -1, rc; + virCapsPtr caps = NULL; if (virAsprintf(&logfile, "%s/%s.log", BHYVE_LOG_DIR, vm->def->name) < 0) return -1; + caps = bhyveDriverGetCapabilities(privconn); + if (!caps) + goto cleanup; if ((logfd = open(logfile, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR)) < 0) { @@ -215,12 +219,13 @@ virBhyveProcessStart(virConnectPtr conn, if (virDomainSaveStatus(driver->xmlopt, BHYVE_STATE_DIR, - vm) < 0) + vm, caps) < 0) goto cleanup; ret = 0; cleanup: + virObjectUnref(caps); if (devicemap != NULL) { rc = unlink(devmap_file); if (rc < 0 && errno != ENOENT) @@ -362,6 +367,7 @@ virBhyveProcessReconnect(virDomainObjPtr vm, char *expected_proctitle = NULL; bhyveDomainObjPrivatePtr priv = vm->privateData; int ret = -1; + virCapsPtr caps = NULL; if (!virDomainObjIsActive(vm)) return 0; @@ -369,6 +375,10 @@ virBhyveProcessReconnect(virDomainObjPtr vm, if (!vm->pid) return 0; + caps = bhyveDriverGetCapabilities(privconn); + if (!caps) + return -1; + virObjectLock(vm); kp = kvm_getprocs(data->kd, KERN_PROC_PID, vm->pid, &nprocs); @@ -397,9 +407,10 @@ virBhyveProcessReconnect(virDomainObjPtr vm, VIR_DOMAIN_SHUTOFF_UNKNOWN); ignore_value(virDomainSaveStatus(data->driver->xmlopt, BHYVE_STATE_DIR, - vm)); + vm, caps)); } + virObjectUnref(caps); virObjectUnlock(vm); VIR_FREE(expected_proctitle); diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 035e5e1..187495c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -22516,6 +22516,7 @@ virDomainDefFormat(virDomainDefPtr def, virCapsPtr caps, unsigned int flags) char * virDomainObjFormat(virDomainXMLOptionPtr xmlopt, virDomainObjPtr obj, + virCapsPtr caps, unsigned int flags) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -22540,7 +22541,7 @@ virDomainObjFormat(virDomainXMLOptionPtr xmlopt, xmlopt->privateData.format(&buf, obj) < 0) goto error; - if (virDomainDefFormatInternal(obj->def, NULL, flags, &buf) < 0) + if (virDomainDefFormatInternal(obj->def, caps, flags, &buf) < 0) goto error; virBufferAdjustIndent(&buf, -2); @@ -22746,7 +22747,8 @@ virDomainSaveConfig(const char *configDir, int virDomainSaveStatus(virDomainXMLOptionPtr xmlopt, const char *statusDir, - virDomainObjPtr obj) + virDomainObjPtr obj, + virCapsPtr caps) { unsigned int flags = (VIR_DOMAIN_DEF_FORMAT_SECURE | VIR_DOMAIN_DEF_FORMAT_STATUS | @@ -22757,7 +22759,7 @@ virDomainSaveStatus(virDomainXMLOptionPtr xmlopt, int ret = -1; char *xml; - if (!(xml = virDomainObjFormat(xmlopt, obj, flags))) + if (!(xml = virDomainObjFormat(xmlopt, obj, caps, flags))) goto cleanup; if (virDomainSaveXML(statusDir, obj->def, xml)) @@ -23906,7 +23908,7 @@ virDomainObjSetMetadata(virDomainObjPtr vm, if (virDomainDefSetMetadata(vm->def, type, metadata, key, uri) < 0) return -1; - if (virDomainSaveStatus(xmlopt, stateDir, vm) < 0) + if (virDomainSaveStatus(xmlopt, stateDir, vm, caps) < 0) return -1; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 8843cbd..79060bc 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2738,6 +2738,7 @@ char *virDomainDefFormat(virDomainDefPtr def, unsigned int flags); char *virDomainObjFormat(virDomainXMLOptionPtr xmlopt, virDomainObjPtr obj, + virCapsPtr caps, unsigned int flags); int virDomainDefFormatInternal(virDomainDefPtr def, virCapsPtr caps, @@ -2912,7 +2913,8 @@ int virDomainSaveConfig(const char *configDir, virDomainDefPtr def); int virDomainSaveStatus(virDomainXMLOptionPtr xmlopt, const char *statusDir, - virDomainObjPtr obj) ATTRIBUTE_RETURN_CHECK; + virDomainObjPtr obj, + virCapsPtr caps) ATTRIBUTE_RETURN_CHECK; typedef void (*virDomainLoadConfigNotify)(virDomainObjPtr dom, int newDomain, diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index cf27ec4..1133c8b 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -1086,7 +1086,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm, virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER); } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0) goto cleanup_dom; if (virAtomicIntInc(&driver->nactive) == 1 && driver->inhibitCallback) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index d2114ca..2a6c2de 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -1139,7 +1139,7 @@ libxlDomainSuspend(virDomainPtr dom) VIR_DOMAIN_EVENT_SUSPENDED_PAUSED); } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0) goto endjob; ret = 0; @@ -1198,7 +1198,7 @@ libxlDomainResume(virDomainPtr dom) VIR_DOMAIN_EVENT_RESUMED_UNPAUSED); } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0) goto endjob; ret = 0; @@ -2231,7 +2231,7 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, ret = 0; if (flags & VIR_DOMAIN_VCPU_LIVE) { - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0) { VIR_WARN("Unable to save status on vm %s after changing vcpus", vm->def->name); } @@ -2392,7 +2392,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu, ret = 0; if (flags & VIR_DOMAIN_AFFECT_LIVE) { - ret = virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm); + ret = virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps); } else if (flags & VIR_DOMAIN_AFFECT_CONFIG) { ret = virDomainSaveConfig(cfg->configDir, cfg->caps, targetDef); } @@ -3742,7 +3742,7 @@ libxlDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, * update domain status forcibly because the domain status may be * changed even if we attach the device failed. */ - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0) goto endjob; } @@ -3850,7 +3850,7 @@ libxlDomainDetachDeviceFlags(virDomainPtr dom, const char *xml, * update domain status forcibly because the domain status may be * changed even if we attach the device failed. */ - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0) goto endjob; } @@ -3957,7 +3957,7 @@ libxlDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml, * update domain status forcibly because the domain status may be * changed even if we attach the device failed. */ - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0) ret = -1; } diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c index 93eaa87..641bd4e 100644 --- a/src/libxl/libxl_migration.c +++ b/src/libxl/libxl_migration.c @@ -564,7 +564,7 @@ libxlDomainMigrationFinish(virConnectPtr dconn, event = NULL; } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0) goto cleanup; dom = virGetDomain(dconn, vm->def->name, vm->def->uuid); @@ -607,7 +607,7 @@ libxlDomainMigrationConfirm(libxlDriverPrivatePtr driver, VIR_DOMAIN_PAUSED_MIGRATION); event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED); - ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm)); + ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps)); } goto cleanup; } diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 58c9bb4..b3399d9 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -765,7 +765,7 @@ static int lxcDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, } vm->def->mem.cur_balloon = newmem; - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto cleanup; } @@ -2022,7 +2022,7 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom, } } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto cleanup; @@ -3402,7 +3402,7 @@ static int lxcDomainSuspend(virDomainPtr dom) VIR_DOMAIN_EVENT_SUSPENDED_PAUSED); } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto cleanup; ret = 0; @@ -3452,7 +3452,7 @@ static int lxcDomainResume(virDomainPtr dom) VIR_DOMAIN_EVENT_RESUMED_UNPAUSED); } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto cleanup; ret = 0; @@ -5075,7 +5075,7 @@ static int lxcDomainAttachDeviceFlags(virDomainPtr dom, * changed even if we failed to attach the device. For example, * a new controller may be created. */ - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { ret = -1; goto cleanup; } @@ -5317,7 +5317,7 @@ static int lxcDomainDetachDeviceFlags(virDomainPtr dom, * changed even if we failed to attach the device. For example, * a new controller may be created. */ - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { ret = -1; goto cleanup; } diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 3ee3b13..2ece14b 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -767,7 +767,7 @@ static void virLXCProcessMonitorInitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED } virDomainAuditInit(vm, initpid, inode); - if (virDomainSaveStatus(lxc_driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(lxc_driver->xmlopt, cfg->stateDir, vm, lxc_driver->caps) < 0) VIR_WARN("Cannot update XML with PID for LXC %s", vm->def->name); virObjectUnlock(vm); @@ -1469,7 +1469,7 @@ int virLXCProcessStart(virConnectPtr conn, /* Write domain status to disk for the controller to * read when it starts */ - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto cleanup; /* Allow the child to exec the controller */ diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index f14e70b..83a5a3f 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -185,7 +185,7 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver, } if (save) { - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) VIR_WARN("Unable to save status on vm %s after block job", vm->def->name); if (persistDisk && virDomainSaveConfig(cfg->configDir, diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a70b866..9d08f4f 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1489,7 +1489,7 @@ qemuDomainObjSaveJob(virQEMUDriverPtr driver, virDomainObjPtr obj) virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); if (virDomainObjIsActive(obj)) { - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, obj) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, obj, driver->caps) < 0) VIR_WARN("Failed to save status on vm %s", obj->def->name); } @@ -2905,7 +2905,7 @@ qemuDomainSetFakeReboot(virQEMUDriverPtr driver, priv->fakeReboot = value; - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) VIR_WARN("Failed to save status on vm %s", vm->def->name); cleanup: diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d623831..9f38ce2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1932,7 +1932,7 @@ static int qemuDomainSuspend(virDomainPtr dom) eventDetail); } } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto endjob; ret = 0; @@ -1995,7 +1995,7 @@ static int qemuDomainResume(virDomainPtr dom) VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_RESUMED_UNPAUSED); } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto endjob; ret = 0; @@ -2549,7 +2549,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, } def->memballoon->period = period; - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto endjob; } @@ -4143,7 +4143,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver, } cleanup: - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { VIR_WARN("Unable to save status on vm %s after state change", vm->def->name); } @@ -4177,7 +4177,7 @@ processDeviceDeletedEvent(virQEMUDriverPtr driver, if (qemuDomainRemoveDevice(driver, vm, &dev) < 0) goto endjob; - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) VIR_WARN("unable to save domain status after removing device %s", devAlias); @@ -4545,7 +4545,7 @@ processSerialChangedEvent(virQEMUDriverPtr driver, dev.data.chr->state = newstate; - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) VIR_WARN("unable to save status of domain %s after updating state of " "channel %s", vm->def->name, devAlias); @@ -5084,7 +5084,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, } } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto endjob; } @@ -5263,7 +5263,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom, def->cputune.nvcpupin = newVcpuPinNum; newVcpuPin = NULL; - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto endjob; if (snprintf(paramField, VIR_TYPED_PARAM_FIELD_LENGTH, @@ -5480,7 +5480,7 @@ qemuDomainPinEmulator(virDomainPtr dom, if (!(def->cputune.emulatorpin = virBitmapNewCopy(pcpumap))) goto endjob; - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto endjob; str = virBitmapFormat(pcpumap); @@ -5967,7 +5967,7 @@ qemuDomainPinIOThread(virDomainPtr dom, } } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto endjob; if (snprintf(paramField, VIR_TYPED_PARAM_FIELD_LENGTH, @@ -6277,7 +6277,7 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver, goto endjob; } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto endjob; } @@ -6835,7 +6835,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, "%s", _("failed to resume domain")); goto cleanup; } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { VIR_WARN("Failed to save status on vm %s", vm->def->name); goto cleanup; } @@ -8610,7 +8610,7 @@ static int qemuDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, * changed even if we failed to attach the device. For example, * a new controller may be created. */ - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { ret = -1; goto endjob; } @@ -8736,7 +8736,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, * changed even if we failed to attach the device. For example, * a new controller may be created. */ - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { ret = -1; goto endjob; } @@ -8856,7 +8856,7 @@ static int qemuDomainDetachDeviceFlags(virDomainPtr dom, const char *xml, * changed even if we failed to attach the device. For example, * a new controller may be created. */ - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { ret = -1; goto endjob; } @@ -9387,7 +9387,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, } } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto endjob; } if (ret < 0) @@ -9975,7 +9975,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, #undef QEMU_SET_MEM_PARAMETER if (flags & VIR_DOMAIN_AFFECT_LIVE && - virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto endjob; if (flags & VIR_DOMAIN_AFFECT_CONFIG && @@ -10244,7 +10244,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom, -1, mode, nodeset) < 0) goto endjob; - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto endjob; } @@ -10607,7 +10607,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom, } } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto endjob; if (eventNparams) { @@ -11389,7 +11389,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, goto endjob; } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto endjob; } @@ -14521,7 +14521,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, } if (ret == 0 || !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) { - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0 || + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0 || (persist && virDomainSaveConfig(cfg->configDir, driver->caps, vm->newDef) < 0)) ret = -1; @@ -16527,7 +16527,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom, * effort to save it now. But we can ignore failure, since there * will be further changes when the event marks completion. */ if (save) - ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm)); + ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps)); /* With synchronous block cancel, we must synthesize an event, and * we silently ignore the ABORT_ASYNC flag. With asynchronous @@ -16649,7 +16649,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_READY; - ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm)); + ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps)); virObjectUnref(cfg); } endjob: @@ -16902,7 +16902,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_COPY; QEMU_DOMAIN_DISK_PRIVATE(disk)->blockjob = true; - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) VIR_WARN("Unable to save status on vm %s after state change", vm->def->name); @@ -17301,7 +17301,7 @@ qemuDomainBlockCommit(virDomainPtr dom, virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); mirror = NULL; - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) VIR_WARN("Unable to save status on vm %s after block job", vm->def->name); virObjectUnref(cfg); @@ -17789,7 +17789,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, goto endjob; vm->def->disks[idx]->blkdeviotune = info; - ret = virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm); + ret = virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps); if (ret < 0) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("Saving live XML config failed")); diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 2f5b368..b98757d 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2128,7 +2128,7 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver, } diskPriv->migrating = true; - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { VIR_WARN("Failed to save status on vm %s", vm->def->name); goto cleanup; } @@ -4012,7 +4012,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver, VIR_DOMAIN_EVENT_RESUMED_MIGRATED); } - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) VIR_WARN("Failed to save status on vm %s", vm->def->name); } @@ -5954,7 +5954,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver, } if (virDomainObjIsActive(vm) && - virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) VIR_WARN("Failed to save status on vm %s", vm->def->name); /* Guest is successfully running, so cancel previous auto destroy */ diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 58f8f4f..8ed6c3a 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -504,7 +504,7 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED, if (priv->agent) qemuAgentNotifyEvent(priv->agent, QEMU_AGENT_EVENT_RESET); - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) VIR_WARN("Failed to save status on vm %s", vm->def->name); virObjectUnlock(vm); @@ -571,7 +571,7 @@ qemuProcessFakeReboot(void *opaque) VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_RESUMED_UNPAUSED); - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { VIR_WARN("Unable to save status on vm %s after state change", vm->def->name); } @@ -675,7 +675,7 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED, VIR_DOMAIN_EVENT_SHUTDOWN, VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED); - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { VIR_WARN("Unable to save status on vm %s after state change", vm->def->name); } @@ -728,7 +728,7 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED, VIR_WARN("Unable to release lease on %s", vm->def->name); VIR_DEBUG("Preserving lock state '%s'", NULLSTR(priv->lockState)); - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { VIR_WARN("Unable to save status on vm %s after state change", vm->def->name); } @@ -781,7 +781,7 @@ qemuProcessHandleResume(qemuMonitorPtr mon ATTRIBUTE_UNUSED, } VIR_FREE(priv->lockState); - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { VIR_WARN("Unable to save status on vm %s after state change", vm->def->name); } @@ -825,7 +825,7 @@ qemuProcessHandleRTCChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED, offset += vm->def->clock.data.variable.adjustment0; vm->def->clock.data.variable.adjustment = offset; - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) VIR_WARN("unable to save domain status with RTC change"); } @@ -868,7 +868,7 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon ATTRIBUTE_UNUSED, VIR_WARN("Unable to release lease on %s", vm->def->name); VIR_DEBUG("Preserving lock state '%s'", NULLSTR(priv->lockState)); - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { VIR_WARN("Unable to save status on vm %s after watchdog event", vm->def->name); } @@ -951,7 +951,7 @@ qemuProcessHandleIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED, VIR_WARN("Unable to release lease on %s", vm->def->name); VIR_DEBUG("Preserving lock state '%s'", NULLSTR(priv->lockState)); - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) VIR_WARN("Unable to save status on vm %s after IO error", vm->def->name); } virObjectUnlock(vm); @@ -1133,7 +1133,7 @@ qemuProcessHandleTrayChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED, else if (reason == VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE) disk->tray_status = VIR_DOMAIN_DISK_TRAY_CLOSED; - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { VIR_WARN("Unable to save status on vm %s after tray moved event", vm->def->name); } @@ -1173,7 +1173,7 @@ qemuProcessHandlePMWakeup(qemuMonitorPtr mon ATTRIBUTE_UNUSED, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_WAKEUP); - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { VIR_WARN("Unable to save status on vm %s after wakeup event", vm->def->name); } @@ -1211,7 +1211,7 @@ qemuProcessHandlePMSuspend(qemuMonitorPtr mon ATTRIBUTE_UNUSED, VIR_DOMAIN_EVENT_PMSUSPENDED, VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY); - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { VIR_WARN("Unable to save status on vm %s after suspend event", vm->def->name); } @@ -1245,7 +1245,7 @@ qemuProcessHandleBalloonChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED, vm->def->mem.cur_balloon, actual); vm->def->mem.cur_balloon = actual; - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) VIR_WARN("unable to save domain status with balloon change"); virObjectUnlock(vm); @@ -1280,7 +1280,7 @@ qemuProcessHandlePMSuspendDisk(qemuMonitorPtr mon ATTRIBUTE_UNUSED, VIR_DOMAIN_EVENT_PMSUSPENDED, VIR_DOMAIN_EVENT_PMSUSPENDED_DISK); - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { VIR_WARN("Unable to save status on vm %s after suspend event", vm->def->name); } @@ -2901,7 +2901,7 @@ qemuProcessUpdateVideoRamSize(virQEMUDriverPtr driver, return -1; cfg = virQEMUDriverGetConfig(driver); - ret = virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm); + ret = virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps); virObjectUnref(cfg); return ret; @@ -3605,7 +3605,7 @@ qemuProcessReconnect(void *opaque) goto error; /* update domain state XML with possibly updated state in virDomainObj */ - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, obj) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, obj, driver->caps) < 0) goto error; /* Run an hook to allow admins to do some magic */ @@ -4854,7 +4854,7 @@ qemuProcessLaunch(virConnectPtr conn, } VIR_DEBUG("Writing early domain status to disk"); - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto cleanup; VIR_DEBUG("Waiting for handshake from child"); @@ -5066,7 +5066,7 @@ qemuProcessFinishStartup(virConnectPtr conn, } VIR_DEBUG("Writing domain status to disk"); - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto cleanup; if (qemuProcessStartHook(driver, vm, @@ -5699,7 +5699,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, } VIR_DEBUG("Writing domain status to disk"); - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) goto error; /* Run an hook to allow admins to do some magic */ -- 2.5.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list