提交 d071d292 编写于 作者: P Peter Krempa

qemu: process: Call the domain config validator when starting a new VM

To avoid duplicating all the checks when starting a fresh VM from a
possibly unchecked config, call the domain def validator.
上级 0d1c17aa
...@@ -4283,8 +4283,10 @@ qemuProcessStartWarnShmem(virDomainObjPtr vm) ...@@ -4283,8 +4283,10 @@ qemuProcessStartWarnShmem(virDomainObjPtr vm)
} }
static int static int
qemuProcessStartValidateXML(virDomainObjPtr vm, qemuProcessStartValidateXML(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virQEMUCapsPtr qemuCaps, virQEMUCapsPtr qemuCaps,
virCapsPtr caps,
unsigned int flags) unsigned int flags)
{ {
/* The bits we validate here are XML configs that we previously /* The bits we validate here are XML configs that we previously
...@@ -4301,9 +4303,14 @@ qemuProcessStartValidateXML(virDomainObjPtr vm, ...@@ -4301,9 +4303,14 @@ qemuProcessStartValidateXML(virDomainObjPtr vm,
/* checks below should not be executed when starting a qemu process for a /* checks below should not be executed when starting a qemu process for a
* VM that was running before (migration, snapshots, save). It's more * VM that was running before (migration, snapshots, save). It's more
* important to start such VM than keep the configuration clean */ * important to start such VM than keep the configuration clean */
if ((flags & VIR_QEMU_PROCESS_START_NEW) && if ((flags & VIR_QEMU_PROCESS_START_NEW)) {
virDomainDefCheckDuplicateDiskInfo(vm->def) < 0) if (virDomainDefValidate(vm->def, caps, 0, driver->xmlopt) < 0)
return -1; return -1;
if (virDomainDefCheckDuplicateDiskInfo(vm->def) < 0)
return -1;
}
if (vm->def->mem.min_guarantee) { if (vm->def->mem.min_guarantee) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
...@@ -4331,6 +4338,7 @@ static int ...@@ -4331,6 +4338,7 @@ static int
qemuProcessStartValidate(virQEMUDriverPtr driver, qemuProcessStartValidate(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virQEMUCapsPtr qemuCaps, virQEMUCapsPtr qemuCaps,
virCapsPtr caps,
unsigned int flags) unsigned int flags)
{ {
size_t i; size_t i;
...@@ -4358,7 +4366,7 @@ qemuProcessStartValidate(virQEMUDriverPtr driver, ...@@ -4358,7 +4366,7 @@ qemuProcessStartValidate(virQEMUDriverPtr driver,
} }
if (qemuProcessStartValidateXML(vm, qemuCaps, flags) < 0) if (qemuProcessStartValidateXML(driver, vm, qemuCaps, caps, flags) < 0)
return -1; return -1;
VIR_DEBUG("Checking for any possible (non-fatal) issues"); VIR_DEBUG("Checking for any possible (non-fatal) issues");
...@@ -4437,7 +4445,7 @@ qemuProcessInit(virQEMUDriverPtr driver, ...@@ -4437,7 +4445,7 @@ qemuProcessInit(virQEMUDriverPtr driver,
vm->def->os.machine))) vm->def->os.machine)))
goto cleanup; goto cleanup;
if (qemuProcessStartValidate(driver, vm, priv->qemuCaps, flags) < 0) if (qemuProcessStartValidate(driver, vm, priv->qemuCaps, caps, flags) < 0)
goto cleanup; goto cleanup;
/* Do this upfront, so any part of the startup process can add /* Do this upfront, so any part of the startup process can add
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册