[tog-pegasus] Fix PG_ComputerSystem to have correct CreationClassName value

Tomas Bzatek tbzatek at fedoraproject.org
Thu Oct 24 12:39:12 UTC 2013


commit f613c7f0689231d3137fda623fc7ff1748a25767
Author: Tomas Bzatek <tbzatek at redhat.com>
Date:   Thu Oct 24 14:39:14 2013 +0200

    Fix PG_ComputerSystem to have correct CreationClassName value

 ....13.0-PG_ComputerSystem.CreationClassName.patch |  175 ++++++++++++++++++++
 tog-pegasus.spec                                   |    9 +-
 2 files changed, 183 insertions(+), 1 deletions(-)
---
diff --git a/pegasus-2.13.0-PG_ComputerSystem.CreationClassName.patch b/pegasus-2.13.0-PG_ComputerSystem.CreationClassName.patch
new file mode 100644
index 0000000..ffda224
--- /dev/null
+++ b/pegasus-2.13.0-PG_ComputerSystem.CreationClassName.patch
@@ -0,0 +1,175 @@
+Index: src/Providers/ManagedSystem/ComputerSystem/ComputerSystem.cpp
+===================================================================
+RCS file: /cvs/MSB/pegasus/src/Providers/ManagedSystem/ComputerSystem/ComputerSystem.cpp,v
+retrieving revision 1.16
+diff -u -b -w -r1.16 ComputerSystem.cpp
+--- src/Providers/ManagedSystem/ComputerSystem/ComputerSystem.cpp	16 Dec 2008 18:57:17 -0000	1.16
++++ src/Providers/ManagedSystem/ComputerSystem/ComputerSystem.cpp	16 Oct 2013 13:13:10 -0000
+@@ -27,12 +27,6 @@
+ //
+ //////////////////////////////////////////////////////////////////////////
+ //
+-// Author: Mike Brasher (mbrasher at bmc.com)
+-//
+-// Modified By: Rudy Schuet (rudy.schuet at compaq.com) 11/12/01
+-//              added nsk platform support
+-//              Sean Keenan Hewlett-Packard Company (sean.keenan at hp.com)
+-//
+ //%/////////////////////////////////////////////////////////////////////////////
+ 
+ #include "ComputerSystem.h"
+Index: src/Providers/ManagedSystem/ComputerSystem/ComputerSystemProvider.cpp
+===================================================================
+RCS file: /cvs/MSB/pegasus/src/Providers/ManagedSystem/ComputerSystem/ComputerSystemProvider.cpp,v
+retrieving revision 1.24
+diff -u -b -w -r1.24 ComputerSystemProvider.cpp
+--- src/Providers/ManagedSystem/ComputerSystem/ComputerSystemProvider.cpp	2 Dec 2008 09:02:26 -0000	1.24
++++ src/Providers/ManagedSystem/ComputerSystem/ComputerSystemProvider.cpp	16 Oct 2013 13:13:10 -0000
+@@ -37,9 +37,9 @@
+ // This provider is registered to support operations at
+ // several class levels:
+ //
+-//  CIM_ComputerSystem
+-//  CIM_UnitaryComputerSystem
+ //  <platform>_ComputerSustem
++//  CIM_UnitaryComputerSystem
++//  CIM_ComputerSystem
+ //
+ // Enumeration operations always return instances from the
+ // deepest class available.  All other
+@@ -95,17 +95,22 @@
+     String keyValue;
+ 
+     if (keys.size() != keyCount)
++    {
+         throw CIMInvalidParameterException("Wrong number of keys");
++    }
+ 
+     for (unsigned int ii = 0; ii < keys.size(); ii++)
+     {
+         keyName = keys[ii].getName();
+         keyValue = keys[ii].getValue();
+ 
++        //Put CLASS_EXTENDED_COMPUTER_SYSTEM in front CLASS_CIM_COMPUTER_SYSTEM
++        //to prefer CLASS_EXTENDED_COMPUTER_SYSTEM as class being served first
++        //followed by CLASS_CIM_UNITARY_COMPUTER_SYSTEM
+         if (keyName.equal(PROPERTY_CREATION_CLASS_NAME) &&
+-            (String::equalNoCase(keyValue,CLASS_CIM_COMPUTER_SYSTEM) ||
++            (String::equalNoCase(keyValue,CLASS_EXTENDED_COMPUTER_SYSTEM) ||
+              String::equalNoCase(keyValue,CLASS_CIM_UNITARY_COMPUTER_SYSTEM) ||
+-             String::equalNoCase(keyValue,CLASS_EXTENDED_COMPUTER_SYSTEM) ||
++             String::equalNoCase(keyValue,CLASS_CIM_COMPUTER_SYSTEM) ||
+              String::equalNoCase(keyValue,String::EMPTY)))
+         {
+             keyCount--;
+@@ -189,7 +194,7 @@
+ 
+         keys.append(CIMKeyBinding(
+             PROPERTY_CREATION_CLASS_NAME,
+-            CLASS_CIM_COMPUTER_SYSTEM,
++            CLASS_EXTENDED_COMPUTER_SYSTEM,
+             CIMKeyBinding::STRING));
+         keys.append(CIMKeyBinding(
+             PROPERTY_NAME,
+@@ -250,9 +255,9 @@
+ 
+ void ComputerSystemProvider::_checkClass(CIMName& className)
+ {
+-    if (!className.equal(CLASS_CIM_COMPUTER_SYSTEM) &&
++    if (!className.equal(CLASS_EXTENDED_COMPUTER_SYSTEM) &&
+         !className.equal(CLASS_CIM_UNITARY_COMPUTER_SYSTEM) &&
+-        !className.equal(CLASS_EXTENDED_COMPUTER_SYSTEM))
++        !className.equal(CLASS_CIM_COMPUTER_SYSTEM))
+     {
+         throw CIMNotSupportedException(String::EMPTY);
+     }
+Index: src/Providers/ManagedSystem/ComputerSystem/ComputerSystemProviderMain.cpp
+===================================================================
+RCS file: /cvs/MSB/pegasus/src/Providers/ManagedSystem/ComputerSystem/ComputerSystemProviderMain.cpp,v
+retrieving revision 1.14
+diff -u -b -w -r1.14 ComputerSystemProviderMain.cpp
+--- src/Providers/ManagedSystem/ComputerSystem/ComputerSystemProviderMain.cpp	16 Dec 2008 18:57:17 -0000	1.14
++++ src/Providers/ManagedSystem/ComputerSystem/ComputerSystemProviderMain.cpp	16 Oct 2013 13:13:10 -0000
+@@ -27,14 +27,6 @@
+ //
+ //////////////////////////////////////////////////////////////////////////
+ //
+-// Author: Christopher Neufeld <neufeld at linuxcare.com>
+-//         David Kennedy       <dkennedy at linuxcare.com>
+-//
+-// Modified By: David Kennedy       <dkennedy at linuxcare.com>
+-//              Christopher Neufeld <neufeld at linuxcare.com>
+-//              Al Stone            <ahs3 at fc.hp.com>
+-//              Mike Glantz         <michael_glantz at hp.com>
+-//
+ //%////////////////////////////////////////////////////////////////////////////
+ 
+ //
+Index: src/Providers/ManagedSystem/ComputerSystem/ComputerSystem_Linux.cpp
+===================================================================
+RCS file: /cvs/MSB/pegasus/src/Providers/ManagedSystem/ComputerSystem/ComputerSystem_Linux.cpp,v
+retrieving revision 1.24
+diff -u -b -w -r1.24 ComputerSystem_Linux.cpp
+--- src/Providers/ManagedSystem/ComputerSystem/ComputerSystem_Linux.cpp	16 Dec 2008 18:57:17 -0000	1.24
++++ src/Providers/ManagedSystem/ComputerSystem/ComputerSystem_Linux.cpp	16 Oct 2013 13:13:10 -0000
+@@ -43,8 +43,6 @@
+ PEGASUS_USING_STD;
+ PEGASUS_USING_PEGASUS;
+ 
+-static String _hostName;
+-
+ ComputerSystem::ComputerSystem()
+ {
+ }
+@@ -304,48 +302,14 @@
+ }
+ 
+ /**
+- * initialize primarily functions to initialize static global variables
+- * that will not be changed frequently. These variables are currently
+- * _hostName.
+- *
++ * This is empty as we get the hostname through
++ * System class
+  */
+ void ComputerSystem::initialize()
+ {
+-    char    hostName[PEGASUS_MAXHOSTNAMELEN + 1];
+-    struct  hostent *hostEntry;
+-
+-    if (gethostname(hostName, sizeof(hostName)) != 0)
+-    {
+-        _hostName.assign("Not initialized");
+-    }
+-    hostName[sizeof(hostName)-1] = 0;
+-
+-    // Now get the official hostname.  If this call fails then return
+-    // the value from gethostname().
+-
+-    char hostEntryBuffer[8192];
+-    struct hostent hostEntryStruct;
+-    int hostEntryErrno;
+-
+-    gethostbyname_r(
+-        hostName,
+-        &hostEntryStruct,
+-        hostEntryBuffer,
+-        sizeof(hostEntryBuffer),
+-        &hostEntry,
+-        &hostEntryErrno);
+-
+-    if (hostEntry)
+-    {
+-        _hostName.assign(hostEntry->h_name);
+-    }
+-    else
+-    {
+-        _hostName.assign(hostName);
+-    }
+ }
+ 
+ String ComputerSystem::getHostName()
+ {
+-    return _hostName;
++    return System::getFullyQualifiedHostName();
+ }
diff --git a/tog-pegasus.spec b/tog-pegasus.spec
index 1a91c4b..11058fd 100644
--- a/tog-pegasus.spec
+++ b/tog-pegasus.spec
@@ -8,7 +8,7 @@
 
 Name:           tog-pegasus
 Version:        %{major_ver}.0
-Release:        3%{?dist}
+Release:        4%{?dist}
 Epoch:          2
 Summary:        OpenPegasus WBEM Services for Linux
 
@@ -75,6 +75,9 @@ Patch25:        pegasus-2.12.0-cimmofl-allow-experimental.patch
 Patch26:        pegasus-2.12.0-schema-version-and-includes.patch
 # 27: fixes unused wariable warning which causes fail of the build
 Patch27:        pegasus-2.13.0-build-fix.patch
+# 28: PG_ComputerSystem having CreationClassName="CIM_ComputerSystem"
+# http://bugzilla.openpegasus.org/show_bug.cgi?id=9795
+Patch28:        pegasus-2.13.0-PG_ComputerSystem.CreationClassName.patch
 
 BuildRequires:  bash, sed, grep, coreutils, procps, gcc, gcc-c++
 BuildRequires:  libstdc++, make, pam-devel
@@ -208,6 +211,7 @@ yes | mak/CreateDmtfSchema 238 %{SOURCE9} cim_schema_2.38.0
 %patch25 -p1 -b .cimmofl-allow-experimental
 %patch26 -p1 -b .schema-version-and-includes
 %patch27 -p1 -b .build-fix
+%patch28 -p0 -b .PG_ComputerSystem.CreationClassName
 
 
 %build
@@ -476,6 +480,9 @@ fi
 
 
 %changelog
+* Thu Oct 24 2013 Tomas Bzatek <tbzatek at redhat.com> - 2:2.13.0-4
+- Fix PG_ComputerSystem to have correct CreationClassName value
+
 * Wed Oct 09 2013 Vitezslav Crhonek <vcrhonek at redhat.com> - 2:2.13.0-3
 - Add version to cim-server virtual provides
 


More information about the scm-commits mailing list