mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 13:05:27 +00:00
metadata: track title edits across libvirtd restart
https://bugzilla.redhat.com/show_bug.cgi?id=1122205 Although the edits were changing in-memory XML, it was not flushed to disk; so unless some other action changes XML, a libvirtd restart would lose the changed information. * src/conf/domain_conf.c (virDomainObjSetMetadata): Add parameter, to save live status across restarts. (virDomainSaveXML): Allow for test driver. * src/conf/domain_conf.h (virDomainObjSetMetadata): Adjust signature. * src/bhyve/bhyve_driver.c (bhyveDomainSetMetadata): Adjust caller. * src/lxc/lxc_driver.c (lxcDomainSetMetadata): Likewise. * src/qemu/qemu_driver.c (qemuDomainSetMetadata): Likewise. * src/test/test_driver.c (testDomainSetMetadata): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
b6938a7c88
commit
60e4944059
@ -1046,7 +1046,8 @@ bhyveDomainSetMetadata(virDomainPtr dom,
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainObjSetMetadata(vm, type, metadata, key, uri, caps,
|
||||
privconn->xmlopt, BHYVE_CONFIG_DIR, flags);
|
||||
privconn->xmlopt, BHYVE_STATE_DIR,
|
||||
BHYVE_CONFIG_DIR, flags);
|
||||
|
||||
cleanup:
|
||||
virObjectUnref(caps);
|
||||
|
@ -18140,6 +18140,9 @@ virDomainSaveXML(const char *configDir,
|
||||
char *configFile = NULL;
|
||||
int ret = -1;
|
||||
|
||||
if (!configDir)
|
||||
return 0;
|
||||
|
||||
if ((configFile = virDomainConfigFile(configDir, def->name)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
@ -19770,6 +19773,7 @@ virDomainObjSetMetadata(virDomainObjPtr vm,
|
||||
const char *uri,
|
||||
virCapsPtr caps,
|
||||
virDomainXMLOptionPtr xmlopt,
|
||||
const char *stateDir,
|
||||
const char *configDir,
|
||||
unsigned int flags)
|
||||
{
|
||||
@ -19782,12 +19786,17 @@ virDomainObjSetMetadata(virDomainObjPtr vm,
|
||||
&persistentDef) < 0)
|
||||
return -1;
|
||||
|
||||
if (flags & VIR_DOMAIN_AFFECT_LIVE)
|
||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||
if (virDomainDefSetMetadata(vm->def, type, metadata, key, uri) < 0)
|
||||
return -1;
|
||||
|
||||
if (virDomainSaveStatus(xmlopt, stateDir, vm) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||
if (virDomainDefSetMetadata(persistentDef, type, metadata, key, uri) < 0)
|
||||
if (virDomainDefSetMetadata(persistentDef, type, metadata, key,
|
||||
uri) < 0)
|
||||
return -1;
|
||||
|
||||
if (virDomainSaveConfig(configDir, persistentDef) < 0)
|
||||
|
@ -2664,6 +2664,7 @@ int virDomainObjSetMetadata(virDomainObjPtr vm,
|
||||
const char *uri,
|
||||
virCapsPtr caps,
|
||||
virDomainXMLOptionPtr xmlopt,
|
||||
const char *stateDir,
|
||||
const char *configDir,
|
||||
unsigned int flags);
|
||||
|
||||
|
@ -5600,7 +5600,8 @@ lxcDomainSetMetadata(virDomainPtr dom,
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainObjSetMetadata(vm, type, metadata, key, uri, caps,
|
||||
driver->xmlopt, cfg->configDir, flags);
|
||||
driver->xmlopt, cfg->stateDir,
|
||||
cfg->configDir, flags);
|
||||
|
||||
cleanup:
|
||||
virObjectUnlock(vm);
|
||||
|
@ -16118,7 +16118,8 @@ qemuDomainSetMetadata(virDomainPtr dom,
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainObjSetMetadata(vm, type, metadata, key, uri, caps,
|
||||
driver->xmlopt, cfg->configDir, flags);
|
||||
driver->xmlopt, cfg->stateDir,
|
||||
cfg->configDir, flags);
|
||||
|
||||
cleanup:
|
||||
virObjectUnlock(vm);
|
||||
|
@ -3042,7 +3042,7 @@ static int testDomainSetMetadata(virDomainPtr dom,
|
||||
|
||||
ret = virDomainObjSetMetadata(privdom, type, metadata, key, uri,
|
||||
privconn->caps, privconn->xmlopt,
|
||||
NULL, flags);
|
||||
NULL, NULL, flags);
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
|
Loading…
x
Reference in New Issue
Block a user