Browse code

Use --managed-save flag to virsh undefine

If a virtual machine has got a managed save image, it is not
possible to delete it using a plain 'virsh undefine' command.
While Nova doesn't use 'managed save', the libvirt-guests
init script or systemd service may have created one if the
user rebooted their host. Thus we devstack should pass the
--managed-save flag to virsh to ensure the VM's removal.

Change-Id: Id9b072a6dceeb4e179d2b6a25bbdfb559c299e95
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>

Daniel P. Berrange authored on 2013/05/20 23:03:43
Showing 1 changed files
... ...
@@ -151,7 +151,7 @@ function cleanup_nova() {
151 151
         instances=`sudo virsh list --all | grep $INSTANCE_NAME_PREFIX | sed "s/.*\($INSTANCE_NAME_PREFIX[0-9a-fA-F]*\).*/\1/g"`
152 152
         if [ ! "$instances" = "" ]; then
153 153
             echo $instances | xargs -n1 sudo virsh destroy || true
154
-            echo $instances | xargs -n1 sudo virsh undefine || true
154
+            echo $instances | xargs -n1 sudo virsh undefine --managed-save || true
155 155
         fi
156 156
 
157 157
         # Logout and delete iscsi sessions