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>
This commit is contained in:
Daniel P. Berrange 2013-05-20 15:03:43 +01:00
parent 683ef75510
commit d52008acd4

View File

@ -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