From cfc3edc97c3075c800e8366e3ff4e1d21578caca Mon Sep 17 00:00:00 2001 From: Kevin Zhao Date: Wed, 8 Feb 2017 10:54:29 +0800 Subject: [PATCH] Add "--nvram" to virsh undefine domain when clean_nova For the instance which has boot by uefi, we should use virsh undefine --nvram to undefine it. Check the libvirt version for whether it supports nvram and use new undefine parameters since this parameters is compatible with those instance which don't use uefi. Closes-bug: #1612613 Change-Id: Ibca1450e965df1481e6cd6b0d597b4323d667e60 Signed-off-by: Kevin Zhao --- lib/nova | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/nova b/lib/nova index 4d336f6271..5f7a658e6a 100644 --- a/lib/nova +++ b/lib/nova @@ -202,7 +202,10 @@ 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 --managed-save || true + if ! xargs -n1 sudo virsh undefine --managed-save --nvram <<< $instances; then + # Can't delete with nvram flags, then just try without this flag + xargs -n1 sudo virsh undefine --managed-save <<< $instances + fi fi # Logout and delete iscsi sessions