[PATCH 0 of 3] Add automated base schema installation

This set adds support for automated base schema installation. This will be handy for users of the source tree, as well as required for proper installation via RPM. I have only tested with Pegasus, so sfcb testing would be appreciated. The first patch adds the schema patch and interop mof. The second adds the installation script. The third makes the required changes to the build system to fetch the CIM schema zip during build. Testing can be easily accomplished by running "make preinstall" after building. Testing of the whole process as part of the RPM install would be good too. For Pegasus, remove the entire /var/lib/Pegasus/repository/root#virt directory before testing. For SFCB, removing /usr/local/share/sfcb/CIM/* should be sufficient. After preinstall, make sure postinstall works and that the providers load and work. /

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1196962461 28800 # Node ID 0fd998389d0260fd54af8c7b9005f5a0fc402b4d # Parent 84aa3e272c6d8195ce07dd3a54bc8743fd771945 Add base schema support files for automated installation Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r 84aa3e272c6d -r 0fd998389d02 base_schema/cimv216-interop.mof --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/base_schema/cimv216-interop.mof Thu Dec 06 09:34:21 2007 -0800 @@ -0,0 +1,15 @@ +#pragma locale ("en_US") +#pragma include ("qualifiers.mof") +#pragma include ("qualifiers_optional.mof") +#pragma include ("Core/CIM_ManagedElement.mof") +#pragma include ("Core/CIM_ManagedSystemElement.mof") +#pragma include ("Core/CIM_LogicalElement.mof") +#pragma include ("Core/CIM_EnabledLogicalElement.mof") +#pragma include ("Core/CIM_System.mof") +#pragma include ("System/CIM_ComputerSystem.mof") +#pragma include ("Interop/CIM_RegisteredProfile.mof") +#pragma include ("Interop/CIM_RegisteredSubProfile.mof") +#pragma include ("Core/CIM_Dependency.mof") +#pragma include ("Interop/CIM_ElementConformsToProfile.mof") +#pragma include ("Interop/CIM_ReferencedProfile.mof") +#pragma include ("Interop/CIM_SubProfileRequiresProfile.mof") diff -r 84aa3e272c6d -r 0fd998389d02 base_schema/fix_schema.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/base_schema/fix_schema.patch Thu Dec 06 09:34:21 2007 -0800 @@ -0,0 +1,22 @@ +--- cimv216.mof 2007-08-30 16:19:12.000000000 -0700 ++++ cimv216-new.mof 2007-12-05 12:45:56.000000000 -0800 +@@ -505,7 +505,7 @@ + #pragma include ("Policy/CIM_PolicySetValidityPeriod.mof") + #pragma include ("Policy/CIM_PublicPrivateKeyAuthentication.mof") + #pragma include ("Policy/CIM_SharedSecretAuthentication.mof") +-#pragma include ("Security/CIM_SecurityIndication.mof") ++//#pragma include ("Security/CIM_SecurityIndication.mof") + #pragma include ("Support/PRS_Activity.mof") + #pragma include ("Support/PRS_ActivityResource.mof") + #pragma include ("Support/PRS_ActivityTransaction.mof") +@@ -726,8 +726,8 @@ + #pragma include ("Policy/CIM_PolicyActionStructure.mof") + #pragma include ("Policy/CIM_PolicyConditionInPolicyCondition.mof") + #pragma include ("Policy/CIM_PolicyConditionInPolicyRule.mof") +-#pragma include ("Security/CIM_IPNetworkSecurityIndication.mof") +-#pragma include ("Security/CIM_IPPacketFilterIndication.mof") ++//#pragma include ("Security/CIM_IPNetworkSecurityIndication.mof") ++//#pragma include ("Security/CIM_IPPacketFilterIndication.mof") + #pragma include ("Support/PRS_ActivityContact.mof") + #pragma include ("Support/PRS_AdminAssociation.mof") + #pragma include ("Support/PRS_AdministrativeContact.mof")

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1196962499 28800 # Node ID f19a5921a4996f3babd6ab3d4cd5b4c523da2bfd # Parent 0fd998389d0260fd54af8c7b9005f5a0fc402b4d Add base schema installation script Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r 0fd998389d02 -r f19a5921a499 base_schema/install_base_schema.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/base_schema/install_base_schema.sh Thu Dec 06 09:34:59 2007 -0800 @@ -0,0 +1,89 @@ +#!/bin/bash -x + +DATA="$1" +NS=root/virt +CIMOM=pegasus + +TMPDIR=$(mktemp -d /tmp/cim_schema.XXXXX) + +unpack_schema() { + (cd ${TMPDIR} && unzip ${DATA}/cimv*-MOFs.zip) >/dev/null 2>&1 +} + +fix_schema() { + (cd ${TMPDIR} && patch -p0 < ${DATA}/fix_schema.patch) >/dev/null 2>&1 + cp -a ${DATA}/cimv216-interop.mof ${TMPDIR} +} + +detect_peg_repo() { + dirs="$PEGASUS_HOME /var/lib/Pegasus /var/lib/pegasus /usr/local/var/lib/pegasus /var/local/lib/pegasus /var/opt/tog-pegasus" + + for d in $dirs; do + if [ -d "$d" ]; then + echo $d + return + fi + done +} + +detect_sfcb_dir() { + dirs="SFCB_DIR /usr/local/share/sfcb /usr/share/sfcb" + + for d in $dirs; do + if [ -d "$d" ]; then + echo $d; + return + fi + done +} + +install_schema_pegasus() { + local repo=$(detect_peg_repo) + + if [ -z "$repo" ]; then + echo "Unable to determine Pegasus repository path" + echo "set PEGASUS_HOME" + return + fi + + cd ${TMPDIR} + + cimmofl -uc -aEV -R$repo -n $NS cimv*.mof + cimmofl -uc -aEV -R$repo -n $NS qualifiers.mof + cimmofl -uc -aEV -R$repo -n $NS qualifiers_optional.mof + cimmofl -uc -aEV -R$repo -n /root/interop cimv*-interop.mof +} + +install_schema_sfcb() { + local dir=$(detect_sfcb_dir) + + if [ ! mkdir ${dir}/CIM ]; then + echo "Unable to determine SFCB directory" + echo "set SFCB_DIR" + return + fi + + mv ${TMPDIR}/cimv*.mof ${TMPDIR}/CIM_Schema.mof + cp -ra ${TMPDIR}/* ${dir} + sfcbrepos +} + +if [ -z "$1" ]; then + echo "Usage: $0 [source_dir]" + exit 1 +fi + +(unpack_schema) +(fix_schema) + +case "$CIMOM" in + sfcb) + (install_schema_sfcb) + ;; + pegasus) + (install_schema_pegasus) + ;; + *) + echo ERROR: Unknown CIMOM: $CIMOM + ;; +esac

DS> # HG changeset patch DS> # User Dan Smith <danms@us.ibm.com> DS> # Date 1196962499 28800 DS> # Node ID f19a5921a4996f3babd6ab3d4cd5b4c523da2bfd DS> # Parent 0fd998389d0260fd54af8c7b9005f5a0fc402b4d DS> Add base schema installation script Just noticed a couple issues here. DS> +#!/bin/bash -x This shouldn't have -x anymore. However, as complicated of an install process as this is, I think I might add a debug environment variable to enable -x and debug printing because I *know* we're going to run into issues with install. DS> + cimmofl -uc -aEV -R$repo -n $NS cimv*.mof The places where I do this fail because this matches the interop mof as well as the base one. I've fixed this and will send out an updated set. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1196962511 28800 # Node ID 81aecd2d6a83cacf8e939b3777fd159cb421ba3f # Parent f19a5921a4996f3babd6ab3d4cd5b4c523da2bfd Build support for base schema installation Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r f19a5921a499 -r 81aecd2d6a83 Makefile.am --- a/Makefile.am Thu Dec 06 09:34:59 2007 -0800 +++ b/Makefile.am Thu Dec 06 09:35:11 2007 -0800 @@ -1,5 +1,5 @@ # Copyright IBM Corp. 2007 -SUBDIRS = libxkutil src doc +SUBDIRS = libxkutil src doc base_schema MOFS = \ schema/ComputerSystem.mof \ @@ -89,6 +89,9 @@ EXTRA_DIST = schema $(pkgdata_DATA) $(pk libvirt-cim.spec.in libvirt-cim.spec \ doc/CodingStyle doc/SubmittingPatches +preinstall: + sh -x base_schema/install_base_schema.sh `pwd`/base_schema + # Un/Register the providers and class definitions from/to the current CIMOM. # @CIMSERVER@ is set by the configure script postinstall: diff -r f19a5921a499 -r 81aecd2d6a83 base_schema/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/base_schema/Makefile.am Thu Dec 06 09:35:11 2007 -0800 @@ -0,0 +1,9 @@ +CIM_SCHEMA_VER = 216 +CIM_SCHEMA_REL = $(CIM_SCHEMA_VER)Experimental +CIM_SCHEMA_ZIP = cimv$(CIM_SCHEMA_REL)-MOFs.zip + +dist_pkgdata_DATA = $(CIM_SCHEMA_ZIP) fix_schema.patch cimv216-interop.mof +dist_pkgdata_SCRIPTS = install_base_schema.sh + +$(CIM_SCHEMA_ZIP): + wget http://www.dmtf.org/standards/cim/cim_schema_v$(CIM_SCHEMA_VER)/$(CIM_SCHEMA...) \ No newline at end of file diff -r f19a5921a499 -r 81aecd2d6a83 configure.ac --- a/configure.ac Thu Dec 06 09:34:59 2007 -0800 +++ b/configure.ac Thu Dec 06 09:35:11 2007 -0800 @@ -87,6 +87,8 @@ AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bi # Autogenerate the Makefile AC_CONFIG_FILES([ + base_schema/install_base_schema.sh + base_schema/Makefile libxkutil/Makefile libxkutil/tests/Makefile src/Makefile diff -r f19a5921a499 -r 81aecd2d6a83 libvirt-cim.spec.in --- a/libvirt-cim.spec.in Thu Dec 06 09:34:59 2007 -0800 +++ b/libvirt-cim.spec.in Thu Dec 06 09:35:11 2007 -0800 @@ -55,6 +55,8 @@ rm -fr $RPM_BUILD_ROOT %post /sbin/ldconfig +%{_datadir}/%{name}/install_base_schema.sh %{_datadir}/%{name} + %{_datadir}/%{name}/provider-register.sh -t pegasus \ -n /@CIM_VIRT_NS@ \ -r %{REGISTRATION} -m %{SCHEMA} || true @@ -77,6 +79,8 @@ rm -fr $RPM_BUILD_ROOT %{_datadir}/libvirt-cim/*.sh %{_datadir}/libvirt-cim/*.mof %{_datadir}/libvirt-cim/*.registration +%{_datadir}/libvirt-cim/fix_schema.patch +%{_datadir}/libvirt-cim/cimv*-MOFs.zip %changelog * Fri Oct 26 2007 Daniel Veillard <veillard@redhat.com> - 0.1-1
participants (1)
-
Dan Smith