提交 cd57b7c7 编写于 作者: J Joao Martins 提交者: Daniel P. Berrange

conf: add caps to virDomainSaveConfig

virDomainSaveConfig calls virDomainDefFormat which was setting the caps
to NULL, thus keeping the old behaviour (i.e. not looking at
netprefix). This patch adds the virCapsPtr to the function and allows
the configuration to be saved and skipping interface names that were
registered with virCapabilitiesSetNetPrefix().
Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
上级 d239a542
...@@ -551,7 +551,7 @@ bhyveDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flag ...@@ -551,7 +551,7 @@ bhyveDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flag
def = NULL; def = NULL;
vm->persistent = 1; vm->persistent = 1;
if (virDomainSaveConfig(BHYVE_CONFIG_DIR, if (virDomainSaveConfig(BHYVE_CONFIG_DIR, caps,
vm->newDef ? vm->newDef : vm->def) < 0) { vm->newDef ? vm->newDef : vm->def) < 0) {
virDomainObjListRemove(privconn->domains, vm); virDomainObjListRemove(privconn->domains, vm);
vm = NULL; vm = NULL;
......
...@@ -22725,12 +22725,13 @@ virDomainSaveXML(const char *configDir, ...@@ -22725,12 +22725,13 @@ virDomainSaveXML(const char *configDir,
int int
virDomainSaveConfig(const char *configDir, virDomainSaveConfig(const char *configDir,
virCapsPtr caps,
virDomainDefPtr def) virDomainDefPtr def)
{ {
int ret = -1; int ret = -1;
char *xml; char *xml;
if (!(xml = virDomainDefFormat(def, NULL, VIR_DOMAIN_DEF_FORMAT_SECURE))) if (!(xml = virDomainDefFormat(def, caps, VIR_DOMAIN_DEF_FORMAT_SECURE)))
goto cleanup; goto cleanup;
if (virDomainSaveXML(configDir, def, xml)) if (virDomainSaveXML(configDir, def, xml))
...@@ -23914,7 +23915,7 @@ virDomainObjSetMetadata(virDomainObjPtr vm, ...@@ -23914,7 +23915,7 @@ virDomainObjSetMetadata(virDomainObjPtr vm,
uri) < 0) uri) < 0)
return -1; return -1;
if (virDomainSaveConfig(configDir, persistentDef) < 0) if (virDomainSaveConfig(configDir, caps, persistentDef) < 0)
return -1; return -1;
} }
......
...@@ -2908,6 +2908,7 @@ int virDomainSaveXML(const char *configDir, ...@@ -2908,6 +2908,7 @@ int virDomainSaveXML(const char *configDir,
const char *xml); const char *xml);
int virDomainSaveConfig(const char *configDir, int virDomainSaveConfig(const char *configDir,
virCapsPtr caps,
virDomainDefPtr def); virDomainDefPtr def);
int virDomainSaveStatus(virDomainXMLOptionPtr xmlopt, int virDomainSaveStatus(virDomainXMLOptionPtr xmlopt,
const char *statusDir, const char *statusDir,
......
...@@ -1511,7 +1511,7 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, ...@@ -1511,7 +1511,7 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
virDomainDefSetMemoryTotal(persistentDef, newmem); virDomainDefSetMemoryTotal(persistentDef, newmem);
if (persistentDef->mem.cur_balloon > newmem) if (persistentDef->mem.cur_balloon > newmem)
persistentDef->mem.cur_balloon = newmem; persistentDef->mem.cur_balloon = newmem;
ret = virDomainSaveConfig(cfg->configDir, persistentDef); ret = virDomainSaveConfig(cfg->configDir, cfg->caps, persistentDef);
goto endjob; goto endjob;
} }
...@@ -1543,7 +1543,7 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, ...@@ -1543,7 +1543,7 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
if (flags & VIR_DOMAIN_MEM_CONFIG) { if (flags & VIR_DOMAIN_MEM_CONFIG) {
sa_assert(persistentDef); sa_assert(persistentDef);
persistentDef->mem.cur_balloon = newmem; persistentDef->mem.cur_balloon = newmem;
ret = virDomainSaveConfig(cfg->configDir, persistentDef); ret = virDomainSaveConfig(cfg->configDir, cfg->caps, persistentDef);
goto endjob; goto endjob;
} }
} }
...@@ -2237,7 +2237,7 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, ...@@ -2237,7 +2237,7 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
} }
} }
if (flags & VIR_DOMAIN_VCPU_CONFIG) { if (flags & VIR_DOMAIN_VCPU_CONFIG) {
if (virDomainSaveConfig(cfg->configDir, def) < 0) { if (virDomainSaveConfig(cfg->configDir, cfg->caps, def) < 0) {
VIR_WARN("Unable to save configuration of vm %s after changing vcpus", VIR_WARN("Unable to save configuration of vm %s after changing vcpus",
vm->def->name); vm->def->name);
} }
...@@ -2394,7 +2394,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu, ...@@ -2394,7 +2394,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
if (flags & VIR_DOMAIN_AFFECT_LIVE) { if (flags & VIR_DOMAIN_AFFECT_LIVE) {
ret = virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm); ret = virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm);
} else if (flags & VIR_DOMAIN_AFFECT_CONFIG) { } else if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
ret = virDomainSaveConfig(cfg->configDir, targetDef); ret = virDomainSaveConfig(cfg->configDir, cfg->caps, targetDef);
} }
endjob: endjob:
...@@ -2805,6 +2805,7 @@ libxlDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flag ...@@ -2805,6 +2805,7 @@ libxlDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flag
vm->persistent = 1; vm->persistent = 1;
if (virDomainSaveConfig(cfg->configDir, if (virDomainSaveConfig(cfg->configDir,
cfg->caps,
vm->newDef ? vm->newDef : vm->def) < 0) { vm->newDef ? vm->newDef : vm->def) < 0) {
virDomainObjListRemove(driver->domains, vm); virDomainObjListRemove(driver->domains, vm);
vm = NULL; vm = NULL;
...@@ -3749,7 +3750,7 @@ libxlDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, ...@@ -3749,7 +3750,7 @@ libxlDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
/* Finally, if no error until here, we can save config. */ /* Finally, if no error until here, we can save config. */
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) { if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
ret = virDomainSaveConfig(cfg->configDir, vmdef); ret = virDomainSaveConfig(cfg->configDir, cfg->caps, vmdef);
if (!ret) { if (!ret) {
virDomainObjAssignDef(vm, vmdef, false, NULL); virDomainObjAssignDef(vm, vmdef, false, NULL);
vmdef = NULL; vmdef = NULL;
...@@ -3857,7 +3858,7 @@ libxlDomainDetachDeviceFlags(virDomainPtr dom, const char *xml, ...@@ -3857,7 +3858,7 @@ libxlDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
/* Finally, if no error until here, we can save config. */ /* Finally, if no error until here, we can save config. */
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) { if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
ret = virDomainSaveConfig(cfg->configDir, vmdef); ret = virDomainSaveConfig(cfg->configDir, cfg->caps, vmdef);
if (!ret) { if (!ret) {
virDomainObjAssignDef(vm, vmdef, false, NULL); virDomainObjAssignDef(vm, vmdef, false, NULL);
vmdef = NULL; vmdef = NULL;
...@@ -3962,7 +3963,7 @@ libxlDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml, ...@@ -3962,7 +3963,7 @@ libxlDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
/* Finally, if no error until here, we can save config. */ /* Finally, if no error until here, we can save config. */
if (!ret && (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG)) { if (!ret && (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG)) {
ret = virDomainSaveConfig(cfg->configDir, vmdef); ret = virDomainSaveConfig(cfg->configDir, cfg->caps, vmdef);
if (!ret) { if (!ret) {
virDomainObjAssignDef(vm, vmdef, false, NULL); virDomainObjAssignDef(vm, vmdef, false, NULL);
vmdef = NULL; vmdef = NULL;
......
...@@ -488,7 +488,7 @@ lxcDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags) ...@@ -488,7 +488,7 @@ lxcDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
def = NULL; def = NULL;
vm->persistent = 1; vm->persistent = 1;
if (virDomainSaveConfig(cfg->configDir, if (virDomainSaveConfig(cfg->configDir, driver->caps,
vm->newDef ? vm->newDef : vm->def) < 0) { vm->newDef ? vm->newDef : vm->def) < 0) {
virDomainObjListRemove(driver->domains, vm); virDomainObjListRemove(driver->domains, vm);
vm = NULL; vm = NULL;
...@@ -737,7 +737,8 @@ static int lxcDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, ...@@ -737,7 +737,8 @@ static int lxcDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
virDomainDefSetMemoryTotal(persistentDef, newmem); virDomainDefSetMemoryTotal(persistentDef, newmem);
if (persistentDef->mem.cur_balloon > newmem) if (persistentDef->mem.cur_balloon > newmem)
persistentDef->mem.cur_balloon = newmem; persistentDef->mem.cur_balloon = newmem;
if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0) if (virDomainSaveConfig(cfg->configDir, driver->caps,
persistentDef) < 0)
goto cleanup; goto cleanup;
} }
} else { } else {
...@@ -770,7 +771,8 @@ static int lxcDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, ...@@ -770,7 +771,8 @@ static int lxcDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
if (flags & VIR_DOMAIN_AFFECT_CONFIG) { if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
persistentDef->mem.cur_balloon = newmem; persistentDef->mem.cur_balloon = newmem;
if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0) if (virDomainSaveConfig(cfg->configDir, driver->caps,
persistentDef) < 0)
goto cleanup; goto cleanup;
} }
} }
...@@ -915,7 +917,7 @@ lxcDomainSetMemoryParameters(virDomainPtr dom, ...@@ -915,7 +917,7 @@ lxcDomainSetMemoryParameters(virDomainPtr dom,
#undef LXC_SET_MEM_PARAMETER #undef LXC_SET_MEM_PARAMETER
if (flags & VIR_DOMAIN_AFFECT_CONFIG && if (flags & VIR_DOMAIN_AFFECT_CONFIG &&
virDomainSaveConfig(cfg->configDir, vmdef) < 0) virDomainSaveConfig(cfg->configDir, driver->caps, vmdef) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;
...@@ -2025,7 +2027,7 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom, ...@@ -2025,7 +2027,7 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom,
if (flags & VIR_DOMAIN_AFFECT_CONFIG) { if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
rc = virDomainSaveConfig(cfg->configDir, vmdef); rc = virDomainSaveConfig(cfg->configDir, driver->caps, vmdef);
if (rc < 0) if (rc < 0)
goto cleanup; goto cleanup;
...@@ -2727,7 +2729,7 @@ lxcDomainSetBlkioParameters(virDomainPtr dom, ...@@ -2727,7 +2729,7 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
} }
} }
if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0) if (virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef) < 0)
ret = -1; ret = -1;
} }
...@@ -5081,7 +5083,7 @@ static int lxcDomainAttachDeviceFlags(virDomainPtr dom, ...@@ -5081,7 +5083,7 @@ static int lxcDomainAttachDeviceFlags(virDomainPtr dom,
/* Finally, if no error until here, we can save config. */ /* Finally, if no error until here, we can save config. */
if (flags & VIR_DOMAIN_AFFECT_CONFIG) { if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
ret = virDomainSaveConfig(cfg->configDir, vmdef); ret = virDomainSaveConfig(cfg->configDir, driver->caps, vmdef);
if (!ret) { if (!ret) {
virDomainObjAssignDef(vm, vmdef, false, NULL); virDomainObjAssignDef(vm, vmdef, false, NULL);
vmdef = NULL; vmdef = NULL;
...@@ -5203,7 +5205,7 @@ static int lxcDomainUpdateDeviceFlags(virDomainPtr dom, ...@@ -5203,7 +5205,7 @@ static int lxcDomainUpdateDeviceFlags(virDomainPtr dom,
/* Finally, if no error until here, we can save config. */ /* Finally, if no error until here, we can save config. */
if (flags & VIR_DOMAIN_AFFECT_CONFIG) { if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
ret = virDomainSaveConfig(cfg->configDir, vmdef); ret = virDomainSaveConfig(cfg->configDir, driver->caps, vmdef);
if (!ret) { if (!ret) {
virDomainObjAssignDef(vm, vmdef, false, NULL); virDomainObjAssignDef(vm, vmdef, false, NULL);
vmdef = NULL; vmdef = NULL;
...@@ -5323,7 +5325,7 @@ static int lxcDomainDetachDeviceFlags(virDomainPtr dom, ...@@ -5323,7 +5325,7 @@ static int lxcDomainDetachDeviceFlags(virDomainPtr dom,
/* Finally, if no error until here, we can save config. */ /* Finally, if no error until here, we can save config. */
if (flags & VIR_DOMAIN_AFFECT_CONFIG) { if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
ret = virDomainSaveConfig(cfg->configDir, vmdef); ret = virDomainSaveConfig(cfg->configDir, driver->caps, vmdef);
if (!ret) { if (!ret) {
virDomainObjAssignDef(vm, vmdef, false, NULL); virDomainObjAssignDef(vm, vmdef, false, NULL);
vmdef = NULL; vmdef = NULL;
......
...@@ -189,6 +189,7 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver, ...@@ -189,6 +189,7 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
VIR_WARN("Unable to save status on vm %s after block job", VIR_WARN("Unable to save status on vm %s after block job",
vm->def->name); vm->def->name);
if (persistDisk && virDomainSaveConfig(cfg->configDir, if (persistDisk && virDomainSaveConfig(cfg->configDir,
driver->caps,
vm->newDef) < 0) vm->newDef) < 0)
VIR_WARN("Unable to update persistent definition on vm %s " VIR_WARN("Unable to update persistent definition on vm %s "
"after block job", vm->def->name); "after block job", vm->def->name);
......
...@@ -2432,7 +2432,8 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, ...@@ -2432,7 +2432,8 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
if (persistentDef->mem.cur_balloon > newmem) if (persistentDef->mem.cur_balloon > newmem)
persistentDef->mem.cur_balloon = newmem; persistentDef->mem.cur_balloon = newmem;
ret = virDomainSaveConfig(cfg->configDir, persistentDef); ret = virDomainSaveConfig(cfg->configDir, driver->caps,
persistentDef);
goto endjob; goto endjob;
} }
...@@ -2471,7 +2472,8 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, ...@@ -2471,7 +2472,8 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
if (persistentDef) { if (persistentDef) {
persistentDef->mem.cur_balloon = newmem; persistentDef->mem.cur_balloon = newmem;
ret = virDomainSaveConfig(cfg->configDir, persistentDef); ret = virDomainSaveConfig(cfg->configDir, driver->caps,
persistentDef);
goto endjob; goto endjob;
} }
} }
...@@ -2560,7 +2562,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, ...@@ -2560,7 +2562,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period,
goto endjob; goto endjob;
} }
persistentDef->memballoon->period = period; persistentDef->memballoon->period = period;
ret = virDomainSaveConfig(cfg->configDir, persistentDef); ret = virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef);
goto endjob; goto endjob;
} }
...@@ -5103,7 +5105,8 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, ...@@ -5103,7 +5105,8 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
goto endjob; goto endjob;
} }
if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0) if (virDomainSaveConfig(cfg->configDir, driver->caps,
persistentDef) < 0)
goto endjob; goto endjob;
} }
...@@ -5293,7 +5296,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom, ...@@ -5293,7 +5296,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
goto endjob; goto endjob;
} }
ret = virDomainSaveConfig(cfg->configDir, persistentDef); ret = virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef);
goto endjob; goto endjob;
} }
...@@ -5497,7 +5500,7 @@ qemuDomainPinEmulator(virDomainPtr dom, ...@@ -5497,7 +5500,7 @@ qemuDomainPinEmulator(virDomainPtr dom,
if (!(persistentDef->cputune.emulatorpin = virBitmapNewCopy(pcpumap))) if (!(persistentDef->cputune.emulatorpin = virBitmapNewCopy(pcpumap)))
goto endjob; goto endjob;
ret = virDomainSaveConfig(cfg->configDir, persistentDef); ret = virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef);
goto endjob; goto endjob;
} }
...@@ -5997,7 +6000,7 @@ qemuDomainPinIOThread(virDomainPtr dom, ...@@ -5997,7 +6000,7 @@ qemuDomainPinIOThread(virDomainPtr dom,
iothrid->cpumask = cpumask; iothrid->cpumask = cpumask;
iothrid->autofill = false; iothrid->autofill = false;
ret = virDomainSaveConfig(cfg->configDir, persistentDef); ret = virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef);
goto endjob; goto endjob;
} }
...@@ -6300,7 +6303,8 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver, ...@@ -6300,7 +6303,8 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver,
persistentDef->iothreads--; persistentDef->iothreads--;
} }
if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0) if (virDomainSaveConfig(cfg->configDir, driver->caps,
persistentDef) < 0)
goto endjob; goto endjob;
} }
...@@ -7624,7 +7628,7 @@ static virDomainPtr qemuDomainDefineXMLFlags(virConnectPtr conn, const char *xml ...@@ -7624,7 +7628,7 @@ static virDomainPtr qemuDomainDefineXMLFlags(virConnectPtr conn, const char *xml
} }
vm->persistent = 1; vm->persistent = 1;
if (virDomainSaveConfig(cfg->configDir, if (virDomainSaveConfig(cfg->configDir, driver->caps,
vm->newDef ? vm->newDef : vm->def) < 0) { vm->newDef ? vm->newDef : vm->def) < 0) {
if (oldDef) { if (oldDef) {
/* There is backup so this VM was defined before. /* There is backup so this VM was defined before.
...@@ -8614,7 +8618,7 @@ static int qemuDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, ...@@ -8614,7 +8618,7 @@ static int qemuDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
/* Finally, if no error until here, we can save config. */ /* Finally, if no error until here, we can save config. */
if (flags & VIR_DOMAIN_AFFECT_CONFIG) { if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
ret = virDomainSaveConfig(cfg->configDir, vmdef); ret = virDomainSaveConfig(cfg->configDir, driver->caps, vmdef);
if (!ret) { if (!ret) {
virDomainObjAssignDef(vm, vmdef, false, NULL); virDomainObjAssignDef(vm, vmdef, false, NULL);
vmdef = NULL; vmdef = NULL;
...@@ -8740,7 +8744,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, ...@@ -8740,7 +8744,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
/* Finally, if no error until here, we can save config. */ /* Finally, if no error until here, we can save config. */
if (flags & VIR_DOMAIN_AFFECT_CONFIG) { if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
ret = virDomainSaveConfig(cfg->configDir, vmdef); ret = virDomainSaveConfig(cfg->configDir, driver->caps, vmdef);
if (!ret) { if (!ret) {
virDomainObjAssignDef(vm, vmdef, false, NULL); virDomainObjAssignDef(vm, vmdef, false, NULL);
vmdef = NULL; vmdef = NULL;
...@@ -8860,7 +8864,7 @@ static int qemuDomainDetachDeviceFlags(virDomainPtr dom, const char *xml, ...@@ -8860,7 +8864,7 @@ static int qemuDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
/* Finally, if no error until here, we can save config. */ /* Finally, if no error until here, we can save config. */
if (flags & VIR_DOMAIN_AFFECT_CONFIG) { if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
ret = virDomainSaveConfig(cfg->configDir, vmdef); ret = virDomainSaveConfig(cfg->configDir, driver->caps, vmdef);
if (!ret) { if (!ret) {
virDomainObjAssignDef(vm, vmdef, false, NULL); virDomainObjAssignDef(vm, vmdef, false, NULL);
vmdef = NULL; vmdef = NULL;
...@@ -9418,7 +9422,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, ...@@ -9418,7 +9422,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
} }
} }
if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0) if (virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef) < 0)
ret = -1; ret = -1;
} }
...@@ -9975,7 +9979,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, ...@@ -9975,7 +9979,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
goto endjob; goto endjob;
if (flags & VIR_DOMAIN_AFFECT_CONFIG && if (flags & VIR_DOMAIN_AFFECT_CONFIG &&
virDomainSaveConfig(cfg->configDir, persistentDef) < 0) virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef) < 0)
goto endjob; goto endjob;
ret = 0; ret = 0;
...@@ -10251,7 +10255,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom, ...@@ -10251,7 +10255,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
-1, mode, nodeset) < 0) -1, mode, nodeset) < 0)
goto endjob; goto endjob;
if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0) if (virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef) < 0)
goto endjob; goto endjob;
} }
...@@ -10613,7 +10617,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom, ...@@ -10613,7 +10617,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
} }
if (flags & VIR_DOMAIN_AFFECT_CONFIG) { if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
rc = virDomainSaveConfig(cfg->configDir, vmdef); rc = virDomainSaveConfig(cfg->configDir, driver->caps, vmdef);
if (rc < 0) if (rc < 0)
goto endjob; goto endjob;
...@@ -11410,7 +11414,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, ...@@ -11410,7 +11414,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
} }
} }
if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0) if (virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef) < 0)
goto endjob; goto endjob;
} }
...@@ -13738,7 +13742,7 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver, ...@@ -13738,7 +13742,7 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
} }
defdisk->src->format = snapdisk->src->format; defdisk->src->format = snapdisk->src->format;
if (virDomainSaveConfig(cfg->configDir, vm->def) < 0) if (virDomainSaveConfig(cfg->configDir, driver->caps, vm->def) < 0)
goto cleanup; goto cleanup;
} }
} }
...@@ -14518,7 +14522,8 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, ...@@ -14518,7 +14522,8 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
if (ret == 0 || !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) { if (ret == 0 || !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) {
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0 || if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0 ||
(persist && virDomainSaveConfig(cfg->configDir, vm->newDef) < 0)) (persist && virDomainSaveConfig(cfg->configDir, driver->caps,
vm->newDef) < 0))
ret = -1; ret = -1;
} }
virObjectUnref(cfg); virObjectUnref(cfg);
...@@ -17811,7 +17816,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, ...@@ -17811,7 +17816,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
info.write_iops_sec = oldinfo->write_iops_sec; info.write_iops_sec = oldinfo->write_iops_sec;
} }
conf_disk->blkdeviotune = info; conf_disk->blkdeviotune = info;
ret = virDomainSaveConfig(cfg->configDir, persistentDef); ret = virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef);
if (ret < 0) { if (ret < 0) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s", virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("Write to config file failed")); _("Write to config file failed"));
...@@ -20035,7 +20040,7 @@ qemuDomainRenameCallback(virDomainObjPtr vm, ...@@ -20035,7 +20040,7 @@ qemuDomainRenameCallback(virDomainObjPtr vm,
vm->def->name = new_dom_name; vm->def->name = new_dom_name;
new_dom_name = NULL; new_dom_name = NULL;
if (virDomainSaveConfig(cfg->configDir, vm->def) < 0) if (virDomainSaveConfig(cfg->configDir, driver->caps, vm->def) < 0)
goto rollback; goto rollback;
if (virFileExists(old_dom_cfg_file) && if (virFileExists(old_dom_cfg_file) &&
......
...@@ -5747,7 +5747,8 @@ qemuMigrationPersist(virQEMUDriverPtr driver, ...@@ -5747,7 +5747,8 @@ qemuMigrationPersist(virQEMUDriverPtr driver,
if (!(vmdef = virDomainObjGetPersistentDef(caps, driver->xmlopt, vm))) if (!(vmdef = virDomainObjGetPersistentDef(caps, driver->xmlopt, vm)))
goto error; goto error;
if (virDomainSaveConfig(cfg->configDir, vmdef) < 0 && !ignoreSaveError) if (virDomainSaveConfig(cfg->configDir, driver->caps, vmdef) < 0 &&
!ignoreSaveError)
goto error; goto error;
event = virDomainEventLifecycleNewFromObj(vm, event = virDomainEventLifecycleNewFromObj(vm,
......
...@@ -3924,6 +3924,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, ...@@ -3924,6 +3924,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver,
static int static int
qemuPrepareNVRAM(virQEMUDriverConfigPtr cfg, qemuPrepareNVRAM(virQEMUDriverConfigPtr cfg,
virCapsPtr caps,
virDomainObjPtr vm, virDomainObjPtr vm,
bool migrated) bool migrated)
{ {
...@@ -3963,7 +3964,7 @@ qemuPrepareNVRAM(virQEMUDriverConfigPtr cfg, ...@@ -3963,7 +3964,7 @@ qemuPrepareNVRAM(virQEMUDriverConfigPtr cfg,
generated = true; generated = true;
if (vm->persistent && if (vm->persistent &&
virDomainSaveConfig(cfg->configDir, vm->def) < 0) virDomainSaveConfig(cfg->configDir, caps, vm->def) < 0)
goto cleanup; goto cleanup;
} }
...@@ -4437,7 +4438,7 @@ qemuProcessInit(virQEMUDriverPtr driver, ...@@ -4437,7 +4438,7 @@ qemuProcessInit(virQEMUDriverPtr driver,
* Fill them in prior to setting the domain def as transient. */ * Fill them in prior to setting the domain def as transient. */
VIR_DEBUG("Generating paths"); VIR_DEBUG("Generating paths");
if (qemuPrepareNVRAM(cfg, vm, migration) < 0) if (qemuPrepareNVRAM(cfg, caps, vm, migration) < 0)
goto stop; goto stop;
/* Do this upfront, so any part of the startup process can add /* Do this upfront, so any part of the startup process can add
......
...@@ -2103,7 +2103,7 @@ umlDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags) ...@@ -2103,7 +2103,7 @@ umlDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
def = NULL; def = NULL;
vm->persistent = 1; vm->persistent = 1;
if (virDomainSaveConfig(driver->configDir, if (virDomainSaveConfig(driver->configDir, driver->caps,
vm->newDef ? vm->newDef : vm->def) < 0) { vm->newDef ? vm->newDef : vm->def) < 0) {
virDomainObjListRemove(driver->domains, virDomainObjListRemove(driver->domains,
vm); vm);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册