From d52008acd48dbff6fcee01a159e9f65bf142b714 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Mon, 20 May 2013 15:03:43 +0100 Subject: [PATCH] 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 --- lib/nova | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nova b/lib/nova index 6fc0c7917a..9fc4ded7b6 100644 --- a/lib/nova +++ b/lib/nova @@ -151,7 +151,7 @@ function cleanup_nova() { instances=`sudo virsh list --all | grep $INSTANCE_NAME_PREFIX | sed "s/.*\($INSTANCE_NAME_PREFIX[0-9a-fA-F]*\).*/\1/g"` if [ ! "$instances" = "" ]; then echo $instances | xargs -n1 sudo virsh destroy || true - echo $instances | xargs -n1 sudo virsh undefine || true + echo $instances | xargs -n1 sudo virsh undefine --managed-save || true fi # Logout and delete iscsi sessions