From: Osier Yang Date: Fri, 19 Aug 2011 13:51:42 +0000 (+0800) Subject: uml: Allow to undefine a running domain X-Git-Tag: v0.9.5-rc1~199 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3b4aba5d4ef5b2d3ae1e3f4827708b33b476817;p=thirdparty%2Flibvirt.git uml: Allow to undefine a running domain --- diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index a9cb7efa1a..19b6c55859 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -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: