From b9736d5b2122438d765663c0edca5d5cd421fce7 Mon Sep 17 00:00:00 2001 From: Osier Yang Date: Fri, 19 Aug 2011 21:52:12 +0800 Subject: [PATCH] vmware: Allow to undefine a running domain --- src/vmware/vmware_driver.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index 5c63239c45..b2cfdcefac 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -639,20 +639,19 @@ vmwareDomainUndefineFlags(virDomainPtr dom, goto cleanup; } - if (virDomainObjIsActive(vm)) { - vmwareError(VIR_ERR_OPERATION_INVALID, - "%s", _("cannot undefine active domain")); - goto cleanup; - } - if (!vm->persistent) { vmwareError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot undefine transient domain")); goto cleanup; } - virDomainRemoveInactive(&driver->domains, vm); - vm = NULL; + if (virDomainObjIsActive(vm)) { + vm->persistent = 0; + } else { + virDomainRemoveInactive(&driver->domains, vm); + vm = NULL; + } + ret = 0; cleanup: -- GitLab