[lib] Undefine domain before killing image in _tabula_rasa_kill_domain().
authorMaximilian Wilhelm <max@rfc2324.org>
Tue, 3 Nov 2009 18:49:13 +0000 (19:49 +0100)
committerMaximilian Wilhelm <max@rfc2324.org>
Tue, 3 Nov 2009 18:49:13 +0000 (19:49 +0100)
Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>

lib/core.c

index 9cccdb4..5291f9b 100644 (file)
@@ -160,6 +160,11 @@ _tabula_rasa_kill_domain (struct VscError *error, virDomainPtr domain,
                return;
 
        case VM_FATE__KILL_VM_IMAGE:
+               if (active)
+                       virDomainDestroy (domain);
+
+               virDomainUndefine (domain);
+
                if (vm) {
                        _vsc_mgmt_data_vm_take (vm);
                        vsc_free (&vm);
@@ -170,15 +175,19 @@ _tabula_rasa_kill_domain (struct VscError *error, virDomainPtr domain,
                        return;
                }
 
+               break;
+
        case VM_FATE__KILL_VM_ONLY:
                if (active)
                        virDomainDestroy (domain);
+
                virDomainUndefine (domain);
                break;
 
        default:
                VSC__ERROR1 (error, VSC__ERROR_CODE__INTERNAL_ERROR,
                             "Unknown or errornous fate code.");
+               return;
        }
 }