[Libvirt-cim] [PATCH 3/3] schema: Fix class removal with Pegasus

Viktor Mihajlovski mihajlov at linux.vnet.ibm.com
Tue Nov 5 09:03:33 UTC 2013


In provider de-registration step, the provider-register.sh
script is attempting to delete all libvirt-cim classes from
the Pegasus repository. Pegasus refuses to delete classes
if it still has child classes in the repository.
While the MOF files are processed in reverse order, the classes
were still deleted in their original order, which can fail due
to inter-class dependencies.
Changed to reverse the class deletion order on a per MOF
file base.

Signed-off-by: Viktor Mihajlovski <mihajlov at linux.vnet.ibm.com>
---
 provider-register.sh |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/provider-register.sh b/provider-register.sh
index b730ef3..abe8e95 100755
--- a/provider-register.sh
+++ b/provider-register.sh
@@ -332,8 +332,12 @@ pegasus_uninstall()
 	    echo "Error: wbemexec not found" >&2
 	    return 1
 	fi
-	CLASSES=`cat $mymofs 2> /dev/null | grep '^class'| cut -d ' ' -f 2 | uniq`
-
+	for mof in $mymofs
+	do
+        # We must delete the classes in reverse order per MOF file
+	    MOFCLASSES=`cat $mof 2> /dev/null | grep '^[[:space:]]*class' | sed 's/ \+/ /g' | tac | cut -d ' ' -f 2`
+	    CLASSES="$CLASSES $MOFCLASSES"
+	done
 	for _TEMPDIR in /var/tmp /tmp
 	  do
 	  if test -w $_TEMPDIR
-- 
1.7.9.5




More information about the Libvirt-cim mailing list