[Libvirt-cim] [PATCH 01 of 29] Added installation support for openWbem

Heidi Eckhart heidieck at linux.vnet.ibm.com
Thu Dec 20 19:34:21 UTC 2007


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1198182611 -3600
# Node ID 6d6ab1dddcdc4835de7c492635f531ed4797a736
# Parent  133cbb1df893f2d031cba3534c88936bce69da78
Added installation support for openWbem
Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>

diff -r 133cbb1df893 -r 6d6ab1dddcdc Makefile.am
--- a/Makefile.am	Wed Dec 19 11:16:08 2007 +0100
+++ b/Makefile.am	Thu Dec 20 21:30:11 2007 +0100
@@ -96,11 +96,11 @@ preinstall:
 # @CIMSERVER@ is set by the configure script
 postinstall:
 	sh provider-register.sh -v -t @CIMSERVER@ -n @CIM_VIRT_NS@ -r $(REGS) -m $(MOFS)
-	sh provider-register.sh -v -t @CIMSERVER@ -n /root/interop -r $(INTEROP_REGS) -m $(INTEROP_MOFS)
+	sh provider-register.sh -v -t @CIMSERVER@ -n root/interop -r $(INTEROP_REGS) -m $(INTEROP_MOFS)
 
 preuninstall:
 	sh provider-register.sh -v -d -t @CIMSERVER@ -n @CIM_VIRT_NS@ -r $(REGS) -m $(MOFS)
-	sh provider-register.sh -v -d -t @CIMSERVER@ -n /root/interop -r $(INTEROP_REGS) -m $(INTEROP_MOFS)
+	sh provider-register.sh -v -d -t @CIMSERVER@ -n root/interop -r $(INTEROP_REGS) -m $(INTEROP_MOFS)
 
 rpm: clean
 	@(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz)
diff -r 133cbb1df893 -r 6d6ab1dddcdc base_schema/install_base_schema.sh.in
--- a/base_schema/install_base_schema.sh.in	Wed Dec 19 11:16:08 2007 +0100
+++ b/base_schema/install_base_schema.sh.in	Thu Dec 20 21:30:11 2007 +0100
@@ -3,6 +3,7 @@ DATA="$1"
 DATA="$1"
 NS=@CIM_VIRT_NS@
 CIMOM=@CIMSERVER@
+SCHEMA_VERSION="2.16"
 
 TMPDIR=$(mktemp -d /tmp/cim_schema.XXXXX)
 
@@ -44,6 +45,17 @@ detect_sfcb_dir() {
     done
 }
 
+detect_openwbem_dir() {
+    dirs="/usr/share/mof"
+
+    for d in $dirs; do
+	if [ -d "$d" ]; then
+	    echo $d
+	    return
+	fi
+    done
+}
+
 install_schema_pegasus() {
     local repo=$(detect_peg_repo)
 
@@ -76,6 +88,26 @@ install_schema_sfcb() {
     sfcbrepos -f
 }
 
+install_schema_openwbem() {
+    local dir=$(detect_openwbem_dir)
+    local schema_dir=$dir/cimv$SCHEMA_VERSION
+
+    mkdir $schema_dir
+    if [ -d "$schema_dir" ]; then
+	echo "Unable to determine openwbem schema directory"
+	return
+    fi
+
+    cp ${TMPDIR}/cimv???.mof ${TMPDIR}/CIM_Schema.mof
+    cp -ra ${TMPDIR}/* $schema_dir
+
+    owcreatenamespace -u http://localhost/ -n root/virt
+    owmofc -u http://localhost/cimom -n root/virt $schema_dir/CIM_Schema.mof
+
+    owcreatenamespace -u http://localhost/ -n root/interop
+    owmofc -u http://localhost/cimom -n root/interop $schema_dir/cimv???-interop.mof
+}
+
 if [ -z "$1" ]; then
     echo "Usage: $0 [source_dir]"
     exit 1
@@ -91,6 +123,9 @@ case "$CIMOM" in
     pegasus)
 	(install_schema_pegasus) >>$DEBUG 2>&1
 	;;
+    openwbem)
+	(install_schema_openwbem) >>$DEBUG 2>&1
+	;;
     *)
 	echo ERROR: Unknown CIMOM: $CIMOM
 	;;
diff -r 133cbb1df893 -r 6d6ab1dddcdc provider-register.sh
--- a/provider-register.sh	Wed Dec 19 11:16:08 2007 +0100
+++ b/provider-register.sh	Thu Dec 20 21:30:11 2007 +0100
@@ -477,7 +477,7 @@ openwbem_transform()
     then
 	for _f in $moffiles
 	do
-	  sed "s/Provider *( *\"cmpi:/Provider(\"cmpi::/g" < $_f >> $OUTFILE
+	  cat $_f >> $OUTFILE
 	done
     fi
 }
@@ -497,6 +497,9 @@ openwbem_repository()
 
 openwbem_install()
 {
+    namespace=$1
+    shift
+
     CIMMOF=`which owmofc 2> /dev/null`
     if test $? != 0
     then
@@ -531,7 +534,7 @@ openwbem_install()
     if openwbem_transform $_REGFILENAME $*
     then
 	chatter Registering providers with $state owcimomd
-	$CIMMOF $_REGFILENAME > /dev/null
+	$CIMMOF -u http://localhost/cimom -n $namespace $_REGFILENAME > /dev/null
     else
 	echo "Failed to build OpenWBEM registration MOF." >&2
 	return 1
@@ -540,6 +543,9 @@ openwbem_install()
 
 openwbem_uninstall()
 {
+    namespace=$1
+    shift
+
     CIMMOF=`which owmofc 2> /dev/null`
     if test $? != 0
     then
@@ -728,7 +734,7 @@ then
     case $cimserver in
 	pegasus) pegasus_install $namespace $mofs ":" $regs;;
 	sfcb)    sfcb_install $namespace $mofs ":" $regs;;
-	openwbem) openwbem_install $mofs ;;
+	openwbem) openwbem_install $namespace $mofs ;;
 	sniacimom) echo sniacimom not yet supported && exit 1 ;;
 	**)	echo "Invalid CIM Server Type " $cimserver && exit 1;;
     esac
@@ -736,7 +742,7 @@ else
     case $cimserver in
 	pegasus) pegasus_uninstall $namespace $mofs ":" $regs;;
 	sfcb)    sfcb_uninstall $namespace $mofs ":" $regs;;
-	openwbem) openwbem_uninstall $mofs ;;
+	openwbem) openwbem_uninstall $namespace $mofs ;;
 	sniacimom) echo sniacimom not yet supported && exit 1 ;;
 	**)	echo "Invalid CIM Server Type " $cimserver && exit 1;;
     esac




More information about the Libvirt-cim mailing list