提交 b3b4aba5 编写于 作者: O Osier Yang

uml: Allow to undefine a running domain

上级 7d3390f8
......@@ -1806,12 +1806,6 @@ static int umlDomainUndefineFlags(virDomainPtr dom,
goto cleanup;
}
if (virDomainObjIsActive(vm)) {
umlReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot delete active domain"));
goto cleanup;
}
if (!vm->persistent) {
umlReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot undefine transient domain"));
......@@ -1821,9 +1815,13 @@ static int umlDomainUndefineFlags(virDomainPtr dom,
if (virDomainDeleteConfig(driver->configDir, driver->autostartDir, vm) < 0)
goto cleanup;
virDomainRemoveInactive(&driver->domains,
vm);
vm = NULL;
if (virDomainObjIsActive(vm)) {
vm->persistent = 0;
} else {
virDomainRemoveInactive(&driver->domains, vm);
vm = NULL;
}
ret = 0;
cleanup:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册