Similarly to qemuDomainSaveStatus add a helper to save the config XML named qemuDomainSaveConfig. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_domain.c | 22 ++++++++++++++++++++++ src/qemu/qemu_domain.h | 1 + 2 files changed, 23 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2c0096d2ac..073c9744d3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7219,6 +7219,28 @@ qemuDomainSaveStatus(virDomainObjPtr obj) } +void +qemuDomainSaveConfig(virDomainObjPtr obj) +{ + virQEMUDriverPtr driver = QEMU_DOMAIN_PRIVATE(obj)->driver; + VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = NULL; + virDomainDefPtr def = NULL; + + if (virDomainObjIsActive(obj)) + def = obj->newDef; + else + def = obj->def; + + if (!def) + return; + + cfg = virQEMUDriverGetConfig(driver); + + if (virDomainSaveConfig(cfg->configDir, driver->caps, def) < 0) + VIR_WARN("Failed to save config of vm %s", obj->def->name); +} + + void qemuDomainObjSetJobPhase(virQEMUDriverPtr driver, virDomainObjPtr obj, diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 5853852880..12882d5b91 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -207,6 +207,7 @@ typedef void (*qemuDomainCleanupCallback)(virQEMUDriverPtr driver, #define QEMU_DOMAIN_MASTER_KEY_LEN 32 /* 32 bytes for 256 bit random key */ void qemuDomainSaveStatus(virDomainObjPtr obj); +void qemuDomainSaveConfig(virDomainObjPtr obj); /* helper data types for async device unplug */ -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list