Blame SOURCES/libvirt-cim-0.6.3-a8cfd7dc.patch

5cef56
From a8cfd7dc6a4f173c764f02688ff0c8aec00ecec2 Mon Sep 17 00:00:00 2001
5cef56
From: John Ferlan <jferlan@redhat.com>
5cef56
Date: Mon, 13 Jan 2014 14:11:21 -0500
5cef56
Subject: [PATCH 48/48] Use of root/interop instead of root/PG_InterOp
5cef56
5cef56
As of tog-pegasus 2.12.1-5 we can no longer use "root/PG_InterOp" namespace
5cef56
for the CIM provider instead the use of "root/interop" is the preferred
5cef56
mechanism.
5cef56
5cef56
This patch will adjust where libvirt-cim installs its classes to use the
5cef56
"root/interop" namespace.
5cef56
5cef56
For more context, see:
5cef56
5cef56
    http://www.redhat.com/archives/libvirt-cim/2013-November/msg00083.html
5cef56
5cef56
and
5cef56
5cef56
    http://www.redhat.com/archives/libvirt-cim/2013-November/msg00008.html
5cef56
5cef56
This patch does not include the schema changes to FilterList although I
5cef56
have a suspicion that a bug fix between 2.12.1-8 and 2.12.1-11 has resolved
5cef56
the issue seen.  Cannot find a reference though.
5cef56
5cef56
Signed-off-by: John Ferlan <jferlan@redhat.com>
5cef56
---
5cef56
 Makefile.am          | 29 ++++++++++++++++++++++++-----
5cef56
 libvirt-cim.spec.in  | 27 ++++++++++++++++++++++-----
5cef56
 provider-register.sh | 18 +++++++++++++++++-
5cef56
 3 files changed, 63 insertions(+), 11 deletions(-)
5cef56
5cef56
diff --git a/Makefile.am b/Makefile.am
5cef56
index 9e8e96b..69b65cf 100644
5cef56
--- a/Makefile.am
5cef56
+++ b/Makefile.am
5cef56
@@ -78,6 +78,9 @@ INTEROP_MOFS = \
5cef56
 	$(top_srcdir)/schema/ReferencedProfile.mof \
5cef56
 	$(top_srcdir)/schema/AllocationCapabilities.mof
5cef56
 
5cef56
+# The PGINTEROP_MOFS are used by tog-pegasus up through version 2.12.1
5cef56
+# If support for versions prior to 2.12.1 is removed, then these defs
5cef56
+# can go away
5cef56
 PGINTEROP_MOFS = \
5cef56
 	$(top_srcdir)/schema/RegisteredProfile.mof \
5cef56
 	$(top_srcdir)/schema/ElementConformsToProfile.mof \
5cef56
@@ -157,6 +160,9 @@ INTEROP_REGS = \
5cef56
 	$(top_srcdir)/schema/ElementConformsToProfile.registration \
5cef56
 	$(top_srcdir)/schema/ReferencedProfile.registration
5cef56
 
5cef56
+# The PGINTEROP_REGS are used by tog-pegasus up through version 2.12.1
5cef56
+# If support for versions prior to 2.12.1 is removed, then these defs
5cef56
+# can go away
5cef56
 PGINTEROP_REGS = \
5cef56
 	$(top_srcdir)/schema/RegisteredProfile.registration \
5cef56
 	$(top_srcdir)/schema/ElementConformsToProfile.registration \
5cef56
@@ -181,7 +187,8 @@ EXTRA_DIST = schema $(MOFS) $(REGS) $(INTEROP_MOFS) $(INTEROP_REGS) \
5cef56
              .changeset .revision 			\
5cef56
 	     examples/diskpool.conf
5cef56
 
5cef56
-# If Pegasus isn't the CIMOM target, then remove the PG_InterOp namespace from the appropriate files
5cef56
+# If Pegasus isn't the CIMOM target, then remove the PG_InterOp namespace
5cef56
+# from the appropriate files
5cef56
 install-data-local:
5cef56
 	$(mkinstalldirs) "$(DESTDIR)$(pkgdatadir)"
5cef56
 	$(install_sh_DATA) -t "$(DESTDIR)$(pkgdatadir)" $(MOFS)
5cef56
@@ -189,11 +196,12 @@ install-data-local:
5cef56
 	$(install_sh_DATA) -t "$(DESTDIR)$(pkgdatadir)" $(INTEROP_MOFS)
5cef56
 	$(install_sh_DATA) -t "$(DESTDIR)$(pkgdatadir)" $(INTEROP_REGS)
5cef56
 	if [[ @CIMSERVER@ != pegasus ]]; then \
5cef56
-	sed -i '/^# --/,/^# --!/d' $(subst $(top_srcdir)/schema,$(DESTDIR)$(pkgdatadir), $(PGINTEROP_REGS)); \
5cef56
+	    sed -i '/^# --/,/^# --!/d' $(subst $(top_srcdir)/schema,$(DESTDIR)$(pkgdatadir), $(PGINTEROP_REGS)); \
5cef56
+	    sed -i '/^# --/,/^# --!/d' $(subst $(top_srcdir)/schema,$(DESTDIR)$(pkgdatadir), $(PGINTEROP_MOFS)); \
5cef56
 	fi
5cef56
 
5cef56
 uninstall-local:
5cef56
-	@list='$(MOFS) $(REGS) $(INTEROP_MOFS) $(INTEROP_REGS)'; \
5cef56
+	@list='$(MOFS) $(REGS) $(INTEROP_MOFS) $(INTEROP_REGS) $(PGINTEROP_REGS) $(PGINTEROP_MOFS)'; \
5cef56
 	for p in $$list; do \
5cef56
 	f=`echo "$$p" | sed 's|^.*/||;'`; \
5cef56
 	echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \
5cef56
@@ -209,8 +217,19 @@ postinstall:
5cef56
 	$(SHELL) provider-register.sh -v -t @CIMSERVER@ -n @CIM_VIRT_NS@ -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(MOFS))
5cef56
 	$(SHELL) provider-register.sh -v -t @CIMSERVER@ -n root/interop -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_MOFS))
5cef56
 	$(SHELL) provider-register.sh -v -t @CIMSERVER@ -n root/cimv2 -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_MOFS))
5cef56
+        #
5cef56
+        # We need to check the version - if we're not yet at 2.12.1, then
5cef56
+        # we'll register at root/PG_InterOp; otherwise, using just the above
5cef56
+        # registration should be sufficient. The actual cutoff root/PG_InterOp
5cef56
+        # not being valid was 2.12.1-5; however, --version doesn't give us that
5cef56
+        # level of detail. The Pegasus docs imply that usage of root/interop was
5cef56
+        # valid as of 2.12.0.
5cef56
+        #
5cef56
 	if [[ @CIMSERVER@ = pegasus ]]; then \
5cef56
-	$(SHELL) provider-register.sh -v -t @CIMSERVER@ -n root/PG_InterOp -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_MOFS)); \
5cef56
+	    CIMVER=`@CIMSERVER@ --version | awk -F. '{printf("%02d%02d%02d\n", $1,$2,$3); }'` \
5cef56
+	    if [[ $CIMVER -lt 021201 ]]; then \
5cef56
+	        $(SHELL) provider-register.sh -v -t @CIMSERVER@ -n root/PG_InterOp -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_MOFS)); \
5cef56
+	    fi \
5cef56
 	fi
5cef56
 	virsh -v | grep -q '^0.3' && cp examples/diskpool.conf $(DISK_POOL_CONFIG) || true
5cef56
 	mkdir -p $(INFO_STORE)
5cef56
@@ -220,7 +239,7 @@ preuninstall:
5cef56
 	$(SHELL) provider-register.sh -v -d -t @CIMSERVER@ -n root/interop -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_MOFS))
5cef56
 	$(SHELL) provider-register.sh -v -d -t @CIMSERVER@ -n root/cimv2 -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_MOFS))
5cef56
 	if [[ @CIMSERVER@ = pegasus ]]; then \
5cef56
-	$(SHELL) provider-register.sh -v -d -t @CIMSERVER@ -n root/PG_InterOp -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_MOFS)); \
5cef56
+	    $(SHELL) provider-register.sh -v -d -t @CIMSERVER@ -n root/PG_InterOp -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_MOFS)); \
5cef56
 	fi
5cef56
 
5cef56
 rpm: clean
5cef56
diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in
5cef56
index 24ef280..01ee329 100644
5cef56
--- a/libvirt-cim.spec.in
5cef56
+++ b/libvirt-cim.spec.in
5cef56
@@ -200,6 +200,10 @@ rm -fr $RPM_BUILD_ROOT
5cef56
     %{_datadir}/%{name}/ReferencedProfile.mof \\\
5cef56
     %{_datadir}/%{name}/AllocationCapabilities.mof
5cef56
 
5cef56
+# NOTE: As of Pegasus 2.12.1-5, using root/PG_InterOp will no longer be
5cef56
+#       valid. All mofs can just compile into root/interop.  However, we
5cef56
+#       need to keep these here for 'historical purposes'.
5cef56
+#
5cef56
 %define PGINTEROP_REG %{_datadir}/%{name}/RegisteredProfile.registration \\\
5cef56
     %{_datadir}/%{name}/ElementConformsToProfile.registration \\\
5cef56
     %{_datadir}/%{name}/ReferencedProfile.registration
5cef56
@@ -268,12 +272,12 @@ fi
5cef56
 %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
5cef56
     if [ "`systemctl is-active tog-pegasus.service 2> /dev/null`" = "active" ]
5cef56
     then
5cef56
-        systemctl restart tog-pegasus.service
5cef56
+        systemctl restart tog-pegasus.service > /dev/null 2>&1
5cef56
     fi
5cef56
 
5cef56
     if [ "`systemctl is-active sblim-sfcb.service 2> /dev/null`" = "active" ]
5cef56
     then
5cef56
-        systemctl restart sblim-sfcb.service
5cef56
+        systemctl restart sblim-sfcb.service > /dev/null 2>&1
5cef56
     fi
5cef56
 %else
5cef56
     /etc/init.d/tog-pegasus condrestart
5cef56
@@ -287,9 +291,22 @@ then
5cef56
     %{_datadir}/%{name}/provider-register.sh -t pegasus \
5cef56
         -n root/interop \
5cef56
         -r %{INTEROP_REG} -m %{INTEROP_MOF} -v >/dev/null 2>&1 || true
5cef56
-    %{_datadir}/%{name}/provider-register.sh -t pegasus \
5cef56
-        -n root/PG_InterOp \
5cef56
-        -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} -v >/dev/null 2>&1 || true
5cef56
+    #
5cef56
+    # We need to check the version - if we're not yet at 2.12.1, then
5cef56
+    # we'll register at root/PG_InterOp; otherwise, using just the above
5cef56
+    # registration should be sufficient. The actual cutoff root/PG_InterOp
5cef56
+    # not being valid was 2.12.1-5; however, --version doesn't give us that
5cef56
+    # level of detail. The Pegasus docs imply that usage of root/interop was
5cef56
+    # valid as of 2.12.0.
5cef56
+    #
5cef56
+    CIMVER=`/usr/sbin/cimserver --version | \
5cef56
+           awk -F. '{printf("%02d%02d%02d\n", $1,$2,$3); }'`
5cef56
+    if [ $CIMVER -lt 021201 ]
5cef56
+    then
5cef56
+        %{_datadir}/%{name}/provider-register.sh -t pegasus \
5cef56
+            -n root/PG_InterOp \
5cef56
+            -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} -v >/dev/null 2>&1 || true
5cef56
+    fi
5cef56
     %{_datadir}/%{name}/provider-register.sh -t pegasus \
5cef56
         -n root/cimv2\
5cef56
         -r %{CIMV2_REG} -m %{CIMV2_MOF} -v >/dev/null 2>&1 || true
5cef56
diff --git a/provider-register.sh b/provider-register.sh
5cef56
index abe8e95..f66fe54 100755
5cef56
--- a/provider-register.sh
5cef56
+++ b/provider-register.sh
5cef56
@@ -274,7 +274,23 @@ pegasus_install()
5cef56
 	chatter Registering providers with $state cimserver '('$version')'
5cef56
         chatter Installing mofs into namespace $namespace from path $mofpath
5cef56
 	$CIMMOF -uc -I $mofpath -n $namespace $mymofs &&
5cef56
-	$CIMMOF -uc -n root/PG_Interop $_REGFILENAME
5cef56
+        #
5cef56
+        # If compare_version returns false here (e.g. $version is less than
5cef56
+        # "2.12.1", then we will compile into root/PG_InterOp; otherwise,
5cef56
+        # compile into root/interop.  As of 2.12.1-5 using the PG_InterOp
5cef56
+        # will fail.  Since we cannot get that level of detail out of the
5cef56
+        # --version output, "assume" that 2.12.1 -> 2.12.1-4 will be able
5cef56
+        # to use the new namespace. The Pegasus docs imply as of 2.12.0 using
5cef56
+        # root/interop was preferred.
5cef56
+        #
5cef56
+        if compare_version "$version" "2.12.1"
5cef56
+        then
5cef56
+            chatter Installing $_REGFILENAME into root/PG_InterOp
5cef56
+	    $CIMMOF -uc -n root/PG_Interop $_REGFILENAME
5cef56
+        else
5cef56
+            chatter Installing $_REGFILENAME into root/interop
5cef56
+	    $CIMMOF -uc -n root/interop $_REGFILENAME
5cef56
+        fi
5cef56
     else
5cef56
 	echo "Failed to build pegasus registration MOF." >&2
5cef56
 	return 1
5cef56
-- 
5cef56
1.8.5.3
5cef56