summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2013-03-20 13:50:42 +0100
committerMichal Minar <miminar@redhat.com>2013-03-20 13:50:42 +0100
commite3102c1da64230309d8da5f3740db9b493cb8db5 (patch)
tree698790e6bedcfb95802e355f1d21efb71b397aa0 /src
parentd0d3fb803114c070bd9b8f088025fbf7dba7fa02 (diff)
parentb5e14dcdb73d3b70131b9a602efd209488922a4e (diff)
downloadopenlmi-providers-e3102c1da64230309d8da5f3740db9b493cb8db5.tar.gz
openlmi-providers-e3102c1da64230309d8da5f3740db9b493cb8db5.tar.xz
openlmi-providers-e3102c1da64230309d8da5f3740db9b493cb8db5.zip
Merge remote-tracking branch 'origin/master' into software-smash
Conflicts: src/software/cli/software.py src/software/openlmi/__init__.py src/software/openlmi/software/LMI_HostedSoftwareIdentityResource.py src/software/openlmi/software/LMI_SoftwareFileCheck.py src/software/openlmi/software/LMI_SoftwareInstalledPackage.py src/software/openlmi/software/LMI_SoftwarePackage.py src/software/openlmi/software/__init__.py src/software/openlmi/software/cimom_entry.py src/software/openlmi/software/core/ComputerSystem.py src/software/openlmi/software/core/SoftwareFileCheck.py src/software/openlmi/software/core/SoftwareInstalledPackage.py src/software/openlmi/software/core/SoftwarePackage.py src/software/openlmi/software/core/SoftwarePackageChecks.py src/software/openlmi/software/core/__init__.py src/software/openlmi/software/util/__init__.py src/software/openlmi/software/yumdb/__init__.py src/software/openlmi/software/yumdb/errors.py src/software/openlmi/software/yumdb/jobs.py src/software/openlmi/software/yumdb/packagecheck.py src/software/openlmi/software/yumdb/packageinfo.py src/software/openlmi/software/yumdb/process.py src/software/test/base.py src/software/test/rpmcache.py src/software/test/run.py src/software/test/test_software_file_check.py src/software/test/test_software_installed_package.py src/software/test/test_software_package.py
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/account/LMI_AccountCapabilitiesProvider.c2
-rw-r--r--src/account/LMI_AccountManagementCapabilitiesProvider.c2
-rw-r--r--src/account/LMI_AccountManagementServiceCapabilitiesProvider.c2
-rw-r--r--src/account/LMI_AccountManagementServiceProvider.c2
-rw-r--r--src/account/LMI_AccountManagementServiceSettingDataProvider.c2
-rw-r--r--src/account/LMI_AccountOnSystemProvider.c2
-rw-r--r--src/account/LMI_AccountProvider.c2
-rw-r--r--src/account/LMI_AccountSettingDataProvider.c2
-rw-r--r--src/account/LMI_AssignedAccountIdentityProvider.c2
-rw-r--r--src/account/LMI_AssignedGroupIdentityProvider.c2
-rw-r--r--src/account/LMI_ElementSettingDateProvider.c2
-rw-r--r--src/account/LMI_EnabledAccountCapabilitiesProvider.c2
-rw-r--r--src/account/LMI_GroupProvider.c2
-rw-r--r--src/account/LMI_HostedAccountManagementServiceProvider.c2
-rw-r--r--src/account/LMI_IdentityProvider.c2
-rw-r--r--src/account/LMI_MemberOfGroupProvider.c2
-rw-r--r--src/account/LMI_OwningGroupProvider.c2
-rw-r--r--src/account/LMI_ServiceAffectsIdentityProvider.c2
-rw-r--r--src/account/LMI_SettingsDefineAccountCapabilitiesProvider.c2
-rw-r--r--src/account/LMI_SettingsDefineManagementCapabilitiesProvider.c2
-rw-r--r--src/account/account_globals.c2
-rw-r--r--src/account/account_globals.h2
-rw-r--r--src/account/aux_lu.c2
-rw-r--r--src/account/aux_lu.h2
-rw-r--r--src/account/cmpiLMI_Account-cimprovagt2
-rw-r--r--src/account/macros.h2
-rw-r--r--src/account/test/TestAccount.py4
-rw-r--r--src/account/test/TestGroup.py4
-rw-r--r--src/account/test/TestMemberOfGroup.py4
-rw-r--r--src/account/test/TestService.py4
-rw-r--r--src/account/test/common.py4
-rw-r--r--src/account/test/methods.py4
-rw-r--r--src/fan/LMI_FanAssociatedSensorProvider.c2
-rw-r--r--src/fan/LMI_FanProvider.c2
-rw-r--r--src/fan/LMI_FanSensorProvider.c2
-rw-r--r--src/fan/fan.c2
-rw-r--r--src/fan/fan.h2
-rw-r--r--src/globals.c2
-rw-r--r--src/globals.h2
-rw-r--r--src/hardware/CMakeLists.txt11
-rw-r--r--src/hardware/LMI_ProcessorProvider.c1153
-rw-r--r--src/hardware/cpuinfo.c145
-rw-r--r--src/hardware/cpuinfo.h54
-rw-r--r--src/hardware/dmidecode.c343
-rw-r--r--src/hardware/dmidecode.h66
-rw-r--r--src/hardware/lscpu.c151
-rw-r--r--src/hardware/lscpu.h55
-rw-r--r--src/hardware/utils.c382
-rw-r--r--src/hardware/utils.h111
-rw-r--r--src/logicalfile/CMakeLists.txt29
-rw-r--r--src/logicalfile/LMI_DataFileProvider.c147
-rw-r--r--src/logicalfile/LMI_DirectoryContainsFileProvider.c437
-rw-r--r--src/logicalfile/LMI_FIFOPipeFileProvider.c147
-rw-r--r--src/logicalfile/LMI_FileIdentityProvider.c392
-rw-r--r--src/logicalfile/LMI_RootDirectoryProvider.c344
-rw-r--r--src/logicalfile/LMI_SymbolicLinkProvider.c157
-rw-r--r--src/logicalfile/LMI_UnixDeviceFileProvider.c162
-rw-r--r--src/logicalfile/LMI_UnixDirectoryProvider.c172
-rw-r--r--src/logicalfile/LMI_UnixFileProvider.c177
-rw-r--r--src/logicalfile/LMI_UnixSocketProvider.c147
-rw-r--r--src/logicalfile/file.c102
-rw-r--r--src/logicalfile/file.h110
-rw-r--r--src/power/LMI_AssociatedPowerManagementServiceProvider.c2
-rw-r--r--src/power/LMI_ConcreteJobProvider.c2
-rw-r--r--src/power/LMI_ElementCapabilitiesProvider.c2
-rw-r--r--src/power/LMI_HostedPowerManagementServiceProvider.c2
-rw-r--r--src/power/LMI_PowerManagementCapabilitiesProvider.c2
-rw-r--r--src/power/LMI_PowerManagementServiceProvider.c2
-rw-r--r--src/power/power.c2
-rw-r--r--src/power/power.h2
-rw-r--r--src/python/openlmi/common/__init__.py2
-rw-r--r--src/python/openlmi/common/cmpi_logging.py2
-rw-r--r--src/service/LMI_ServiceProvider.c2
-rwxr-xr-xsrc/service/util/servicedisc.sh2
-rw-r--r--src/service/util/serviceutil.c3
-rw-r--r--src/service/util/serviceutil.h2
-rwxr-xr-xsrc/service/util/serviceutil.sh2
-rwxr-xr-xsrc/software/cli/software.py4
-rw-r--r--src/software/openlmi/__init__.py2
-rw-r--r--src/software/openlmi/software/LMI_HostedSoftwareCollection.py108
-rw-r--r--src/software/openlmi/software/LMI_HostedSoftwareIdentityResource.py104
-rw-r--r--src/software/openlmi/software/LMI_InstalledSoftwareIdentity.py100
-rw-r--r--src/software/openlmi/software/LMI_MemberOfSoftwareCollection.py98
-rw-r--r--src/software/openlmi/software/LMI_ResourceForSoftwareIdentity.py102
-rw-r--r--src/software/openlmi/software/LMI_SoftwareIdentity.py58
-rw-r--r--src/software/openlmi/software/LMI_SoftwareIdentityResource.py86
-rw-r--r--src/software/openlmi/software/LMI_SoftwareInstallationJob.py128
-rw-r--r--src/software/openlmi/software/LMI_SoftwareInstallationService.py262
-rw-r--r--src/software/openlmi/software/LMI_SystemSoftwareCollection.py64
-rw-r--r--src/software/openlmi/software/__init__.py2
-rw-r--r--src/software/openlmi/software/cimom_entry.py2
-rw-r--r--src/software/openlmi/software/core/ComputerSystem.py2
-rw-r--r--src/software/openlmi/software/core/Error.py2
-rw-r--r--src/software/openlmi/software/core/Identity.py62
-rw-r--r--src/software/openlmi/software/core/IdentityResource.py2
-rw-r--r--src/software/openlmi/software/core/InstallationJob.py4
-rw-r--r--src/software/openlmi/software/core/InstallationService.py4
-rw-r--r--src/software/openlmi/software/core/SystemCollection.py2
-rw-r--r--src/software/openlmi/software/core/__init__.py2
-rw-r--r--src/software/openlmi/software/util/__init__.py4
-rw-r--r--src/software/openlmi/software/util/singletonmixin.py2
-rw-r--r--src/software/openlmi/software/yumdb/__init__.py10
-rw-r--r--src/software/openlmi/software/yumdb/errors.py2
-rw-r--r--src/software/openlmi/software/yumdb/jobmanager.py2
-rw-r--r--src/software/openlmi/software/yumdb/jobs.py10
-rw-r--r--src/software/openlmi/software/yumdb/packagecheck.py2
-rw-r--r--src/software/openlmi/software/yumdb/packageinfo.py4
-rw-r--r--src/software/openlmi/software/yumdb/process.py10
-rw-r--r--src/software/openlmi/software/yumdb/repository.py4
-rw-r--r--src/software/test/base.py2
-rw-r--r--src/software/test/package.py2
-rw-r--r--src/software/test/repository.py2
-rw-r--r--src/software/test/rpmcache.py6
-rwxr-xr-xsrc/software/test/run.py2
-rwxr-xr-xsrc/software/test/test_hosted_software_collection.py2
-rwxr-xr-xsrc/software/test/test_hosted_software_identity_resource.py2
-rwxr-xr-xsrc/software/test/test_installed_software_identity.py4
-rwxr-xr-xsrc/software/test/test_member_of_software_collection.py2
-rwxr-xr-xsrc/software/test/test_resource_for_software_identity.py2
-rwxr-xr-xsrc/software/test/test_software_identity.py2
-rwxr-xr-xsrc/software/test/test_software_identity_resource.py2
-rwxr-xr-xsrc/software/test/test_system_software_collection.py2
-rw-r--r--src/software/test/util.py2
124 files changed, 5696 insertions, 707 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6d41f49..7318911 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -28,3 +28,7 @@ endif (WITH-ACCOUNT)
if (WITH-HARDWARE)
add_subdirectory(hardware)
endif (WITH-HARDWARE)
+
+if (WITH-LOGICALFILE)
+ add_subdirectory(logicalfile)
+endif (WITH-LOGICALFILE)
diff --git a/src/account/LMI_AccountCapabilitiesProvider.c b/src/account/LMI_AccountCapabilitiesProvider.c
index 60e7bb4..1636ab7 100644
--- a/src/account/LMI_AccountCapabilitiesProvider.c
+++ b/src/account/LMI_AccountCapabilitiesProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_AccountManagementCapabilitiesProvider.c b/src/account/LMI_AccountManagementCapabilitiesProvider.c
index 377790c..a4499be 100644
--- a/src/account/LMI_AccountManagementCapabilitiesProvider.c
+++ b/src/account/LMI_AccountManagementCapabilitiesProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_AccountManagementServiceCapabilitiesProvider.c b/src/account/LMI_AccountManagementServiceCapabilitiesProvider.c
index 5ac49d4..febc4f3 100644
--- a/src/account/LMI_AccountManagementServiceCapabilitiesProvider.c
+++ b/src/account/LMI_AccountManagementServiceCapabilitiesProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_AccountManagementServiceProvider.c b/src/account/LMI_AccountManagementServiceProvider.c
index d671a11..1af6cf4 100644
--- a/src/account/LMI_AccountManagementServiceProvider.c
+++ b/src/account/LMI_AccountManagementServiceProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_AccountManagementServiceSettingDataProvider.c b/src/account/LMI_AccountManagementServiceSettingDataProvider.c
index dcc3edd..89ae650 100644
--- a/src/account/LMI_AccountManagementServiceSettingDataProvider.c
+++ b/src/account/LMI_AccountManagementServiceSettingDataProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_AccountOnSystemProvider.c b/src/account/LMI_AccountOnSystemProvider.c
index d018eb2..ab84097 100644
--- a/src/account/LMI_AccountOnSystemProvider.c
+++ b/src/account/LMI_AccountOnSystemProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_AccountProvider.c b/src/account/LMI_AccountProvider.c
index 11630d0..c4a68f7 100644
--- a/src/account/LMI_AccountProvider.c
+++ b/src/account/LMI_AccountProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_AccountSettingDataProvider.c b/src/account/LMI_AccountSettingDataProvider.c
index 606ea5f..92d3b28 100644
--- a/src/account/LMI_AccountSettingDataProvider.c
+++ b/src/account/LMI_AccountSettingDataProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_AssignedAccountIdentityProvider.c b/src/account/LMI_AssignedAccountIdentityProvider.c
index e8f15cf..323a582 100644
--- a/src/account/LMI_AssignedAccountIdentityProvider.c
+++ b/src/account/LMI_AssignedAccountIdentityProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_AssignedGroupIdentityProvider.c b/src/account/LMI_AssignedGroupIdentityProvider.c
index 09ed28b..a9037f1 100644
--- a/src/account/LMI_AssignedGroupIdentityProvider.c
+++ b/src/account/LMI_AssignedGroupIdentityProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_ElementSettingDateProvider.c b/src/account/LMI_ElementSettingDateProvider.c
index 6750ccf..9e0ea9d 100644
--- a/src/account/LMI_ElementSettingDateProvider.c
+++ b/src/account/LMI_ElementSettingDateProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_EnabledAccountCapabilitiesProvider.c b/src/account/LMI_EnabledAccountCapabilitiesProvider.c
index 6d4cf77..7cda823 100644
--- a/src/account/LMI_EnabledAccountCapabilitiesProvider.c
+++ b/src/account/LMI_EnabledAccountCapabilitiesProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_GroupProvider.c b/src/account/LMI_GroupProvider.c
index 4224abc..a9c5477 100644
--- a/src/account/LMI_GroupProvider.c
+++ b/src/account/LMI_GroupProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_HostedAccountManagementServiceProvider.c b/src/account/LMI_HostedAccountManagementServiceProvider.c
index c173930..dd03a5f 100644
--- a/src/account/LMI_HostedAccountManagementServiceProvider.c
+++ b/src/account/LMI_HostedAccountManagementServiceProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_IdentityProvider.c b/src/account/LMI_IdentityProvider.c
index ba70bf8..92c2b01 100644
--- a/src/account/LMI_IdentityProvider.c
+++ b/src/account/LMI_IdentityProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_MemberOfGroupProvider.c b/src/account/LMI_MemberOfGroupProvider.c
index 2609e7a..dddd2e8 100644
--- a/src/account/LMI_MemberOfGroupProvider.c
+++ b/src/account/LMI_MemberOfGroupProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_OwningGroupProvider.c b/src/account/LMI_OwningGroupProvider.c
index f5cec0a..317b7b4 100644
--- a/src/account/LMI_OwningGroupProvider.c
+++ b/src/account/LMI_OwningGroupProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_ServiceAffectsIdentityProvider.c b/src/account/LMI_ServiceAffectsIdentityProvider.c
index e682fb1..64e218b 100644
--- a/src/account/LMI_ServiceAffectsIdentityProvider.c
+++ b/src/account/LMI_ServiceAffectsIdentityProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_SettingsDefineAccountCapabilitiesProvider.c b/src/account/LMI_SettingsDefineAccountCapabilitiesProvider.c
index eb35202..05e952f 100644
--- a/src/account/LMI_SettingsDefineAccountCapabilitiesProvider.c
+++ b/src/account/LMI_SettingsDefineAccountCapabilitiesProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/LMI_SettingsDefineManagementCapabilitiesProvider.c b/src/account/LMI_SettingsDefineManagementCapabilitiesProvider.c
index 9c8c76a..c0db7a5 100644
--- a/src/account/LMI_SettingsDefineManagementCapabilitiesProvider.c
+++ b/src/account/LMI_SettingsDefineManagementCapabilitiesProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/account_globals.c b/src/account/account_globals.c
index 1a7f8b2..e5e90e0 100644
--- a/src/account/account_globals.c
+++ b/src/account/account_globals.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/account_globals.h b/src/account/account_globals.h
index ddc9561..4226b33 100644
--- a/src/account/account_globals.h
+++ b/src/account/account_globals.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/aux_lu.c b/src/account/aux_lu.c
index d5b969c..6059665 100644
--- a/src/account/aux_lu.c
+++ b/src/account/aux_lu.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/aux_lu.h b/src/account/aux_lu.h
index 2e774ff..91383d4 100644
--- a/src/account/aux_lu.h
+++ b/src/account/aux_lu.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/cmpiLMI_Account-cimprovagt b/src/account/cmpiLMI_Account-cimprovagt
index b31d665..c2024d1 100644
--- a/src/account/cmpiLMI_Account-cimprovagt
+++ b/src/account/cmpiLMI_Account-cimprovagt
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/macros.h b/src/account/macros.h
index 2c89555..513d472 100644
--- a/src/account/macros.h
+++ b/src/account/macros.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/account/test/TestAccount.py b/src/account/test/TestAccount.py
index 7157b52..57925f0 100644
--- a/src/account/test/TestAccount.py
+++ b/src/account/test/TestAccount.py
@@ -1,5 +1,5 @@
# -*- encoding: utf-8 -*-
-# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -15,7 +15,7 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
-# Authors: Roman Rakus <rrakus@redhat.com
+# Authors: Roman Rakus <rrakus@redhat.com>
#
from common import AccountBase
diff --git a/src/account/test/TestGroup.py b/src/account/test/TestGroup.py
index 2cf5228..3111610 100644
--- a/src/account/test/TestGroup.py
+++ b/src/account/test/TestGroup.py
@@ -1,5 +1,5 @@
# -*- encoding: utf-8 -*-
-# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -15,7 +15,7 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
-# Authors: Roman Rakus <rrakus@redhat.com
+# Authors: Roman Rakus <rrakus@redhat.com>
#
from common import AccountBase
diff --git a/src/account/test/TestMemberOfGroup.py b/src/account/test/TestMemberOfGroup.py
index 19071ef..2186db3 100644
--- a/src/account/test/TestMemberOfGroup.py
+++ b/src/account/test/TestMemberOfGroup.py
@@ -1,5 +1,5 @@
# -*- encoding: utf-8 -*-
-# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -15,7 +15,7 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
-# Authors: Roman Rakus <rrakus@redhat.com
+# Authors: Roman Rakus <rrakus@redhat.com>
#
from common import AccountBase
diff --git a/src/account/test/TestService.py b/src/account/test/TestService.py
index 08a47ee..5b45b38 100644
--- a/src/account/test/TestService.py
+++ b/src/account/test/TestService.py
@@ -1,5 +1,5 @@
# -*- encoding: utf-8 -*-
-# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -15,7 +15,7 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
-# Authors: Roman Rakus <rrakus@redhat.com
+# Authors: Roman Rakus <rrakus@redhat.com>
#
from common import AccountBase
diff --git a/src/account/test/common.py b/src/account/test/common.py
index 2ffbbcf..c56e94d 100644
--- a/src/account/test/common.py
+++ b/src/account/test/common.py
@@ -1,5 +1,5 @@
# -*- encoding: utf-8 -*-
-# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -15,7 +15,7 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
-# Authors: Roman Rakus <rrakus@redhat.com
+# Authors: Roman Rakus <rrakus@redhat.com>
#
import pywbem
diff --git a/src/account/test/methods.py b/src/account/test/methods.py
index b40859f..c0407df 100644
--- a/src/account/test/methods.py
+++ b/src/account/test/methods.py
@@ -1,5 +1,5 @@
# -*- encoding: utf-8 -*-
-# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -15,7 +15,7 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
-# Authors: Roman Rakus <rrakus@redhat.com
+# Authors: Roman Rakus <rrakus@redhat.com>
#
import subprocess
diff --git a/src/fan/LMI_FanAssociatedSensorProvider.c b/src/fan/LMI_FanAssociatedSensorProvider.c
index 5b5f5d5..d75bf5c 100644
--- a/src/fan/LMI_FanAssociatedSensorProvider.c
+++ b/src/fan/LMI_FanAssociatedSensorProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/src/fan/LMI_FanProvider.c b/src/fan/LMI_FanProvider.c
index 1e96f97..26af16e 100644
--- a/src/fan/LMI_FanProvider.c
+++ b/src/fan/LMI_FanProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/fan/LMI_FanSensorProvider.c b/src/fan/LMI_FanSensorProvider.c
index 8e79208..47bd9d5 100644
--- a/src/fan/LMI_FanSensorProvider.c
+++ b/src/fan/LMI_FanSensorProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/fan/fan.c b/src/fan/fan.c
index 1a988f2..3038503 100644
--- a/src/fan/fan.c
+++ b/src/fan/fan.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/fan/fan.h b/src/fan/fan.h
index 00d0e84..02c6c5c 100644
--- a/src/fan/fan.h
+++ b/src/fan/fan.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/globals.c b/src/globals.c
index 21ab375..7e58817 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/globals.h b/src/globals.h
index 0c20d4b..6cf272c 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/hardware/CMakeLists.txt b/src/hardware/CMakeLists.txt
index 27e8df2..ebf79fb 100644
--- a/src/hardware/CMakeLists.txt
+++ b/src/hardware/CMakeLists.txt
@@ -1,11 +1,14 @@
-
set(PROVIDER_NAME Hardware)
set(LIBRARY_NAME cmpiLMI_${PROVIDER_NAME})
set(MOF LMI_Hardware.mof)
-#set(provider_SRCS
-# util/serviceutil.c
-#)
+set(provider_SRCS
+ utils.c
+ dmidecode.c
+ lscpu.c
+ cpuinfo.c
+ LMI_ProcessorProvider.c
+)
konkretcmpi_generate(${MOF}
CIM_PROVIDERS
diff --git a/src/hardware/LMI_ProcessorProvider.c b/src/hardware/LMI_ProcessorProvider.c
new file mode 100644
index 0000000..8e92fdd
--- /dev/null
+++ b/src/hardware/LMI_ProcessorProvider.c
@@ -0,0 +1,1153 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Peter Schiffer <pschiffe@redhat.com>
+ */
+
+#include <konkret/konkret.h>
+#include <sys/utsname.h>
+#include <string.h>
+#include "LMI_Processor.h"
+#include "globals.h"
+#include "dmidecode.h"
+#include "lscpu.h"
+#include "cpuinfo.h"
+
+CMPIUint16 get_family(const char *family);
+CMPIUint16 get_cpustatus(const char *status);
+CMPIUint16 get_enabledstate(const CMPIUint16 status);
+CMPIUint16 get_upgrade_method(const char *dmi_upgrade);
+CMPIUint16 get_characteristic(const char *dmi_charact);
+CMPIUint16 get_flag(const char *flag, short *stat);
+
+static const CMPIBroker* _cb = NULL;
+
+static void LMI_ProcessorInitialize()
+{
+}
+
+static CMPIStatus LMI_ProcessorCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_ProcessorEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ return KDefaultEnumerateInstanceNames(
+ _cb, mi, cc, cr, cop);
+}
+
+static CMPIStatus LMI_ProcessorEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ LMI_Processor lmi_cpu;
+ const char *ns = KNameSpace(cop);
+ CMPICount count;
+ CMPIUint16 cpustatus, enabledstate, family, charact, enabled_cores;
+ CMPIUint32 current_speed = 0, max_speed = 0, external_clock = 0;
+ unsigned i, j, cpus_nb = 0;
+ char *other_family = NULL, *architecture = NULL, *cpu_id = NULL,
+ *cpu_name = NULL, *stepping = NULL, *error_msg = NULL;
+ struct utsname utsname_buf;
+ DmiProcessor *dmi_cpus;
+ unsigned dmi_cpus_nb;
+ LscpuProcessor lscpu;
+ CpuinfoProcessor proc_cpu;
+
+ if (dmi_get_processors(&dmi_cpus, &dmi_cpus_nb) != 0 || dmi_cpus_nb < 1) {
+ dmi_free_processors(&dmi_cpus, &dmi_cpus_nb);
+ }
+
+ if (lscpu_get_processor(&lscpu) != 0) {
+ error_msg = "Unable to get processor information.";
+ goto done;
+ }
+
+ if (cpuinfo_get_processor(&proc_cpu) != 0) {
+ error_msg = "Unable to get processor information.";
+ goto done;
+ }
+
+ if (uname(&utsname_buf) == 0) {
+ architecture = strdup(utsname_buf.machine);
+ if (!architecture) {
+ error_msg = "Not enough available memory.";
+ goto done;
+ }
+ }
+
+ if (dmi_cpus_nb > 0) {
+ cpus_nb = dmi_cpus_nb;
+ } else if (lscpu.processors > 0) {
+ cpus_nb = lscpu.processors;
+ } else {
+ error_msg = "Unable to get processor information.";
+ goto done;
+ }
+
+ for (i = 0; i < cpus_nb; i++) {
+ LMI_Processor_Init(&lmi_cpu, _cb, ns);
+
+ LMI_Processor_Set_SystemCreationClassName(&lmi_cpu,
+ get_system_creation_class_name());
+ LMI_Processor_Set_SystemName(&lmi_cpu, get_system_name());
+ LMI_Processor_Set_CreationClassName(&lmi_cpu, "LMI_Processor");
+ LMI_Processor_Set_Caption(&lmi_cpu, "Processor");
+ LMI_Processor_Set_Description(&lmi_cpu,
+ "This object represents one processor in system.");
+
+ /* do we have output from dmidecode program? */
+ if (dmi_cpus_nb > 0) {
+ family = get_family(dmi_cpus[i].family);
+ if (family == 1) {
+ other_family = dmi_cpus[i].family;
+ }
+ cpustatus = get_cpustatus(dmi_cpus[i].status);
+ enabledstate = get_enabledstate(cpustatus);
+ if (enabledstate == 2) {
+ current_speed = dmi_cpus[i].current_speed;
+ max_speed = dmi_cpus[i].max_speed;
+ external_clock = dmi_cpus[i].external_clock;
+ }
+ cpu_name = dmi_cpus[i].name;
+ enabled_cores = dmi_cpus[i].enabled_cores;
+ stepping = dmi_cpus[i].stepping;
+
+ LMI_Processor_Set_DeviceID(&lmi_cpu, dmi_cpus[i].id);
+ LMI_Processor_Set_Family(&lmi_cpu, family);
+ LMI_Processor_Set_OtherFamilyDescription(&lmi_cpu, other_family);
+ LMI_Processor_Set_UpgradeMethod(&lmi_cpu,
+ get_upgrade_method(dmi_cpus[i].upgrade));
+ if (dmi_cpus[i].type && strlen(dmi_cpus[i].type)) {
+ LMI_Processor_Set_Role(&lmi_cpu, dmi_cpus[i].type);
+ }
+ /* CPU Characteristics */
+ if (dmi_cpus[i].charact_nb > 0) {
+ count = 0;
+ LMI_Processor_Init_Characteristics(&lmi_cpu,
+ dmi_cpus[i].charact_nb);
+ LMI_Processor_Init_EnabledProcessorCharacteristics(&lmi_cpu,
+ dmi_cpus[i].charact_nb);
+ for (j = 0; j < dmi_cpus[i].charact_nb; j++) {
+ charact = get_characteristic(
+ dmi_cpus[i].characteristics[j]);
+ if (charact) {
+ LMI_Processor_Set_Characteristics(&lmi_cpu, count,
+ charact);
+ LMI_Processor_Set_EnabledProcessorCharacteristics(
+ &lmi_cpu, count, 0);
+ count++;
+ }
+ }
+ }
+ } else {
+ cpu_id = (char *)malloc(10 * sizeof(char));
+ if (!cpu_id) {
+ error_msg = "Not enough available memory.";
+ goto done;
+ }
+ snprintf(cpu_id, 10, "%u", i);
+ LMI_Processor_Set_DeviceID(&lmi_cpu, cpu_id);
+ free(cpu_id);
+ cpu_id = NULL;
+
+ cpustatus = get_cpustatus("Enabled");
+ enabledstate = get_enabledstate(cpustatus);
+ if (enabledstate == 2) {
+ current_speed = lscpu.current_speed;
+ }
+
+ cpu_name = proc_cpu.model_name;
+ enabled_cores = lscpu.cores;
+ stepping = lscpu.stepping;
+ }
+
+ LMI_Processor_Set_CPUStatus(&lmi_cpu, cpustatus);
+ LMI_Processor_Set_EnabledState(&lmi_cpu, enabledstate);
+ LMI_Processor_Set_NumberOfEnabledCores(&lmi_cpu, enabled_cores);
+ if (current_speed) {
+ LMI_Processor_Set_CurrentClockSpeed(&lmi_cpu, current_speed);
+ }
+ if (max_speed) {
+ LMI_Processor_Set_MaxClockSpeed(&lmi_cpu, max_speed);
+ }
+ if (external_clock) {
+ LMI_Processor_Set_ExternalBusClockSpeed(&lmi_cpu, external_clock);
+ }
+ if (cpu_name && strlen(cpu_name)) {
+ LMI_Processor_Set_Name(&lmi_cpu, cpu_name);
+ LMI_Processor_Set_UniqueID(&lmi_cpu, cpu_name);
+ LMI_Processor_Set_ElementName(&lmi_cpu, cpu_name);
+ }
+ if (stepping && strlen(stepping)) {
+ LMI_Processor_Set_Stepping(&lmi_cpu, stepping);
+ }
+ if (lscpu.data_width) {
+ LMI_Processor_Set_DataWidth(&lmi_cpu, lscpu.data_width);
+ }
+ /* CPU Flags */
+ if (proc_cpu.flags_nb > 0) {
+ short stat = -1;
+ CMPIUint16 flag;
+ LMI_Processor_Init_Flags(&lmi_cpu, proc_cpu.flags_nb);
+ count = 0;
+ for (j = 0; j < proc_cpu.flags_nb; j++) {
+ flag = get_flag(proc_cpu.flags[j], &stat);
+ if (stat == 0) {
+ LMI_Processor_Set_Flags(&lmi_cpu, count, flag);
+ count++;
+ }
+ }
+ }
+ if (proc_cpu.address_size) {
+ LMI_Processor_Set_AddressWidth(&lmi_cpu, proc_cpu.address_size);
+ }
+ if (architecture && strlen(architecture)) {
+ LMI_Processor_Set_Architecture(&lmi_cpu, architecture);
+ }
+
+ KReturnInstance(cr, lmi_cpu);
+ }
+
+done:
+ if (architecture) {
+ free(architecture);
+ }
+ architecture = NULL;
+
+ dmi_free_processors(&dmi_cpus, &dmi_cpus_nb);
+ lscpu_free_processor(&lscpu);
+ cpuinfo_free_processor(&proc_cpu);
+
+ if (error_msg) {
+ KReturn2(_cb, ERR_FAILED, error_msg);
+ }
+
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_ProcessorGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ return KDefaultGetInstance(
+ _cb, mi, cc, cr, cop, properties);
+}
+
+static CMPIStatus LMI_ProcessorCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_ProcessorModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_ProcessorDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_ProcessorExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+CMInstanceMIStub(
+ LMI_Processor,
+ LMI_Processor,
+ _cb,
+ LMI_ProcessorInitialize())
+
+static CMPIStatus LMI_ProcessorMethodCleanup(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_ProcessorInvokeMethod(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* meth,
+ const CMPIArgs* in,
+ CMPIArgs* out)
+{
+ return LMI_Processor_DispatchMethod(
+ _cb, mi, cc, cr, cop, meth, in, out);
+}
+
+CMMethodMIStub(
+ LMI_Processor,
+ LMI_Processor,
+ _cb,
+ LMI_ProcessorInitialize())
+
+KUint32 LMI_Processor_RequestStateChange(
+ const CMPIBroker* cb,
+ CMPIMethodMI* mi,
+ const CMPIContext* context,
+ const LMI_ProcessorRef* self,
+ const KUint16* RequestedState,
+ KRef* Job,
+ const KDateTime* TimeoutPeriod,
+ CMPIStatus* status)
+{
+ KUint32 result = KUINT32_INIT;
+
+ KSetStatus(status, ERR_NOT_SUPPORTED);
+ return result;
+}
+
+KUint32 LMI_Processor_SetPowerState(
+ const CMPIBroker* cb,
+ CMPIMethodMI* mi,
+ const CMPIContext* context,
+ const LMI_ProcessorRef* self,
+ const KUint16* PowerState,
+ const KDateTime* Time,
+ CMPIStatus* status)
+{
+ KUint32 result = KUINT32_INIT;
+
+ KSetStatus(status, ERR_NOT_SUPPORTED);
+ return result;
+}
+
+KUint32 LMI_Processor_Reset(
+ const CMPIBroker* cb,
+ CMPIMethodMI* mi,
+ const CMPIContext* context,
+ const LMI_ProcessorRef* self,
+ CMPIStatus* status)
+{
+ KUint32 result = KUINT32_INIT;
+
+ KSetStatus(status, ERR_NOT_SUPPORTED);
+ return result;
+}
+
+KUint32 LMI_Processor_EnableDevice(
+ const CMPIBroker* cb,
+ CMPIMethodMI* mi,
+ const CMPIContext* context,
+ const LMI_ProcessorRef* self,
+ const KBoolean* Enabled,
+ CMPIStatus* status)
+{
+ KUint32 result = KUINT32_INIT;
+
+ KSetStatus(status, ERR_NOT_SUPPORTED);
+ return result;
+}
+
+KUint32 LMI_Processor_OnlineDevice(
+ const CMPIBroker* cb,
+ CMPIMethodMI* mi,
+ const CMPIContext* context,
+ const LMI_ProcessorRef* self,
+ const KBoolean* Online,
+ CMPIStatus* status)
+{
+ KUint32 result = KUINT32_INIT;
+
+ KSetStatus(status, ERR_NOT_SUPPORTED);
+ return result;
+}
+
+KUint32 LMI_Processor_QuiesceDevice(
+ const CMPIBroker* cb,
+ CMPIMethodMI* mi,
+ const CMPIContext* context,
+ const LMI_ProcessorRef* self,
+ const KBoolean* Quiesce,
+ CMPIStatus* status)
+{
+ KUint32 result = KUINT32_INIT;
+
+ KSetStatus(status, ERR_NOT_SUPPORTED);
+ return result;
+}
+
+KUint32 LMI_Processor_SaveProperties(
+ const CMPIBroker* cb,
+ CMPIMethodMI* mi,
+ const CMPIContext* context,
+ const LMI_ProcessorRef* self,
+ CMPIStatus* status)
+{
+ KUint32 result = KUINT32_INIT;
+
+ KSetStatus(status, ERR_NOT_SUPPORTED);
+ return result;
+}
+
+KUint32 LMI_Processor_RestoreProperties(
+ const CMPIBroker* cb,
+ CMPIMethodMI* mi,
+ const CMPIContext* context,
+ const LMI_ProcessorRef* self,
+ CMPIStatus* status)
+{
+ KUint32 result = KUINT32_INIT;
+
+ KSetStatus(status, ERR_NOT_SUPPORTED);
+ return result;
+}
+
+/*
+ * Get CPU status according to the dmidecode.
+ * @param status from dmidecode
+ * @return CIM id of CPU status
+ */
+CMPIUint16 get_cpustatus(const char *status)
+{
+ if (!status) {
+ return 0; /* Unknown */
+ }
+
+ static struct {
+ CMPIUint16 val; /* CIM value */
+ char *stat; /* dmidecode status */
+ } statuses[] = {
+ {0, "Unknown"},
+ {1, "Enabled"},
+ {2, "Disabled By User"},
+ {3, "Disabled By BIOS"},
+ {4, "Idle"},
+ };
+
+ size_t i, st_length = sizeof(statuses) / sizeof(statuses[0]);
+
+ for (i = 0; i < st_length; i++) {
+ if (strcmp(status, statuses[i].stat) == 0) {
+ return statuses[i].val;
+ }
+ }
+
+ return 0; /* Unknown */
+}
+
+/*
+ * Get enabled state according to the cpu status.
+ * @param status by CIM
+ * @return CIM id of enabled state
+ */
+CMPIUint16 get_enabledstate(const CMPIUint16 status)
+{
+ static struct {
+ CMPIUint16 cpustatus; /* CIM cpu status */
+ CMPIUint16 enabledstate; /* CIM enabled state */
+ } statuses[] = {
+ {0, 0},
+ {1, 2},
+ {2, 3},
+ {3, 3},
+ {4, 2},
+ };
+
+ size_t i, st_length = sizeof(statuses) / sizeof(statuses[0]);
+
+ for (i = 0; i < st_length; i++) {
+ if (status == statuses[i].cpustatus) {
+ return statuses[i].enabledstate;
+ }
+ }
+
+ return 0; /* Unknown */
+}
+
+/*
+ * Get CPU characteristics according to the dmidecode output.
+ * @param dmi_charact characteristics from dmidecode
+ * @return characteristic defined by CIM
+ */
+CMPIUint16 get_characteristic(const char *dmi_charact)
+{
+ if (!dmi_charact) {
+ return 0; /* Unknown */
+ }
+
+ /* CIM characteristics based on
+ cim_schema_2.35.0Final-MOFs/Device/CIM_Processor.mof */
+ /* Dmidecode characts based on dmidecode 2.11 */
+ static struct {
+ CMPIUint16 value_map; /* ValueMap defined by CIM */
+ char *value; /* Value defined by CIM (just for reference) */
+ char *search; /* String used to match the dmidecode charact */
+ } characts[] = {
+ /*
+ {0, "Unknown", ""},
+ {1, "DMTF Reserved", ""},
+ */
+ {2, "64-bit Capable", "64-bit capable"},
+ /*
+ {3, "32-bit Capable", ""},
+ */
+ {4, "Enhanced Virtualization", "Enhanced Virtualization"},
+ {5, "Hardware Thread", "Hardware Thread"},
+ {6, "NX-bit", "Execute Protection"},
+ {7, "Power/Performance Control", "Power/Performance Control"},
+ /*
+ {8, "Core Frequency Boosting", ""},
+ */
+ {32568, "Multi-Core", "Multi-Core"},
+ };
+
+ size_t i, characts_length = sizeof(characts) / sizeof(characts[0]);
+
+ for (i = 0; i < characts_length; i++) {
+ if (strcmp(dmi_charact, characts[i].search) == 0) {
+ return characts[i].value_map;
+ }
+ }
+
+ return 0; /* Unknown */
+}
+
+/*
+ * Get CPU upgrade method according to the dmidecode upgrade.
+ * @param dmi_upgrade socket string from dmidecode program
+ * @return upgrade method id defined by CIM
+ */
+CMPIUint16 get_upgrade_method(const char *dmi_upgrade)
+{
+ if (!dmi_upgrade) {
+ return 2; /* Unknown */
+ }
+
+ /* CIM upgrade method based on
+ cim_schema_2.35.0Final-MOFs/Device/CIM_Processor.mof */
+ /* Dmidecode upgrade based on dmidecode 2.11 */
+ static struct {
+ CMPIUint16 value_map; /* ValueMap defined by CIM */
+ char *value; /* Value defined by CIM (just for reference) */
+ char *search; /* String used to match the dmidecode upgrade */
+ } sockets[] = {
+ {1, "Other", "Other"},
+ {2, "Unknown", "Unknown"},
+ {3, "Daughter Board", "Daughter Board"},
+ {4, "ZIF Socket", "ZIF Socket"},
+ {5, "Replacement/Piggy Back", "Replaceable Piggy Back"},
+ {6, "None", "None"},
+ {7, "LIF Socket", "LIF Socket"},
+ {8, "Slot 1", "Slot 1"},
+ {9, "Slot 2", "Slot 2"},
+ {10, "370 Pin Socket", "370-pin Socket"},
+ {11, "Slot A", "Slot A"},
+ {12, "Slot M", "Slot M"},
+ {13, "Socket 423", "Socket 423"},
+ {14, "Socket A (Socket 462)", "Socket A (Socket 462)"},
+ {15, "Socket 478", "Socket 478"},
+ {16, "Socket 754", "Socket 754"},
+ {17, "Socket 940", "Socket 940"},
+ {18, "Socket 939", "Socket 939"},
+ {19, "Socket mPGA604", "Socket mPGA604"},
+ {20, "Socket LGA771", "Socket LGA771"},
+ {21, "Socket LGA775", "Socket LGA775"},
+ {22, "Socket S1", "Socket S1"},
+ {23, "Socket AM2", "Socket AM2"},
+ {24, "Socket F (1207)", "Socket F (1207)"},
+ {25, "Socket LGA1366", "Socket LGA1366"},
+ {26, "Socket G34", "Socket G34"},
+ {27, "Socket AM3", "Socket AM3"},
+ {28, "Socket C32", "Socket C32"},
+ {29, "Socket LGA1156", "Socket LGA1156"},
+ {30, "Socket LGA1567", "Socket LGA1567"},
+ {31, "Socket PGA988A", "Socket PGA988A"},
+ {32, "Socket BGA1288", "Socket BGA1288"},
+ {33, "rPGA988B", "Socket rPGA988B"},
+ {34, "BGA1023", "Socket BGA1023"},
+ {35, "BGA1224", "Socket BGA1024"},
+ {36, "LGA1155", "Socket BGA1155"},
+ {37, "LGA1356", "Socket LGA1356"},
+ {38, "LGA2011", "Socket LGA2011"},
+ {39, "Socket FS1", "Socket FS1"},
+ {40, "Socket FS2", "Socket FS2"},
+ {41, "Socket FM1", "Socket FM1"},
+ {42, "Socket FM2", "Socket FM2"},
+ /*
+ {43, "Socket LGA2011-3", ""},
+ {44, "Socket LGA1356-3", ""},
+ */
+ };
+
+ size_t i, sockets_length = sizeof(sockets) / sizeof(sockets[0]);
+
+ for (i = 0; i < sockets_length; i++) {
+ if (strcmp(dmi_upgrade, sockets[i].search) == 0) {
+ return sockets[i].value_map;
+ }
+ }
+
+ return 1; /* Other */
+}
+
+/*
+ * Get CPU flag id.
+ * @param flag from /proc/cpuinfo file
+ * @param stat 0 if flag found, negative value otherwise
+ * @return CIM id of flag
+ */
+CMPIUint16 get_flag(const char *flag, short *stat)
+{
+ if (!flag) {
+ *stat = -1;
+ return 0;
+ }
+
+ /* Flag IDs and names are based on:
+ linux-3.8/arch/x86/include/asm/cpufeature.h */
+ static struct {
+ CMPIUint16 val; /* CIM value */
+ char *flag; /* flag name */
+ } flags[] = {
+ /* 0*32 */
+ {0, "fpu"},
+ {1, "vme"},
+ {2, "de"},
+ {3, "pse"},
+ {4, "tsc"},
+ {5, "msr"},
+ {6, "pae"},
+ {7, "mce"},
+ {8, "cx8"},
+ {9, "apic"},
+ {11, "sep"},
+ {12, "mtrr"},
+ {13, "pge"},
+ {14, "mca"},
+ {15, "cmov"},
+ {16, "pat"},
+ {17, "pse36"},
+ {18, "pn"},
+ {19, "clflush"},
+ {21, "dts"},
+ {22, "acpi"},
+ {23, "mmx"},
+ {24, "fxsr"},
+ {25, "sse"},
+ {26, "sse2"},
+ {27, "ss"},
+ {28, "ht"},
+ {29, "tm"},
+ {30, "ia64"},
+ {31, "pbe"},
+ /* 1*32 */
+ {43, "syscall"},
+ {51, "mp"},
+ {52, "nx"},
+ {54, "mmxext"},
+ {57, "fxsr_opt"},
+ {58, "pdpe1gb"},
+ {59, "rdtscp"},
+ {61, "lm"},
+ {62, "3dnowext"},
+ {63, "3dnow"},
+ /* 2*32 */
+ {64, "recovery"},
+ {65, "longrun"},
+ {67, "lrti"},
+ /* 3*32 */
+ {96, "cxmmx"},
+ {97, "k6_mtrr"},
+ {98, "cyrix_arr"},
+ {99, "centaur_mcr"},
+ {100, "k8"},
+ {101, "k7"},
+ {102, "p3"},
+ {103, "p4"},
+ {104, "constant_tsc"},
+ {105, "up"},
+ {106, "fxsave_leak"},
+ {107, "arch_perfmon"},
+ {108, "pebs"},
+ {109, "bts"},
+ {110, "syscall32"},
+ {111, "sysenter32"},
+ {112, "rep_good"},
+ {113, "mfence_rdtsc"},
+ {114, "lfence_rdtsc"},
+ {115, "11ap"},
+ {116, "nopl"},
+ {118, "xtopology"},
+ {119, "tsc_reliable"},
+ {120, "nonstop_tsc"},
+ {121, "clflush_monitor"},
+ {122, "extd_apicid"},
+ {123, "amd_dcm"},
+ {124, "aperfmperf"},
+ {125, "eagerfpu"},
+ /* 4*32 */
+ {128, "pni"},
+ {129, "pclmulqdq"},
+ {130, "dtes64"},
+ {131, "monitor"},
+ {132, "ds_cpl"},
+ {133, "vmx"},
+ {134, "smx"},
+ {135, "est"},
+ {136, "tm2"},
+ {137, "ssse3"},
+ {138, "cid"},
+ {140, "fma"},
+ {141, "cx16"},
+ {142, "xtpr"},
+ {143, "pdcm"},
+ {145, "pcid"},
+ {146, "dca"},
+ {147, "sse4_1"},
+ {148, "sse4_2"},
+ {149, "x2apic"},
+ {150, "movbe"},
+ {151, "popcnt"},
+ {152, "tsc_deadline_timer"},
+ {153, "aes"},
+ {154, "xsave"},
+ {155, "osxsave"},
+ {156, "avx"},
+ {157, "f16c"},
+ {158, "rdrand"},
+ {159, "hypervisor"},
+ /* 5*32*/
+ {162, "rng"},
+ {163, "rng_en"},
+ {166, "ace"},
+ {167, "ace_en"},
+ {168, "ace2"},
+ {169, "ace2_en"},
+ {170, "phe"},
+ {171, "phe_en"},
+ {172, "pmm"},
+ {173, "pmm_en"},
+ /* 6*32 */
+ {192, "lahf_lm"},
+ {193, "cmp_legacy"},
+ {194, "svm"},
+ {195, "extapic"},
+ {196, "cr8_legacy"},
+ {197, "abm"},
+ {198, "sse4a"},
+ {199, "misalignsse"},
+ {200, "3dnowprefetch"},
+ {201, "osvw"},
+ {202, "ibs"},
+ {203, "xop"},
+ {204, "skinit"},
+ {205, "wdt"},
+ {207, "lwp"},
+ {208, "fma4"},
+ {209, "tce"},
+ {211, "nodeid_msr"},
+ {213, "tbm"},
+ {214, "topoext"},
+ {215, "perfctr_core"},
+ /* 7*32 */
+ {224, "ida"},
+ {225, "arat"},
+ {226, "cpb"},
+ {227, "epb"},
+ {228, "xsaveopt"},
+ {229, "pln"},
+ {230, "pts"},
+ {231, "dtherm"},
+ {232, "hw_pstate"},
+ /* 8*32 */
+ {256, "tpr_shadow"},
+ {257, "vnmi"},
+ {258, "flexpriority"},
+ {259, "ept"},
+ {260, "vpid"},
+ {261, "npt"},
+ {262, "lbrv"},
+ {263, "svm_lock"},
+ {264, "nrip_save"},
+ {265, "tsc_scale"},
+ {266, "vmcb_clean"},
+ {267, "flushbyasid"},
+ {268, "decodeassists"},
+ {269, "pausefilter"},
+ {270, "pfthreshold"},
+ /* 9*32 */
+ {288, "fsgsbase"},
+ {289, "tsc_adjust"},
+ {291, "bmi1"},
+ {292, "hle"},
+ {293, "avx2"},
+ {295, "smep"},
+ {296, "bmi2"},
+ {297, "erms"},
+ {298, "invpcid"},
+ {299, "rtm"},
+ {306, "rdseed"},
+ {307, "adx"},
+ {308, "smap"},
+ };
+
+ size_t i, st_length = sizeof(flags) / sizeof(flags[0]);
+
+ for (i = 0; i < st_length; i++) {
+ if (strcmp(flag, flags[i].flag) == 0) {
+ *stat = 0;
+ return flags[i].val;
+ }
+ }
+
+ *stat = -2;
+ return 0;
+}
+
+/*
+ * Get CPU family id according to the dmidecode family.
+ * @param dmi_family family string from dmidecode program
+ * @return family id defined by CIM
+ */
+CMPIUint16 get_family(const char *dmi_family)
+{
+ if (!dmi_family) {
+ return 2; /* Unknown */
+ }
+
+ /* CIM CPU families based on
+ cim_schema_2.35.0Final-MOFs/Device/CIM_Processor.mof */
+ /* Dmidecode families based on dmidecode 2.11 */
+ static struct {
+ CMPIUint16 value_map; /* ValueMap defined by CIM */
+ char *value; /* Value defined by CIM (just for reference) */
+ char *search; /* String used to match the dmidecode family */
+ } fm[] = {
+ {1, "Other", "Other"},
+ {2, "Unknown", "Unknown"},
+ {3, "8086", "8086"},
+ {4, "80286", "80286"},
+ {5, "80386", "80386"},
+ {6, "80486", "80486"},
+ {7, "8087", "8087"},
+ {8, "80287", "80287"},
+ {9, "80387", "80387"},
+ {10, "80487", "80487"},
+ {11, "Pentium(R) brand", "Pentium"},
+ {12, "Pentium(R) Pro", "Pentium Pro"},
+ {13, "Pentium(R) II", "Pentium II"},
+ {14, "Pentium(R) processor with MMX(TM) technology", "Pentium MMX"},
+ {15, "Celeron(TM)", "Celeron"},
+ {16, "Pentium(R) II Xeon(TM)", "Pentium II Xeon"},
+ {17, "Pentium(R) III", "Pentium III"},
+ {18, "M1 Family", "M1"},
+ {19, "M2 Family", "M2"},
+ {20, "Intel(R) Celeron(R) M processor", "Celeron M"},
+ {21, "Intel(R) Pentium(R) 4 HT processor", "Pentium 4 HT"},
+
+ {24, "K5 Family", "K5"},
+ {25, "K6 Family", "K6"},
+ {26, "K6-2", "K6-2"},
+ {27, "K6-3", "K6-3"},
+ {28, "AMD Athlon(TM) Processor Family", "Athlon"},
+ {29, "AMD(R) Duron(TM) Processor", "Duron"},
+ {30, "AMD29000 Family", "AMD29000"},
+ {31, "K6-2+", "K6-2+"},
+ {32, "Power PC Family", "Power PC"},
+ {33, "Power PC 601", "Power PC 601"},
+ {34, "Power PC 603", "Power PC 603"},
+ {35, "Power PC 603+", "Power PC 603+"},
+ {36, "Power PC 604", "Power PC 604"},
+ {37, "Power PC 620", "Power PC 620"},
+ {38, "Power PC X704", "Power PC x704"},
+ {39, "Power PC 750", "Power PC 750"},
+ {40, "Intel(R) Core(TM) Duo processor", "Core Duo"},
+ {41, "Intel(R) Core(TM) Duo mobile processor", "Core Duo Mobile"},
+ {42, "Intel(R) Core(TM) Solo mobile processor", "Core Solo Mobile"},
+ {43, "Intel(R) Atom(TM) processor", "Atom"},
+
+ {48, "Alpha Family", "Alpha"},
+ {49, "Alpha 21064", "Alpha 21064"},
+ {50, "Alpha 21066", "Alpha 21066"},
+ {51, "Alpha 21164", "Alpha 21164"},
+ {52, "Alpha 21164PC", "Alpha 21164PC"},
+ {53, "Alpha 21164a", "Alpha 21164a"},
+ {54, "Alpha 21264", "Alpha 21264"},
+ {55, "Alpha 21364", "Alpha 21364"},
+ {56, "AMD Turion(TM) II Ultra Dual-Core Mobile M Processor Family",
+ "Turion II Ultra Dual-Core Mobile M"},
+ {57, "AMD Turion(TM) II Dual-Core Mobile M Processor Family",
+ "Turion II Dual-Core Mobile M"},
+ {58, "AMD Athlon(TM) II Dual-Core Mobile M Processor Family",
+ "Athlon II Dual-Core M"},
+ {59, "AMD Opteron(TM) 6100 Series Processor", "Opteron 6100"},
+ {60, "AMD Opteron(TM) 4100 Series Processor", "Opteron 4100"},
+ {61, "AMD Opteron(TM) 6200 Series Processor", "Opteron 6200"},
+ {62, "AMD Opteron(TM) 4200 Series Processor", "Opteron 4200"},
+
+ /*
+ {63, "AMD FX(TM) Series Processor", ""},
+ */
+ {64, "MIPS Family", "MIPS"},
+ {65, "MIPS R4000", "MIPS R4000"},
+ {66, "MIPS R4200", "MIPS R4200"},
+ {67, "MIPS R4400", "MIPS R4400"},
+ {68, "MIPS R4600", "MIPS R4600"},
+ {69, "MIPS R10000", "MIPS R10000"},
+ {70, "AMD C-Series Processor", "C-Series"},
+ {71, "AMD E-Series Processor", "E-Series"},
+ /*
+ {72, "AMD A-Series Processor", ""},
+ */
+ {73, "AMD G-Series Processor", "G-Series"},
+ /*
+ {74, "AMD Z-Series Processor", ""},
+ {75, "AMD R-Series Processor", ""},
+ {76, "AMD Opteron(TM) 4300 Series Processor", ""},
+ {77, "AMD Opteron(TM) 6300 Series Processor", ""},
+ {78, "AMD Opteron(TM) 3300 Series Processor", ""},
+ {79, "AMD FirePro(TM) Series Processor", ""},
+ */
+
+ {80, "SPARC Family", "SPARC"},
+ {81, "SuperSPARC", "SuperSPARC"},
+ {82, "microSPARC II", "MicroSPARC II"},
+ {83, "microSPARC IIep", "MicroSPARC IIep"},
+ {84, "UltraSPARC", "UltraSPARC"},
+ {85, "UltraSPARC II", "UltraSPARC II"},
+ {86, "UltraSPARC IIi", "UltraSPARC IIi"},
+ {87, "UltraSPARC III", "UltraSPARC III"},
+ {88, "UltraSPARC IIIi", "UltraSPARC IIIi"},
+
+ {96, "68040", "68040"},
+ {97, "68xxx Family", "68xxx"},
+ {98, "68000", "68000"},
+ {99, "68010", "68010"},
+ {100, "68020", "68020"},
+ {101, "68030", "68030"},
+
+ {112, "Hobbit Family", "Hobbit"},
+
+ {120, "Crusoe(TM) TM5000 Family", "Crusoe TM5000"},
+ {121, "Crusoe(TM) TM3000 Family", "Crusoe TM3000"},
+ {122, "Efficeon(TM) TM8000 Family", "Efficeon TM8000"},
+
+ {128, "Weitek", "Weitek"},
+
+ {130, "Itanium(TM) Processor", "Itanium"},
+ {131, "AMD Athlon(TM) 64 Processor Family", "Athlon 64"},
+ {132, "AMD Opteron(TM) Processor Family", "Opteron"},
+ {133, "AMD Sempron(TM) Processor Family", "Sempron"},
+ {134, "AMD Turion(TM) 64 Mobile Technology", "Turion 64"},
+ {135, "Dual-Core AMD Opteron(TM) Processor Family",
+ "Dual-Core Opteron"},
+ {136, "AMD Athlon(TM) 64 X2 Dual-Core Processor Family",
+ "Athlon 64 X2"},
+ {137, "AMD Turion(TM) 64 X2 Mobile Technology", "Turion 64 X2"},
+ {138, "Quad-Core AMD Opteron(TM) Processor Family",
+ "Quad-Core Opteron"},
+ {139, "Third-Generation AMD Opteron(TM) Processor Family",
+ "Third-Generation Opteron"},
+ {140, "AMD Phenom(TM) FX Quad-Core Processor Family", "Phenom FX"},
+ {141, "AMD Phenom(TM) X4 Quad-Core Processor Family", "Phenom X4"},
+ {142, "AMD Phenom(TM) X2 Dual-Core Processor Family", "Phenom X2"},
+ {143, "AMD Athlon(TM) X2 Dual-Core Processor Family", "Athlon X2"},
+ {144, "PA-RISC Family", "PA-RISC"},
+ {145, "PA-RISC 8500", "PA-RISC 8500"},
+ {146, "PA-RISC 8000", "PA-RISC 8000"},
+ {147, "PA-RISC 7300LC", "PA-RISC 7300LC"},
+ {148, "PA-RISC 7200", "PA-RISC 7200"},
+ {149, "PA-RISC 7100LC", "PA-RISC 7100LC"},
+ {150, "PA-RISC 7100", "PA-RISC 7100"},
+
+ {161, "Quad-Core Intel(R) Xeon(R) processor 3200 Series",
+ "Quad-Core Xeon 3200"},
+ {162, "Dual-Core Intel(R) Xeon(R) processor 3000 Series",
+ "Dual-Core Xeon 3000"},
+ {163, "Quad-Core Intel(R) Xeon(R) processor 5300 Series",
+ "Quad-Core Xeon 5300"},
+ {164, "Dual-Core Intel(R) Xeon(R) processor 5100 Series",
+ "Dual-Core Xeon 5100"},
+ {165, "Dual-Core Intel(R) Xeon(R) processor 5000 Series",
+ "Dual-Core Xeon 5000"},
+ {166, "Dual-Core Intel(R) Xeon(R) processor LV", "Dual-Core Xeon LV"},
+ {167, "Dual-Core Intel(R) Xeon(R) processor ULV",
+ "Dual-Core Xeon ULV"},
+ {168, "Dual-Core Intel(R) Xeon(R) processor 7100 Series",
+ "Dual-Core Xeon 7100"},
+ {169, "Quad-Core Intel(R) Xeon(R) processor 5400 Series",
+ "Quad-Core Xeon 5400"},
+ {170, "Quad-Core Intel(R) Xeon(R) processor", "Quad-Core Xeon"},
+ {171, "Dual-Core Intel(R) Xeon(R) processor 5200 Series",
+ "Dual-Core Xeon 5200"},
+ {172, "Dual-Core Intel(R) Xeon(R) processor 7200 Series",
+ "Dual-Core Xeon 7200"},
+ {173, "Quad-Core Intel(R) Xeon(R) processor 7300 Series",
+ "Quad-Core Xeon 7300"},
+ {174, "Quad-Core Intel(R) Xeon(R) processor 7400 Series",
+ "Quad-Core Xeon 7400"},
+ {175, "Multi-Core Intel(R) Xeon(R) processor 7400 Series",
+ "Multi-Core Xeon 7400"},
+ {176, "Pentium(R) III Xeon(TM)", "Pentium III Xeon"},
+ {177, "Pentium(R) III Processor with Intel(R) SpeedStep(TM) Technology",
+ "Pentium III Speedstep"},
+ {178, "Pentium(R) 4", "Pentium 4"},
+ {179, "Intel(R) Xeon(TM)", "Xeon"},
+ {180, "AS400 Family", "AS400"},
+ {181, "Intel(R) Xeon(TM) processor MP", "Xeon MP"},
+ {182, "AMD Athlon(TM) XP Family", "Athlon XP"},
+ {183, "AMD Athlon(TM) MP Family", "Athlon MP"},
+ {184, "Intel(R) Itanium(R) 2", "Itanium 2"},
+ {185, "Intel(R) Pentium(R) M processor", "Pentium M"},
+ {186, "Intel(R) Celeron(R) D processor", "Celeron D"},
+ {187, "Intel(R) Pentium(R) D processor", "Pentium D"},
+ {188, "Intel(R) Pentium(R) Processor Extreme Edition", "Pentium EE"},
+ {189, "Intel(R) Core(TM) Solo Processor", "Core Solo"},
+ {190, "K7", "K7"},
+ {191, "Intel(R) Core(TM)2 Duo Processor", "Core 2 Duo"},
+ {192, "Intel(R) Core(TM)2 Solo processor", "Core 2 Solo"},
+ {193, "Intel(R) Core(TM)2 Extreme processor", "Core 2 Extreme"},
+ {194, "Intel(R) Core(TM)2 Quad processor", "Core 2 Quad"},
+ {195, "Intel(R) Core(TM)2 Extreme mobile processor",
+ "Core 2 Extreme Mobile"},
+ {196, "Intel(R) Core(TM)2 Duo mobile processor", "Core 2 Duo Mobile"},
+ {197, "Intel(R) Core(TM)2 Solo mobile processor",
+ "Core 2 Solo Mobile"},
+ {198, "Intel(R) Core(TM) i7 processor", "Core i7"},
+ {199, "Dual-Core Intel(R) Celeron(R) Processor", "Dual-Core Celeron"},
+ {200, "S/390 and zSeries Family", "IBM390"},
+ {201, "ESA/390 G4", "G4"},
+ {202, "ESA/390 G5", "G5"},
+ {203, "ESA/390 G6", "ESA/390 G6"},
+ {204, "z/Architectur base", "z/Architectur"}, /* this is not typo */
+ {205, "Intel(R) Core(TM) i5 processor", "Core i5"},
+ {206, "Intel(R) Core(TM) i3 processor", "Core i3"},
+
+ {210, "VIA C7(TM)-M Processor Family", "C7-M"},
+ {211, "VIA C7(TM)-D Processor Family", "C7-D"},
+ {212, "VIA C7(TM) Processor Family", "C7"},
+ {213, "VIA Eden(TM) Processor Family", "Eden"},
+ {214, "Multi-Core Intel(R) Xeon(R) processor", "Multi-Core Xeon"},
+ {215, "Dual-Core Intel(R) Xeon(R) processor 3xxx Series",
+ "Dual-Core Xeon 3xxx"},
+ {216, "Quad-Core Intel(R) Xeon(R) processor 3xxx Series",
+ "Quad-Core Xeon 3xxx"},
+ {217, "VIA Nano(TM) Processor Family", "Nano"},
+ {218, "Dual-Core Intel(R) Xeon(R) processor 5xxx Series",
+ "Dual-Core Xeon 5xxx"},
+ {219, "Quad-Core Intel(R) Xeon(R) processor 5xxx Series",
+ "Quad-Core Xeon 5xxx"},
+
+ {221, "Dual-Core Intel(R) Xeon(R) processor 7xxx Series",
+ "Dual-Core Xeon 7xxx"},
+ {222, "Quad-Core Intel(R) Xeon(R) processor 7xxx Series",
+ "Quad-Core Xeon 7xxx"},
+ {223, "Multi-Core Intel(R) Xeon(R) processor 7xxx Series",
+ "Multi-Core Xeon 7xxx"},
+ {224, "Multi-Core Intel(R) Xeon(R) processor 3400 Series",
+ "Multi-Core Xeon 3400"},
+
+ /*
+ {228, "AMD Opteron(TM) 3000 Series Processor", ""},
+ {229, "AMD Sempron(TM) II Processor Family", ""},
+ */
+ {230, "Embedded AMD Opteron(TM) Quad-Core Processor Family",
+ "Embedded Opteron Quad-Core"},
+ {231, "AMD Phenom(TM) Triple-Core Processor Family",
+ "Phenom Triple-Core"},
+ {232, "AMD Turion(TM) Ultra Dual-Core Mobile Processor Family",
+ "Turion Ultra Dual-Core Mobile"},
+ {233, "AMD Turion(TM) Dual-Core Mobile Processor Family",
+ "Turion Dual-Core Mobile"},
+ {234, "AMD Athlon(TM) Dual-Core Processor Family", "Athlon Dual-Core"},
+ {235, "AMD Sempron(TM) SI Processor Family", "Sempron SI"},
+ {236, "AMD Phenom(TM) II Processor Family", "Phenom II"},
+ {237, "AMD Athlon(TM) II Processor Family", "Athlon II"},
+ {238, "Six-Core AMD Opteron(TM) Processor Family", "Six-Core Opteron"},
+ {239, "AMD Sempron(TM) M Processor Family", "Sempron M"},
+
+ {250, "i860", "i860"},
+ {251, "i960", "i960"},
+
+ {260, "SH-3", "SH-3"},
+ {261, "SH-4", "SH-4"},
+ {280, "ARM", "ARM"},
+ {281, "StrongARM", "StrongARM"},
+ {300, "6x86", "6x86"},
+ {301, "MediaGX", "MediaGX"},
+ {302, "MII", "MII"},
+ {320, "WinChip", "WinChip"},
+ {350, "DSP", "DSP"},
+ {500, "Video Processor", "Video Processor"},
+
+ /*
+ {254, "Reserved (SMBIOS Extension)", ""},
+ {255, "Reserved (Un-initialized Flash Content - Lo)", ""},
+
+ {65534, "Reserved (For Future Special Purpose Assignment)", ""},
+ {65535, "Reserved (Un-initialized Flash Content - Hi)", ""},
+ */
+ };
+
+ size_t i, fm_length = sizeof(fm) / sizeof(fm[0]);
+
+ for (i = 0; i < fm_length; i++) {
+ if (strcmp(dmi_family, fm[i].search) == 0) {
+ return fm[i].value_map;
+ }
+ }
+
+ return 1; /* Other */
+}
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "LMI_Processor",
+ "LMI_Processor",
+ "instance method")
diff --git a/src/hardware/cpuinfo.c b/src/hardware/cpuinfo.c
new file mode 100644
index 0000000..d80e1cb
--- /dev/null
+++ b/src/hardware/cpuinfo.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Peter Schiffer <pschiffe@redhat.com>
+ */
+
+#include "cpuinfo.h"
+
+
+/*
+ * Initialize CpuinfoProcessor attributes.
+ * @param cpu
+ */
+void init_cpuinfoprocessor_struct(CpuinfoProcessor *cpu)
+{
+ cpu->flags_nb = 0;
+ cpu->flags = NULL;
+ cpu->address_size = 0;
+ cpu->model_name = NULL;
+}
+
+/*
+ * Check attributes of cpu structure and fill in defaults if needed.
+ * @param cpu
+ * @return 0 if success, negative value otherwise
+ */
+short check_cpuinfoprocessor_attributes(CpuinfoProcessor *cpu)
+{
+ short ret = -1;
+
+ if (!cpu->model_name) {
+ if (!(cpu->model_name = strdup(""))) {
+ ret = -2;
+ goto done;
+ }
+ }
+
+ ret = 0;
+
+done:
+ if (ret != 0) {
+ warn("Failed to allocate memory.");
+ }
+
+ return ret;
+}
+
+short cpuinfo_get_processor(CpuinfoProcessor *cpu)
+{
+ short ret = -1;
+ unsigned i, buffer_size = 0;
+ char **buffer = NULL, *buf;
+
+ /* read /proc/cpuinfo file */
+ if (read_file("/proc/cpuinfo", &buffer, &buffer_size) != 0) {
+ ret = -2;
+ goto done;
+ }
+
+ init_cpuinfoprocessor_struct(cpu);
+
+ /* parse information about processor */
+ for (i = 0; i < buffer_size; i++) {
+ /* CPU Flags */
+ buf = copy_string_part_after_delim(buffer[i], "flags\t\t: ");
+ if (buf) {
+ if (explode(buf, NULL, &cpu->flags, &cpu->flags_nb) != 0) {
+ ret = -3;
+ goto done;
+ }
+ free(buf);
+ buf = NULL;
+ continue;
+ }
+ /* Address Size */
+ buf = copy_string_part_after_delim(buffer[i], " bits physical, ");
+ if (buf) {
+ sscanf(buf, "%u", &cpu->address_size);
+ free(buf);
+ buf = NULL;
+ continue;
+ }
+ /* Model Name */
+ buf = copy_string_part_after_delim(buffer[i], "model name\t: ");
+ if (buf) {
+ cpu->model_name = buf;
+ buf = NULL;
+ continue;
+ }
+ }
+
+ if (check_cpuinfoprocessor_attributes(cpu) != 0) {
+ ret = -4;
+ goto done;
+ }
+
+ ret = 0;
+
+done:
+ free_2d_buffer(&buffer, &buffer_size);
+
+ if (ret != 0) {
+ cpuinfo_free_processor(cpu);
+ }
+
+ return ret;
+}
+
+void cpuinfo_free_processor(CpuinfoProcessor *cpu)
+{
+ if (cpu) {
+ if (cpu->flags_nb > 0) {
+ unsigned i;
+ for (i = 0; i < cpu->flags_nb; i++) {
+ if (cpu->flags[i]) {
+ free(cpu->flags[i]);
+ }
+ cpu->flags[i] = NULL;
+ }
+ free(cpu->flags);
+ }
+ cpu->flags_nb = 0;
+ cpu->flags = NULL;
+ if (cpu->model_name) {
+ free(cpu->model_name);
+ }
+ cpu->model_name = NULL;
+ }
+
+ return;
+}
diff --git a/src/hardware/cpuinfo.h b/src/hardware/cpuinfo.h
new file mode 100644
index 0000000..5ec5dd5
--- /dev/null
+++ b/src/hardware/cpuinfo.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Peter Schiffer <pschiffe@redhat.com>
+ */
+
+#ifndef CPUINFO_H_
+#define CPUINFO_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "globals.h"
+#include "utils.h"
+
+
+/* Processor from /proc/cpuinfo file. */
+typedef struct _CpuinfoProcessor {
+ unsigned flags_nb; /* Number of CPU Flags */
+ char **flags; /* CPU Flags */
+ unsigned address_size; /* Address Size / Address Width */
+ char *model_name; /* Model Name */
+} CpuinfoProcessor;
+
+
+/*
+ * Get processor structure according to the /proc/cpuinfo file.
+ * @param cpu
+ * @return 0 if success, negative value otherwise
+ */
+short cpuinfo_get_processor(CpuinfoProcessor *cpu);
+
+/*
+ * Free attributes in the cpuinfo structure.
+ * @param cpu structure
+ */
+void cpuinfo_free_processor(CpuinfoProcessor *cpu);
+
+
+#endif /* CPUINFO_H_ */
diff --git a/src/hardware/dmidecode.c b/src/hardware/dmidecode.c
new file mode 100644
index 0000000..6a038fb
--- /dev/null
+++ b/src/hardware/dmidecode.c
@@ -0,0 +1,343 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Peter Schiffer <pschiffe@redhat.com>
+ */
+
+#include "dmidecode.h"
+
+
+/*
+ * Initialize DmiProcessor attributes.
+ * @param cpu
+ */
+void init_dmiprocessor_struct(DmiProcessor *cpu)
+{
+ cpu->id = NULL;
+ cpu->family = NULL;
+ cpu->status = NULL;
+ cpu->current_speed = 0;
+ cpu->max_speed = 0;
+ cpu->external_clock = 0;
+ cpu->name = NULL;
+ cpu->enabled_cores = 1;
+ cpu->type = NULL;
+ cpu->stepping = NULL;
+ cpu->upgrade = NULL;
+ cpu->charact_nb = 0;
+ cpu->characteristics = NULL;
+}
+
+/*
+ * Check attributes of cpu structure and fill in defaults if needed.
+ * @param cpu
+ * @return 0 if success, negative value otherwise
+ */
+short check_dmiprocessor_attributes(DmiProcessor *cpu)
+{
+ short ret = -1;
+
+ if (!cpu->id) {
+ if (!(cpu->id = strdup(""))) {
+ ret = -2;
+ goto done;
+ }
+ }
+ if (!cpu->family) {
+ if (!(cpu->family = strdup("Unknown"))) {
+ ret = -3;
+ goto done;
+ }
+ }
+ if (!cpu->status) {
+ if (!(cpu->status = strdup("Unknown"))) {
+ ret = -4;
+ goto done;
+ }
+ }
+ if (!cpu->name) {
+ if (!(cpu->name = strdup(""))) {
+ ret = -5;
+ goto done;
+ }
+ }
+ if (!cpu->type) {
+ if (!(cpu->type = strdup(""))) {
+ ret = -6;
+ goto done;
+ }
+ }
+ if (!cpu->stepping) {
+ if (!(cpu->stepping = strdup(""))) {
+ ret = -7;
+ goto done;
+ }
+ }
+ if (!cpu->upgrade) {
+ if (!(cpu->upgrade = strdup("Unknown"))) {
+ ret = -8;
+ goto done;
+ }
+ }
+
+ ret = 0;
+
+done:
+ if (ret != 0) {
+ warn("Failed to allocate memory.");
+ }
+
+ return ret;
+}
+
+short dmi_get_processors(DmiProcessor **cpus, unsigned *cpus_nb)
+{
+ short ret = -1;
+ int curr_cpu = -1;
+ unsigned i, buffer_size = 0;
+ char **buffer = NULL, *buf;
+
+ *cpus_nb = 0;
+
+ /* get dmidecode output */
+ if (run_command("dmidecode -t 4", &buffer, &buffer_size) != 0) {
+ ret = -2;
+ goto done;
+ }
+
+ /* count processors */
+ for (i = 0; i < buffer_size; i++) {
+ if (strncmp(buffer[i], "Handle 0x", 9) == 0) {
+ (*cpus_nb)++;
+ }
+ }
+
+ /* if no processor was found */
+ if (*cpus_nb < 1) {
+ warn("Dmidecode didn't recognize any processor.");
+ ret = -3;
+ goto done;
+ }
+
+ /* allocate memory for processors */
+ *cpus = (DmiProcessor *)calloc(*cpus_nb, sizeof(DmiProcessor));
+ if (!(*cpus)) {
+ warn("Failed to allocate memory.");
+ ret = -4;
+ goto done;
+ }
+
+ /* parse information about processors */
+ for (i = 0; i < buffer_size; i++) {
+ if (strncmp(buffer[i], "Handle 0x", 9) == 0) {
+ curr_cpu++;
+ init_dmiprocessor_struct(cpus[curr_cpu]);
+ continue;
+ }
+ /* ignore first useless lines */
+ if (curr_cpu < 0) {
+ continue;
+ }
+ /* ID */
+ buf = copy_string_part_after_delim(buffer[i], "ID: ");
+ if (buf) {
+ cpus[curr_cpu]->id = buf;
+ buf = NULL;
+ continue;
+ }
+ /* Family */
+ buf = copy_string_part_after_delim(buffer[i], "Family: ");
+ if (buf) {
+ cpus[curr_cpu]->family = buf;
+ buf = NULL;
+ continue;
+ }
+ /* Status */
+ buf = copy_string_part_after_delim(buffer[i], "Status: Populated, ");
+ if (buf) {
+ cpus[curr_cpu]->status = buf;
+ buf = NULL;
+ continue;
+ }
+ /* Current Speed */
+ buf = copy_string_part_after_delim(buffer[i], "Current Speed: ");
+ if (buf && strcmp(buf, "Unknown") != 0) {
+ sscanf(buf, "%u", &cpus[curr_cpu]->current_speed);
+ free(buf);
+ buf = NULL;
+ continue;
+ }
+ /* Max Speed */
+ buf = copy_string_part_after_delim(buffer[i], "Max Speed: ");
+ if (buf && strcmp(buf, "Unknown") != 0) {
+ sscanf(buf, "%u", &cpus[curr_cpu]->max_speed);
+ free(buf);
+ buf = NULL;
+ continue;
+ }
+ /* External Clock Speed */
+ buf = copy_string_part_after_delim(buffer[i], "External Clock: ");
+ if (buf && strcmp(buf, "Unknown") != 0) {
+ sscanf(buf, "%u", &cpus[curr_cpu]->external_clock);
+ free(buf);
+ buf = NULL;
+ continue;
+ }
+ /* CPU Name */
+ buf = copy_string_part_after_delim(buffer[i], "Version: ");
+ if (buf) {
+ cpus[curr_cpu]->name = buf;
+ buf = NULL;
+ continue;
+ }
+ /* Enabled Cores */
+ buf = copy_string_part_after_delim(buffer[i], "Core Enabled: ");
+ if (buf) {
+ sscanf(buf, "%u", &cpus[curr_cpu]->enabled_cores);
+ free(buf);
+ buf = NULL;
+ continue;
+ }
+ /* CPU Type/Role */
+ buf = copy_string_part_after_delim(buffer[i], "Type: ");
+ if (buf) {
+ cpus[curr_cpu]->type = buf;
+ buf = NULL;
+ continue;
+ }
+ /* Stepping */
+ buf = copy_string_part_after_delim(buffer[i], ", Stepping ");
+ if (buf) {
+ cpus[curr_cpu]->stepping = buf;
+ buf = NULL;
+ continue;
+ }
+ /* Upgrade */
+ buf = copy_string_part_after_delim(buffer[i], "Upgrade: ");
+ if (buf) {
+ cpus[curr_cpu]->upgrade = buf;
+ buf = NULL;
+ continue;
+ }
+ /* CPU Characteristics */
+ if (strstr(buffer[i], "Characteristics:")
+ && !strstr(buffer[i], "Characteristics: ")) {
+ /* count characteristics */
+ cpus[curr_cpu]->charact_nb = 0;
+ while (strlen(buffer[i + cpus[curr_cpu]->charact_nb + 1])) {
+ cpus[curr_cpu]->charact_nb += 1;
+ }
+ /* allocate memory */
+ cpus[curr_cpu]->characteristics =
+ (char **)calloc(cpus[curr_cpu]->charact_nb, sizeof(char *));
+ if (!cpus[curr_cpu]->characteristics) {
+ warn("Failed to allocate memory.");
+ ret = -5;
+ goto done;
+ }
+ unsigned j;
+ char *tmp_line;
+ for (j = 0; j < cpus[curr_cpu]->charact_nb; j++) {
+ tmp_line = trim(buffer[i + j + 1], NULL);
+ if (tmp_line) {
+ cpus[curr_cpu]->characteristics[j] = tmp_line;
+ } else {
+ cpus[curr_cpu]->characteristics[j] = strdup("");
+ if (!cpus[curr_cpu]->characteristics[j]) {
+ warn("Failed to allocate memory.");
+ ret = -6;
+ goto done;
+ }
+ }
+ }
+ /* skip characteristics and newline after them */
+ i += cpus[curr_cpu]->charact_nb + 1;
+ }
+ }
+
+ /* fill in default attributes if needed */
+ for (i = 0; i < *cpus_nb; i++) {
+ if (check_dmiprocessor_attributes(cpus[i]) != 0) {
+ ret = -7;
+ goto done;
+ }
+ }
+
+ ret = 0;
+
+done:
+ free_2d_buffer(&buffer, &buffer_size);
+
+ if (ret != 0) {
+ dmi_free_processors(cpus, cpus_nb);
+ }
+
+ return ret;
+}
+
+void dmi_free_processors(DmiProcessor **cpus, unsigned *cpus_nb)
+{
+ unsigned i, j;
+
+ if (*cpus_nb > 0) {
+ for (i = 0; i < *cpus_nb; i++) {
+ if (cpus[i]->id) {
+ free(cpus[i]->id);
+ }
+ cpus[i]->id = NULL;
+ if (cpus[i]->family) {
+ free(cpus[i]->family);
+ }
+ cpus[i]->family = NULL;
+ if (cpus[i]->status) {
+ free(cpus[i]->status);
+ }
+ cpus[i]->status = NULL;
+ if (cpus[i]->name) {
+ free(cpus[i]->name);
+ }
+ cpus[i]->name = NULL;
+ if (cpus[i]->type) {
+ free(cpus[i]->type);
+ }
+ cpus[i]->type = NULL;
+ if (cpus[i]->stepping) {
+ free(cpus[i]->stepping);
+ }
+ cpus[i]->stepping = NULL;
+ if (cpus[i]->upgrade) {
+ free(cpus[i]->upgrade);
+ }
+ cpus[i]->upgrade = NULL;
+ if (cpus[i]->charact_nb > 0) {
+ for (j = 0; j < cpus[i]->charact_nb; j++) {
+ if (cpus[i]->characteristics[j]) {
+ free(cpus[i]->characteristics[j]);
+ }
+ cpus[i]->characteristics[j] = NULL;
+ }
+ free(cpus[i]->characteristics);
+ }
+ cpus[i]->charact_nb = 0;
+ cpus[i]->characteristics = NULL;
+ }
+ free (*cpus);
+ }
+
+ *cpus_nb = 0;
+ *cpus = NULL;
+}
diff --git a/src/hardware/dmidecode.h b/src/hardware/dmidecode.h
new file mode 100644
index 0000000..f7e76a9
--- /dev/null
+++ b/src/hardware/dmidecode.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Peter Schiffer <pschiffe@redhat.com>
+ */
+
+#ifndef DMIDECODE_H_
+#define DMIDECODE_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "globals.h"
+#include "utils.h"
+
+
+/* Processor from dmidecode. */
+typedef struct _DmiProcessor {
+ char *id; /* ID */
+ char *family; /* Family */
+ char *status; /* CPU Status */
+ unsigned current_speed; /* Current Speed in MHz */
+ unsigned max_speed; /* Max Speed in MHz */
+ unsigned external_clock; /* External Clock Speed in MHz */
+ char *name; /* CPU name, version in dmidecode */
+ unsigned enabled_cores; /* Number of enabled cores */
+ char *type; /* CPU Type/Role */
+ char *stepping; /* Stepping (revision level within family) */
+ char *upgrade; /* CPU upgrade method - socket */
+ unsigned charact_nb; /* Number of CPU Characteristics */
+ char **characteristics; /* CPU Characteristics */
+} DmiProcessor;
+
+
+/*
+ * Get array of processors according to the dmidecode program.
+ * @param cpu array of cpus, this function will allocate necessary memory,
+ * but caller is responsible for freeing it
+ * @param cpus_nb number of processors in cpus
+ * @return 0 if success, negative value otherwise
+ */
+short dmi_get_processors(DmiProcessor **cpus, unsigned *cpus_nb);
+
+/*
+ * Free array of processor structures.
+ * @param cpus array of cpus
+ * @param cpus_nb number of cpus
+ */
+void dmi_free_processors(DmiProcessor **cpus, unsigned *cpus_nb);
+
+
+#endif /* DMIDECODE_H_ */
diff --git a/src/hardware/lscpu.c b/src/hardware/lscpu.c
new file mode 100644
index 0000000..124ed7b
--- /dev/null
+++ b/src/hardware/lscpu.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Peter Schiffer <pschiffe@redhat.com>
+ */
+
+#include "lscpu.h"
+
+
+/*
+ * Initialize LscpuProcessor attributes.
+ * @param cpu
+ */
+void init_lscpuprocessor_struct(LscpuProcessor *cpu)
+{
+ cpu->data_width = 0;
+ cpu->processors = 0;
+ cpu->cores = 0;
+ cpu->stepping = NULL;
+ cpu->current_speed = 0;
+}
+
+/*
+ * Check attributes of cpu structure and fill in defaults if needed.
+ * @param cpu
+ * @return 0 if success, negative value otherwise
+ */
+short check_lscpuprocessor_attributes(LscpuProcessor *cpu)
+{
+ short ret = -1;
+
+ if (!cpu->stepping) {
+ if (!(cpu->stepping = strdup(""))) {
+ ret = -2;
+ goto done;
+ }
+ }
+
+ ret = 0;
+
+done:
+ if (ret != 0) {
+ warn("Failed to allocate memory.");
+ }
+
+ return ret;
+}
+
+short lscpu_get_processor(LscpuProcessor *cpu)
+{
+ short ret = -1;
+ unsigned i, buffer_size = 0;
+ char **buffer = NULL, *buf;
+
+ /* get lscpu output */
+ if (run_command("lscpu", &buffer, &buffer_size) != 0) {
+ ret = -2;
+ goto done;
+ }
+
+ init_lscpuprocessor_struct(cpu);
+
+ /* parse information about processor */
+ for (i = 0; i < buffer_size; i++) {
+ /* Data Width */
+ buf = copy_string_part_after_delim(buffer[i], "CPU op-mode(s):");
+ if (buf) {
+ if (strstr(buf, "64")) {
+ cpu->data_width = 64;
+ } else if (strstr(buf, "32")) {
+ cpu->data_width = 32;
+ }
+ free(buf);
+ buf = NULL;
+ continue;
+ }
+ /* Cores per processor */
+ buf = copy_string_part_after_delim(buffer[i], "Core(s) per socket:");
+ if (buf) {
+ sscanf(buf, "%u", &cpu->cores);
+ free(buf);
+ buf = NULL;
+ continue;
+ }
+ /* Number of processors */
+ buf = copy_string_part_after_delim(buffer[i], "Socket(s):");
+ if (buf) {
+ sscanf(buf, "%u", &cpu->processors);
+ free(buf);
+ buf = NULL;
+ continue;
+ }
+ /* Stepping */
+ buf = copy_string_part_after_delim(buffer[i], "Stepping:");
+ if (buf) {
+ cpu->stepping = buf;
+ buf = NULL;
+ continue;
+ }
+ /* Current speed in MHz */
+ buf = copy_string_part_after_delim(buffer[i], "CPU MHz:");
+ if (buf) {
+ sscanf(buf, "%u", &cpu->current_speed);
+ free(buf);
+ buf = NULL;
+ continue;
+ }
+ }
+
+ if (check_lscpuprocessor_attributes(cpu) != 0) {
+ ret = -3;
+ goto done;
+ }
+
+ ret = 0;
+
+done:
+ free_2d_buffer(&buffer, &buffer_size);
+
+ if (ret != 0) {
+ lscpu_free_processor(cpu);
+ }
+
+ return ret;
+}
+
+void lscpu_free_processor(LscpuProcessor *cpus)
+{
+ if (cpus) {
+ if (cpus->stepping) {
+ free(cpus->stepping);
+ }
+ cpus->stepping = NULL;
+ }
+
+ return;
+}
diff --git a/src/hardware/lscpu.h b/src/hardware/lscpu.h
new file mode 100644
index 0000000..892141e
--- /dev/null
+++ b/src/hardware/lscpu.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Peter Schiffer <pschiffe@redhat.com>
+ */
+
+#ifndef LSCPU_H_
+#define LSCPU_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "globals.h"
+#include "utils.h"
+
+
+/* Processor from lscpu program. */
+typedef struct _LscpuProcessor {
+ unsigned data_width; /* Data width */
+ unsigned processors; /* Number of processors */
+ unsigned cores; /* Cores per processor */
+ char *stepping; /* Stepping */
+ unsigned current_speed; /* Current speed in MHz */
+} LscpuProcessor;
+
+
+/*
+ * Get processor structure according to the lscpu program.
+ * @param cpu
+ * @return 0 if success, negative value otherwise
+ */
+short lscpu_get_processor(LscpuProcessor *cpu);
+
+/*
+ * Free attributes in the lscpu structure.
+ * @param cpu
+ */
+void lscpu_free_processor(LscpuProcessor *cpu);
+
+
+#endif /* LSCPU_H_ */
diff --git a/src/hardware/utils.c b/src/hardware/utils.c
new file mode 100644
index 0000000..da7bbfa
--- /dev/null
+++ b/src/hardware/utils.c
@@ -0,0 +1,382 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Peter Schiffer <pschiffe@redhat.com>
+ */
+
+#include "utils.h"
+
+
+short read_fp_to_2d_buffer(FILE *fp, char ***buffer, unsigned *buffer_size)
+{
+ short ret = -1;
+ ssize_t read;
+ size_t line_len = 0;
+ unsigned tmp_buffer_lines, lines_read = 0;
+ char **tmp_buffer, *line = NULL;
+
+ free_2d_buffer(buffer, buffer_size);
+
+ if (!fp) {
+ warn("Given file pointer is NULL.");
+ ret = -2;
+ goto done;
+ }
+
+ /* allocate buffer */
+ tmp_buffer_lines = 128;
+ tmp_buffer = (char **)calloc(tmp_buffer_lines, sizeof(char *));
+ if (!tmp_buffer) {
+ warn("Failed to allocate memory.");
+ ret = -3;
+ goto done;
+ }
+
+ while ((read = getline(&line, &line_len, fp)) != -1) {
+ /* filter comment lines */
+ if (read > 0 && line[0] == '#') {
+ continue;
+ }
+
+ /* reallocate if needed */
+ if (lines_read >= tmp_buffer_lines) {
+ tmp_buffer_lines *= 2;
+ char **newtmp = (char **)realloc(tmp_buffer,
+ tmp_buffer_lines * sizeof(char *));
+ if (!newtmp) {
+ warn("Failed to allocate memory.");
+ ret = -4;
+ goto done;
+ }
+ tmp_buffer = newtmp;
+ }
+
+ /* copy trimmed line to buffer */
+ tmp_buffer[lines_read] = trim(line, NULL);
+ if (!tmp_buffer[lines_read]) {
+ tmp_buffer[lines_read] = strdup("");
+ if (!tmp_buffer[lines_read]) {
+ warn("Failed to allocate memory.");
+ ret = -5;
+ goto done;
+ }
+ }
+ lines_read++;
+ }
+
+ if (lines_read < 1) {
+ warn("No data read from given source.");
+ ret = -6;
+ goto done;
+ }
+
+ /* reallocate buffer to free unused space */
+ if (tmp_buffer_lines > lines_read) {
+ tmp_buffer_lines = lines_read;
+ char **newtmp = (char **)realloc(tmp_buffer,
+ tmp_buffer_lines * sizeof(char *));
+ if (!newtmp) {
+ warn("Failed to allocate memory.");
+ ret = -7;
+ goto done;
+ }
+ tmp_buffer = newtmp;
+ }
+
+ *buffer_size = tmp_buffer_lines;
+ *buffer = tmp_buffer;
+
+ ret = 0;
+
+done:
+ if (line) {
+ free(line);
+ }
+ line = NULL;
+
+ if (ret != 0) {
+ free_2d_buffer(&tmp_buffer, &tmp_buffer_lines);
+ }
+
+ return ret;
+}
+
+void free_2d_buffer(char ***buffer, unsigned *buffer_size)
+{
+ unsigned i, tmp_buffer_lines = *buffer_size;
+ char **tmp_buffer = *buffer;
+
+ if (tmp_buffer_lines > 0) {
+ for (i = 0; i < tmp_buffer_lines; i++) {
+ if (tmp_buffer[i]) {
+ free(tmp_buffer[i]);
+ }
+ tmp_buffer[i] = NULL;
+ }
+ free(tmp_buffer);
+ }
+
+ tmp_buffer = NULL;
+ *buffer_size = 0;
+ *buffer = NULL;
+}
+
+short run_command(const char *command, char ***buffer, unsigned *buffer_size)
+{
+ FILE *fp;
+ short ret = -1;
+
+ /* if command is empty */
+ if (!command || strlen(command) < 1) {
+ warn("Given command is empty.");
+ ret = -2;
+ goto done;
+ }
+
+ /* execute command */
+ debug("Running command: \"%s\"", command);
+ fp = popen(command, "r");
+ if (!fp) {
+ warn("Failed to run command: \"%s\"; Error: %s",
+ command, strerror(errno));
+ ret = -3;
+ goto done;
+ }
+
+ if (read_fp_to_2d_buffer(fp, buffer, buffer_size) != 0) {
+ ret = -4;
+ goto done;
+ }
+
+ ret = 0;
+
+done:
+ if (fp) {
+ int ret_code = pclose(fp);
+ if (ret_code == -1) {
+ warn("Failed to run command: \"%s\"; Error: %s",
+ command, strerror(errno));
+ if (ret == 0) {
+ ret = -5;
+ }
+ } else if (ret_code != 0) {
+ warn("Command \"%s\" exited unexpectedly.", command);
+ if (ret == 0) {
+ ret = -6;
+ }
+ }
+ }
+
+ if (ret != 0) {
+ free_2d_buffer(buffer, buffer_size);
+ }
+
+ return ret;
+}
+
+short read_file(const char *filename, char ***buffer, unsigned *buffer_size)
+{
+ FILE *fp;
+ short ret = -1;
+
+ /* open file */
+ debug("Reading \"%s\" file.", filename);
+ fp = fopen(filename, "r");
+ if (!fp) {
+ warn("Failed to open \"%s\" file.", filename);
+ ret = -2;
+ goto done;
+ }
+
+ if (read_fp_to_2d_buffer(fp, buffer, buffer_size) != 0) {
+ ret = -3;
+ goto done;
+ }
+
+ ret = 0;
+
+done:
+ if (fp) {
+ fclose(fp);
+ }
+
+ if (ret != 0) {
+ free_2d_buffer(buffer, buffer_size);
+ }
+
+ return ret;
+}
+
+char *copy_string_part_after_delim(const char *str, const char *delim)
+{
+ if (!str || strlen(str) < 1 || !delim || strlen(delim) < 1) {
+ return NULL;
+ }
+
+ char *p, *out = NULL;
+ size_t delim_len = strlen(delim);
+
+ /* if str contains delim and there is something after it */
+ if ((p = strstr(str, delim)) && strlen(p + delim_len) > 0) {
+ out = trim(p + delim_len, NULL);
+ }
+
+ return out;
+}
+
+char *trim(const char *str, const char *delims)
+{
+ char *out;
+ const char *default_delims = WHITESPACES;
+ size_t l;
+
+ /* if string is empty */
+ if (!str || strlen(str) < 1) {
+ return NULL;
+ }
+
+ if (!delims) {
+ delims = default_delims;
+ }
+
+ /* trim start of the string */
+ while (strchr(delims, str[0]) && str[0] != '\0') {
+ str++;
+ }
+
+ l = strlen(str);
+
+ /* if string was only white spaces */
+ if (l < 1) {
+ return NULL;
+ }
+
+ /* shorten length of string if there are trailing white spaces */
+ while (strchr(delims, str[l - 1]) && l != 0) {
+ l--;
+ }
+
+ /* sanity check */
+ if (l < 1) {
+ return NULL;
+ }
+
+ /* copy string */
+ out = strndup(str, l);
+ if (!out) {
+ warn("Failed to allocate memory.");
+ }
+
+ return out;
+}
+
+short explode(const char *str, const char *delims, char ***buffer, unsigned *buffer_size)
+{
+ size_t l;
+ short ret = -1;
+ unsigned item = 0, tmp_buffer_size;
+ char *default_delims = WHITESPACES, *trimmed_str = NULL, *ts, **tmp_buffer;
+
+ free_2d_buffer(buffer, buffer_size);
+
+ if (!str || strlen(str) < 1) {
+ ret = 0;
+ goto done;
+ }
+
+ if (!delims) {
+ delims = default_delims;
+ }
+
+ trimmed_str = trim(str, delims);
+ if (!trimmed_str || strlen(trimmed_str) < 1) {
+ ret = 0;
+ goto done;
+ }
+
+ tmp_buffer_size = 128;
+ tmp_buffer = (char **)calloc(tmp_buffer_size, sizeof(char *));
+ if (!tmp_buffer) {
+ warn("Failed to allocate memory.");
+ ret = -2;
+ goto done;
+ }
+
+ ts = trimmed_str;
+ while (ts[0] != '\0') {
+ /* skip leading delimiters of substring */
+ while (strchr(delims, ts[0]) && ts[0] != '\0') {
+ ts++;
+ }
+ /* find length of valid substring */
+ l = 0;
+ while (!strchr(delims, ts[l]) && ts[l] != '\0') {
+ l++;
+ }
+ /* reallocate if needed */
+ if (item >= tmp_buffer_size) {
+ tmp_buffer_size *= 2;
+ char **new_temp = (char **)realloc(tmp_buffer,
+ tmp_buffer_size * sizeof(char *));
+ if (!new_temp) {
+ warn("Failed to allocate memory.");
+ ret = -3;
+ goto done;
+ }
+ tmp_buffer = new_temp;
+ }
+ /* copy the substring */
+ tmp_buffer[item] = strndup(ts, l);
+ if (!tmp_buffer[item]) {
+ warn("Failed to allocate memory.");
+ ret = -4;
+ goto done;
+ }
+ item++;
+ ts += l;
+ }
+
+ /* reallocate to save unused space */
+ if (tmp_buffer_size > item) {
+ tmp_buffer_size = item;
+ char **new_temp = (char **)realloc(tmp_buffer,
+ tmp_buffer_size * sizeof(char *));
+ if (!new_temp) {
+ warn("Failed to allocate memory.");
+ ret = -5;
+ goto done;
+ }
+ tmp_buffer = new_temp;
+ }
+
+ *buffer_size = tmp_buffer_size;
+ *buffer = tmp_buffer;
+
+ ret = 0;
+
+done:
+ if (trimmed_str) {
+ free(trimmed_str);
+ }
+ trimmed_str = NULL;
+
+ if (ret != 0) {
+ free_2d_buffer(&tmp_buffer, &tmp_buffer_size);
+ }
+
+ return ret;
+}
diff --git a/src/hardware/utils.h b/src/hardware/utils.h
new file mode 100644
index 0000000..9f5686f
--- /dev/null
+++ b/src/hardware/utils.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Peter Schiffer <pschiffe@redhat.com>
+ */
+
+#ifndef UTILS_H_
+#define UTILS_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include "globals.h"
+
+#define WHITESPACES " \f\n\r\t\v"
+
+
+/*
+ * Read given file pointer and save it's output in buffer. Number of lines read
+ * is stored in buffer_size. Function skips lines starting with '#'.
+ * Every line from output is trimmed.
+ * Buffer has to be NULL, and buffer_size 0. Function will allocate
+ * necessary memory, buffer can be freed with free_2d_buffer() function.
+ * @param fp file pointer to be read
+ * @param buffer which will be filled in
+ * @param buffer_size number of lines in buffer
+ * @return 0 if success, negative value otherwise
+ */
+short read_fp_to_2d_buffer(FILE *fp, char ***buffer, unsigned *buffer_size);
+
+/*
+ * Free 2D buffer.
+ * @param buffer
+ * @param buffer_size number of lines in buffer
+ */
+void free_2d_buffer(char ***buffer, unsigned *buffer_size);
+
+/*
+ * Run given command and store its output in buffer. Number of lines in buffer
+ * is stored in buffer_size. Function skips lines starting with '#'.
+ * Buffer has to be NULL, and buffer_size 0. Function will allocate necessary
+ * memory, buffer can be freed with free_2d_buffer() function.
+ * @param command to be run
+ * @param buffer
+ * @param buffer_size number of lines in buffer
+ * @return 0 if success, negative value otherwise
+ */
+short run_command(const char *command, char ***buffer, unsigned *buffer_size);
+
+/*
+ * Run given file and store its output in buffer. Number of lines in buffer
+ * is stored in buffer_size. Function skips lines starting with '#'.
+ * Buffer has to be NULL, and buffer_size 0. Function will allocate necessary
+ * memory, buffer can be freed with free_2d_buffer() function.
+ * @param filename
+ * @param buffer
+ * @param buffer_size number of lines in buffer
+ * @return 0 if success, negative value otherwise
+ */
+short read_file(const char *filename, char ***buffer, unsigned *buffer_size);
+
+/*
+ * Copy trimmed part of the given string after delimiter and returns pointer
+ * to the newly created string, allocated with malloc.
+ * If delimiter is not part of the string, or the string ends right after
+ * delimiter, NULL is returned.
+ * @param str string to be searched
+ * @param delim delimiter
+ * @return newly created string or NULL
+ */
+char *copy_string_part_after_delim(const char *str, const char *delim);
+
+/*
+ * Create trimmed copy of given string. Trimmed will be any characters
+ * found in delims parameter, or, if delims is NULL, any white space characters.
+ * @param str
+ * @param delims string containing delimiters. If NULL, white space characters
+ * are used.
+ * @return trimmed string allocated with malloc or NULL if allocation failed
+ * or given string was empty or contained only delimiters
+ */
+char *trim(const char *str, const char *delims);
+
+/*
+ * Explode given string to substrings delimited by delims.
+ * @param str input string
+ * @param delims string consisted of delimiters
+ * @param buffer output 2D buffer. Can be NULL if input string is NULL, empty,
+ * or only delimiters.
+ * @param buffer_size number of substrings
+ * @return 0 if success, negative value otherwise.
+ */
+short explode(const char *str, const char *delims, char ***buffer, unsigned *buffer_size);
+
+
+#endif /* UTILS_H_ */
diff --git a/src/logicalfile/CMakeLists.txt b/src/logicalfile/CMakeLists.txt
new file mode 100644
index 0000000..8b0097a
--- /dev/null
+++ b/src/logicalfile/CMakeLists.txt
@@ -0,0 +1,29 @@
+
+set(PROVIDER_NAME LogicalFile)
+set(LIBRARY_NAME cmpiLMI_${PROVIDER_NAME})
+set(MOF LMI_LogicalFile.mof)
+
+set(provider_SRCS
+ file.c
+)
+
+konkretcmpi_generate(${MOF}
+ CIM_PROVIDERS
+ CIM_HEADERS
+)
+
+add_library(${LIBRARY_NAME} SHARED
+ ${provider_SRCS}
+ ${CIM_PROVIDERS}
+ ${CIM_HEADERS}
+)
+
+#pkg_check_modules(LIBPCI REQUIRED libpci)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR} ${LIBPCI_INCLUDE_DIR})
+target_link_libraries(${LIBRARY_NAME} openlmicommon ${KONKRETCMPI_LIBRARIES} ${LIBPCI_LIBRARIES})
+
+# Create registration file
+cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers)
+
+install(TARGETS ${LIBRARY_NAME} DESTINATION lib${LIB_SUFFIX}/cmpi)
diff --git a/src/logicalfile/LMI_DataFileProvider.c b/src/logicalfile/LMI_DataFileProvider.c
new file mode 100644
index 0000000..ea410c3
--- /dev/null
+++ b/src/logicalfile/LMI_DataFileProvider.c
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Jan Synacek <jsynacek@redhat.com>
+ */
+#include <konkret/konkret.h>
+#include "LMI_DataFile.h"
+#include "file.h"
+
+static const CMPIBroker* _cb = NULL;
+
+static void LMI_DataFileInitialize()
+{
+}
+
+static CMPIStatus LMI_DataFileCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_DataFileEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_DataFileEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_DataFileGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ get_instance(DataFile, S_IFREG, "Not a regular file: %s");
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_DataFileCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_DataFileModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_DataFileDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_DataFileExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+CMInstanceMIStub(
+ LMI_DataFile,
+ LMI_DataFile,
+ _cb,
+ LMI_DataFileInitialize())
+
+static CMPIStatus LMI_DataFileMethodCleanup(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_DataFileInvokeMethod(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* meth,
+ const CMPIArgs* in,
+ CMPIArgs* out)
+{
+ return LMI_DataFile_DispatchMethod(
+ _cb, mi, cc, cr, cop, meth, in, out);
+}
+
+CMMethodMIStub(
+ LMI_DataFile,
+ LMI_DataFile,
+ _cb,
+ LMI_DataFileInitialize())
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "LMI_DataFile",
+ "LMI_DataFile",
+ "instance method")
+/* vi: set et: */
diff --git a/src/logicalfile/LMI_DirectoryContainsFileProvider.c b/src/logicalfile/LMI_DirectoryContainsFileProvider.c
new file mode 100644
index 0000000..02aa324
--- /dev/null
+++ b/src/logicalfile/LMI_DirectoryContainsFileProvider.c
@@ -0,0 +1,437 @@
+/*
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Jan Synacek <jsynacek@redhat.com>
+ */
+#include <konkret/konkret.h>
+#include "LMI_DirectoryContainsFile.h"
+#include "LMI_UnixDirectory.h"
+#include "CIM_LogicalFile.h"
+#include "CIM_Directory.h"
+#include "file.h"
+
+static const CMPIBroker* _cb;
+
+/* XXX if a directory contains more than MAX_REFS files,
+ * broker will abort with an error */
+/* const unsigned int MAX_REFS = 65536; */
+const unsigned int MAX_REFS = 4096;
+
+static CMPIStatus dir_file_objectpaths(
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const char** properties,
+ const char *namespace,
+ const char *path,
+ CMPIObjectPath **ops,
+ unsigned int *count)
+{
+ CMPIObjectPath *o;
+ CMPIStatus st;
+ unsigned int i = 0;
+
+ struct stat sb;
+ struct dirent *de;
+ DIR *dp;
+ dp = opendir(path);
+ while ((de = readdir(dp))) {
+ if (!strcmp(de->d_name, ".")) {
+ continue;
+ }
+
+ char rpath[BUFLEN];
+ char fileclass[BUFLEN];
+ char *aux = strdup(path);
+
+ if (!strcmp(de->d_name, "..")) {
+ strncpy(rpath, dirname(aux), BUFLEN);
+ free(aux);
+ } else {
+ snprintf(rpath, BUFLEN, "%s/%s",
+ (!strcmp(path, "/")) ? "" : path,
+ de->d_name);
+ }
+
+ if (lstat(rpath, &sb) < 0) {
+ char err[BUFLEN];
+ snprintf(err, BUFLEN, "Can't stat file: %s", rpath);
+ CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, err);
+ } else {
+ get_class_from_stat(&sb, fileclass);
+ }
+
+ CIM_LogicalFileRef cim_lfr;
+ CIM_LogicalFileRef_Init(&cim_lfr, _cb, namespace);
+ fill_logicalfile(CIM_LogicalFileRef, &cim_lfr, rpath, fileclass);
+ o = CIM_LogicalFileRef_ToObjectPath(&cim_lfr, &st);
+ CMSetClassName(o, fileclass);
+
+ ops[i++] = o;
+ }
+ *count = i;
+ CMReturn(CMPI_RC_OK);
+}
+
+static int check_valid_classes(const CMPIObjectPath *o)
+{
+ const char *VALID_CLASSES[] = {
+ "LMI_DataFile",
+ "LMI_UnixDeviceFile",
+ "LMI_UnixDirectory",
+ "LMI_FIFOPipeFile",
+ "LMI_SymbolicLink",
+ "LMI_UnixSocket",
+ NULL
+ };
+ int found = 0;
+ for (int i = 0; VALID_CLASSES[i]; i++) {
+ if (CMClassPathIsA(_cb, o, VALID_CLASSES[i], NULL)) {
+ found++;
+ break;
+ }
+ }
+ return found;
+}
+
+static CMPIStatus associators(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* resultClass,
+ const char* role,
+ const char* resultRole,
+ const char** properties,
+ int names)
+{
+ CMPIObjectPath *o;
+ CMPIInstance *ci;
+ CMPIStatus st;
+ CMPIData cd, pathd;
+ const char *ns = KNameSpace(cop);
+
+ st = lmi_check_required(_cb, cop, LOGICALFILE);
+ if (st.rc != CMPI_RC_OK) {
+ return st;
+ }
+ /* allow only LMI_UnixFile and classes derived from CIM_LogicalFile */
+ if (!check_valid_classes(cop)) {
+ CMReturn(CMPI_RC_OK);
+ }
+
+ cd = CMGetKey(cop, "CreationClassName", &st);
+ const char *ccname = KChars(cd.value.string);
+ pathd = CMGetKey(cop, "Name", &st);
+ const char *path = KChars(pathd.value.string);
+
+ CMPIObjectPath *refs[MAX_REFS];
+ unsigned int count;
+
+ if (CMClassPathIsA(_cb, cop, LMI_UnixDirectory_ClassName, &st)) {
+ /* got UnixDirectory */
+ st = dir_file_objectpaths(cc, cr, properties, ns, path, refs, &count);
+ if (st.rc != CMPI_RC_OK) {
+ return st;
+ }
+ if (count > MAX_REFS) {
+ CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Too many files in a single directory...");
+ }
+ for (unsigned int i = 0; i < count; i++) {
+ if (names) {
+ CMReturnObjectPath(cr, refs[i]);
+ } else {
+ ci = _cb->bft->getInstance(_cb, cc, refs[i], properties, &st);
+ CMReturnInstance(cr, ci);
+ }
+ }
+ } else {
+ /* got LogicalFile */
+ CIM_DirectoryRef lmi_dr;
+ CIM_DirectoryRef_Init(&lmi_dr, _cb, ns);
+ char *aux = strdup(path);
+ fill_logicalfile(CIM_DirectoryRef, &lmi_dr, dirname(aux), LMI_UnixDirectory_ClassName);
+ o = CIM_DirectoryRef_ToObjectPath(&lmi_dr, &st);
+ CMSetClassName(o, LMI_UnixDirectory_ClassName);
+
+ if (names) {
+ CMReturnObjectPath(cr, o);
+ } else {
+ ci = _cb->bft->getInstance(_cb, cc, o, properties, &st);
+ CMReturnInstance(cr, ci);
+ }
+ free(aux);
+ }
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus references(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* role,
+ const char** properties,
+ int names)
+{
+ LMI_DirectoryContainsFile lmi_dcf;
+ CMPIStatus st;
+ CMPIData pathd;
+ CMPIData cd;
+ const char *ns = KNameSpace(cop);
+
+ /* GroupComponent */
+ CIM_DirectoryRef lmi_dr;
+ /* PartComponent */
+ CIM_LogicalFileRef lmi_lfr;
+ CMPIObjectPath *o;
+ CMPIInstance *ci;
+
+ /* allow only LMI_UnixFile and classes derived from CIM_LogicalFile */
+ if (!check_valid_classes(cop)) {
+ CMReturn(CMPI_RC_OK);
+ }
+
+ CIM_DirectoryRef_Init(&lmi_dr, _cb, ns);
+ CIM_LogicalFileRef_Init(&lmi_lfr, _cb, ns);
+ LMI_DirectoryContainsFile_Init(&lmi_dcf, _cb, ns);
+
+ st = lmi_check_required(_cb, cop, LOGICALFILE);
+ if (st.rc != CMPI_RC_OK) {
+ return st;
+ }
+
+ cd = CMGetKey(cop, "CreationClassName", &st);
+ const char *ccname = KChars(cd.value.string);
+ pathd = CMGetKey(cop, "Name", &st);
+ const char *path = KChars(pathd.value.string);
+
+ if (!strcmp(ccname, LMI_UnixDirectory_ClassName)) {
+ /* got GroupComponent - DirectoryRef */
+ fill_logicalfile(CIM_DirectoryRef, &lmi_dr, path, LMI_UnixDirectory_ClassName);
+ o = CIM_DirectoryRef_ToObjectPath(&lmi_dr, &st);
+ CMSetClassName(o, LMI_UnixDirectory_ClassName);
+ LMI_DirectoryContainsFile_SetObjectPath_GroupComponent(&lmi_dcf, o);
+
+ /* PartComponent */
+ CMPIObjectPath *refs[MAX_REFS];
+ unsigned int count;
+ st = dir_file_objectpaths(cc, cr, properties, ns, path, refs, &count);
+ if (st.rc != CMPI_RC_OK) {
+ return st;
+ }
+ if (count > MAX_REFS) {
+ CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Too many files in a single directory...");
+ }
+ for (unsigned int i = 0; i < count; i++) {
+ LMI_DirectoryContainsFile_SetObjectPath_PartComponent(&lmi_dcf, refs[i]);
+ o = LMI_DirectoryContainsFile_ToObjectPath(&lmi_dcf, &st);
+ if (names) {
+ CMReturnObjectPath(cr, o);
+ } else {
+ ci = LMI_DirectoryContainsFile_ToInstance(&lmi_dcf, &st);
+ CMReturnInstance(cr, ci);
+ }
+ }
+ } else {
+ /* got PartComponent - LogicalFileRef */
+ fill_logicalfile(CIM_LogicalFileRef, &lmi_lfr, path, ccname);
+ o = CIM_LogicalFileRef_ToObjectPath(&lmi_lfr, &st);
+ CMSetClassName(o, ccname);
+ LMI_DirectoryContainsFile_SetObjectPath_PartComponent(&lmi_dcf, o);
+
+ /* GroupComponent */
+ char *aux = strdup(path);
+ fill_logicalfile(CIM_DirectoryRef, &lmi_dr, dirname(aux), LMI_UnixDirectory_ClassName);
+ o = CIM_DirectoryRef_ToObjectPath(&lmi_dr, &st);
+ CMSetClassName(o, LMI_UnixDirectory_ClassName);
+ LMI_DirectoryContainsFile_SetObjectPath_GroupComponent(&lmi_dcf, o);
+ o = LMI_DirectoryContainsFile_ToObjectPath(&lmi_dcf, &st);
+ if (names) {
+ CMReturnObjectPath(cr, o);
+ } else {
+ ci = LMI_DirectoryContainsFile_ToInstance(&lmi_dcf, &st);
+ CMReturnInstance(cr, ci);
+ }
+ free(aux);
+ }
+ CMReturn(CMPI_RC_OK);
+}
+
+static void LMI_DirectoryContainsFileInitialize()
+{
+}
+
+static CMPIStatus LMI_DirectoryContainsFileCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_DirectoryContainsFileEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_DirectoryContainsFileEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_DirectoryContainsFileGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ /* TODO TBI */
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_DirectoryContainsFileCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_DirectoryContainsFileModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char**properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_DirectoryContainsFileDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_DirectoryContainsFileExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_DirectoryContainsFileAssociationCleanup(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+
+static CMPIStatus LMI_DirectoryContainsFileAssociators(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* resultClass,
+ const char* role,
+ const char* resultRole,
+ const char** properties)
+{
+ return associators(mi, cc, cr, cop, assocClass, resultClass, role, resultRole,
+ properties, 0);
+}
+
+static CMPIStatus LMI_DirectoryContainsFileAssociatorNames(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* resultClass,
+ const char* role,
+ const char* resultRole)
+{
+ return associators(mi, cc, cr, cop, assocClass, resultClass, role, resultRole,
+ NULL, 1);
+}
+
+static CMPIStatus LMI_DirectoryContainsFileReferences(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* role,
+ const char** properties)
+{
+ return references(mi, cc, cr, cop, assocClass, role, properties, 0);
+}
+
+static CMPIStatus LMI_DirectoryContainsFileReferenceNames(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* role)
+{
+ return references(mi, cc, cr, cop, assocClass, role, NULL, 1);
+}
+
+CMInstanceMIStub(
+ LMI_DirectoryContainsFile,
+ LMI_DirectoryContainsFile,
+ _cb,
+ LMI_DirectoryContainsFileInitialize())
+
+CMAssociationMIStub(
+ LMI_DirectoryContainsFile,
+ LMI_DirectoryContainsFile,
+ _cb,
+ LMI_DirectoryContainsFileInitialize())
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "LMI_DirectoryContainsFile",
+ "LMI_DirectoryContainsFile",
+ "instance association")
+/* vi: set et: */
diff --git a/src/logicalfile/LMI_FIFOPipeFileProvider.c b/src/logicalfile/LMI_FIFOPipeFileProvider.c
new file mode 100644
index 0000000..8730299
--- /dev/null
+++ b/src/logicalfile/LMI_FIFOPipeFileProvider.c
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Jan Synacek <jsynacek@redhat.com>
+ */
+#include <konkret/konkret.h>
+#include "LMI_FIFOPipeFile.h"
+#include "file.h"
+
+static const CMPIBroker* _cb = NULL;
+
+static void LMI_FIFOPipeFileInitialize()
+{
+}
+
+static CMPIStatus LMI_FIFOPipeFileCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_FIFOPipeFileEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_FIFOPipeFileEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_FIFOPipeFileGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ get_instance(FIFOPipeFile, S_IFIFO, "No such FIFO: %s");
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_FIFOPipeFileCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_FIFOPipeFileModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_FIFOPipeFileDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_FIFOPipeFileExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+CMInstanceMIStub(
+ LMI_FIFOPipeFile,
+ LMI_FIFOPipeFile,
+ _cb,
+ LMI_FIFOPipeFileInitialize())
+
+static CMPIStatus LMI_FIFOPipeFileMethodCleanup(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_FIFOPipeFileInvokeMethod(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* meth,
+ const CMPIArgs* in,
+ CMPIArgs* out)
+{
+ return LMI_FIFOPipeFile_DispatchMethod(
+ _cb, mi, cc, cr, cop, meth, in, out);
+}
+
+CMMethodMIStub(
+ LMI_FIFOPipeFile,
+ LMI_FIFOPipeFile,
+ _cb,
+ LMI_FIFOPipeFileInitialize())
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "LMI_FIFOPipeFile",
+ "LMI_FIFOPipeFile",
+ "instance method")
+/* vi: set et: */
diff --git a/src/logicalfile/LMI_FileIdentityProvider.c b/src/logicalfile/LMI_FileIdentityProvider.c
new file mode 100644
index 0000000..86f3b7f
--- /dev/null
+++ b/src/logicalfile/LMI_FileIdentityProvider.c
@@ -0,0 +1,392 @@
+/*
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Jan Synacek <jsynacek@redhat.com>
+ */
+#include <konkret/konkret.h>
+#include "CIM_LogicalFile.h"
+#include "CIM_UnixFile.h"
+#include "LMI_FileIdentity.h"
+#include "LMI_UnixFile.h"
+#include "LMI_DataFile.h"
+#include "file.h"
+
+static const CMPIBroker* _cb;
+
+static int check_valid_classes(const CMPIObjectPath *o)
+{
+ const char *VALID_CLASSES[] = {
+ "LMI_UnixFile",
+ "LMI_DataFile",
+ "LMI_UnixDeviceFile",
+ "LMI_UnixDirectory",
+ "LMI_FIFOPipeFile",
+ "LMI_SymbolicLink",
+ "LMI_UnixSocket",
+ NULL
+ };
+ int found = 0;
+ for (int i = 0; VALID_CLASSES[i]; i++) {
+ if (CMClassPathIsA(_cb, o, VALID_CLASSES[i], NULL)) {
+ found++;
+ break;
+ }
+ }
+ return found;
+}
+
+static CMPIStatus associators(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* resultClass,
+ const char* role,
+ const char* resultRole,
+ const char** properties,
+ int names)
+{
+ CMPIStatus st, res;
+ CMPIInstance *ci;
+ CMPIObjectPath *o;
+ const char *ns = KNameSpace(cop);
+ CMPIData pathd;
+ CMPIData cd;
+
+ /* allow only LMI_UnixFile and classes derived from CIM_LogicalFile */
+ if (!check_valid_classes(cop)) {
+ CMReturn(CMPI_RC_OK);
+ }
+
+ if (CMClassPathIsA(_cb, cop, LMI_UnixFile_ClassName, &st)) {
+ /* got UnixFile */
+
+ st = lmi_check_required(_cb, cop, UNIXFILE);
+ if (st.rc != CMPI_RC_OK) {
+ return st;
+ }
+
+ pathd = CMGetKey(cop, "LFName", &st);
+ cd = CMGetKey(cop, "LFCreationClassName", &st);
+ const char *path = KChars(pathd.value.string);
+ const char *ccname = KChars(cd.value.string);
+ char fileclass[BUFLEN];
+ get_class_from_path(path, fileclass);
+
+ /* TODO is this error necessary? */
+ if (strcmp(fileclass, ccname)) {
+ CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND,
+ "LMCreationClassName is not correct");
+ }
+
+ CIM_LogicalFileRef cim_lfr;
+ CIM_LogicalFileRef_Init(&cim_lfr, _cb, ns);
+ fill_logicalfile(CIM_LogicalFileRef, &cim_lfr, path, ccname);
+ o = CIM_LogicalFileRef_ToObjectPath(&cim_lfr, &st);
+ CMSetClassName(o, fileclass);
+ } else {
+ /* got LogicalFile */
+
+ st = lmi_check_required(_cb, cop, LOGICALFILE);
+ if (st.rc != CMPI_RC_OK) {
+ return st;
+ }
+
+ pathd = CMGetKey(cop, "Name", &st);
+ cd = CMGetKey(cop, "CreationClassName", &st);
+ const char *path = KChars(pathd.value.string);
+ char fileclass[BUFLEN];
+ get_class_from_path(path, fileclass);
+
+ LMI_UnixFile lmi_uf;
+ LMI_UnixFile_Init(&lmi_uf, _cb, ns);
+ LMI_UnixFile_Set_LFName(&lmi_uf, path);
+ LMI_UnixFile_Set_CSCreationClassName(&lmi_uf, get_system_creation_class_name());
+ LMI_UnixFile_Set_CSName(&lmi_uf, get_system_name());
+ LMI_UnixFile_Set_FSCreationClassName(&lmi_uf, FSCREATIONCLASSNAME);
+ LMI_UnixFile_Set_FSName(&lmi_uf, FSNAME);
+ LMI_UnixFile_Set_LFCreationClassName(&lmi_uf, fileclass);
+ o = LMI_UnixFile_ToObjectPath(&lmi_uf, &st);
+ }
+
+ if (names) {
+ res = CMReturnObjectPath(cr, o);
+ } else {
+ ci = _cb->bft->getInstance(_cb, cc, o, properties, &st);
+ res = CMReturnInstance(cr, ci);
+ }
+ return res;
+}
+
+static CMPIStatus references(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* role,
+ const char** properties,
+ int names)
+{
+ LMI_FileIdentity lmi_fi;
+ CMPIStatus st, res;
+ CMPIData pathd;
+ CMPIData cd;
+ const char *ns = KNameSpace(cop);
+ CMPIInstance *ci;
+ CMPIObjectPath *o;
+
+ /*
+ * allow only LMI_UnixFile and classes derived from CIM_LogicalFile
+ *
+ * XXX this should not be necessary, but FileIdentity.Refereneces() is
+ * called when Linux_ComputerSystem.References() is... server bug?
+ */
+ if (!check_valid_classes(cop)) {
+ CMReturn(CMPI_RC_OK);
+ }
+
+ LMI_FileIdentity_Init(&lmi_fi, _cb, ns);
+
+ if (CMClassPathIsA(_cb, cop, LMI_UnixFile_ClassName, &st)) {
+ /* got UnixFile */
+ LMI_FileIdentity_SetObjectPath_SameElement(&lmi_fi, cop);
+
+ st = lmi_check_required(_cb, cop, UNIXFILE);
+ if (st.rc != CMPI_RC_OK) {
+ return st;
+ }
+
+ pathd = CMGetKey(cop, "LFName", &st);
+ cd = CMGetKey(cop, "LFCreationClassName", &st);
+ const char *path = KChars(pathd.value.string);
+ const char *ccname = KChars(cd.value.string);
+ char fileclass[BUFLEN];
+ get_class_from_path(path, fileclass);
+
+ /* TODO is this error necessary? */
+ if (strcmp(fileclass, ccname)) {
+ CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND,
+ "LMCreationClassName is not correct");
+ }
+
+ /* SystemElement */
+ CIM_LogicalFileRef lmi_lfr;
+ CIM_LogicalFileRef_Init(&lmi_lfr, _cb, ns);
+ fill_logicalfile(CIM_LogicalFileRef, &lmi_lfr, path, ccname);
+ o = CIM_LogicalFileRef_ToObjectPath(&lmi_lfr, &st);
+ CMSetClassName(o, fileclass);
+ LMI_FileIdentity_SetObjectPath_SystemElement(&lmi_fi, o);
+ } else {
+ /* got LogicalFile */
+ LMI_FileIdentity_SetObjectPath_SystemElement(&lmi_fi, cop);
+
+ st = lmi_check_required(_cb, cop, LOGICALFILE);
+ if (st.rc != CMPI_RC_OK) {
+ return st;
+ }
+
+ pathd = CMGetKey(cop, "Name", &st);
+ cd = CMGetKey(cop, "CreationClassName", &st);
+ const char *path = KChars(pathd.value.string);
+ const char *ccname = KChars(cd.value.string);
+
+ /* SameElement */
+ LMI_UnixFile lmi_uf;
+ LMI_UnixFile_Init(&lmi_uf, _cb, ns);
+ LMI_UnixFile_Set_LFName(&lmi_uf, path);
+ LMI_UnixFile_Set_CSCreationClassName(&lmi_uf, get_system_creation_class_name());
+ LMI_UnixFile_Set_CSName(&lmi_uf, get_system_name());
+ LMI_UnixFile_Set_FSCreationClassName(&lmi_uf, FSCREATIONCLASSNAME);
+ LMI_UnixFile_Set_FSName(&lmi_uf, FSNAME);
+ LMI_UnixFile_Set_LFCreationClassName(&lmi_uf, ccname);
+ o = LMI_UnixFile_ToObjectPath(&lmi_uf, &st);
+ LMI_FileIdentity_SetObjectPath_SameElement(&lmi_fi, o);
+ }
+
+ if (names) {
+ o = LMI_FileIdentity_ToObjectPath(&lmi_fi, &st);
+ res = CMReturnObjectPath(cr, o);
+ } else {
+ ci = LMI_FileIdentity_ToInstance(&lmi_fi, &st);
+ res = CMReturnInstance(cr, ci);
+ }
+ return res;
+}
+
+static void LMI_FileIdentityInitialize()
+{
+}
+
+static CMPIStatus LMI_FileIdentityCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_FileIdentityEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_FileIdentityEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_FileIdentityGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ /* TODO TBI */
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_FileIdentityCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_FileIdentityModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char**properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_FileIdentityDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_FileIdentityExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_FileIdentityAssociationCleanup(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_FileIdentityAssociators(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* resultClass,
+ const char* role,
+ const char* resultRole,
+ const char** properties)
+{
+ return associators(mi, cc, cr, cop, assocClass, resultClass,
+ role, resultRole, properties, 0);
+}
+
+static CMPIStatus LMI_FileIdentityAssociatorNames(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* resultClass,
+ const char* role,
+ const char* resultRole)
+{
+ return associators(mi, cc, cr, cop, assocClass, resultClass,
+ role, resultRole, NULL, 1);
+}
+
+static CMPIStatus LMI_FileIdentityReferences(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* role,
+ const char** properties)
+{
+ return references(mi, cc, cr, cop, assocClass, role, properties, 0);
+}
+
+static CMPIStatus LMI_FileIdentityReferenceNames(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* role)
+{
+ return references(mi, cc, cr, cop, assocClass, role, NULL, 1);
+}
+
+CMInstanceMIStub(
+ LMI_FileIdentity,
+ LMI_FileIdentity,
+ _cb,
+ LMI_FileIdentityInitialize())
+
+CMAssociationMIStub(
+ LMI_FileIdentity,
+ LMI_FileIdentity,
+ _cb,
+ LMI_FileIdentityInitialize())
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "LMI_FileIdentity",
+ "LMI_FileIdentity",
+ "instance association")
+/* vi: set et: */
diff --git a/src/logicalfile/LMI_RootDirectoryProvider.c b/src/logicalfile/LMI_RootDirectoryProvider.c
new file mode 100644
index 0000000..6ced12b
--- /dev/null
+++ b/src/logicalfile/LMI_RootDirectoryProvider.c
@@ -0,0 +1,344 @@
+/*
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Jan Synacek <jsynacek@redhat.com>
+ */
+#include <konkret/konkret.h>
+#include "LMI_RootDirectory.h"
+#include "LMI_UnixDirectory.h"
+#include "file.h"
+
+static const CMPIBroker* _cb;
+
+static int check_valid_classes(const CMPIObjectPath *o)
+{
+ const char *VALID_CLASSES[] = {
+ "LMI_UnixDirectory",
+ "Linux_ComputerSystem",
+ NULL
+ };
+ int found = 0;
+ for (int i = 0; VALID_CLASSES[i]; i++) {
+ if (CMClassPathIsA(_cb, o, VALID_CLASSES[i], NULL)) {
+ found++;
+ break;
+ }
+ }
+ return found;
+}
+
+static CMPIStatus associators(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* resultClass,
+ const char* role,
+ const char* resultRole,
+ const char** properties,
+ const int names)
+{
+ CMPIObjectPath *o;
+ CMPIInstance *ci;
+ CMPIStatus st;
+ const char *ns = KNameSpace(cop);
+ const char *comp_ccname = get_system_creation_class_name();
+
+ CMPIData pathd;
+ pathd = CMGetKey(cop, "Name", &st);
+ const char *path = KChars(pathd.value.string);
+
+ /*
+ * allow only LMI_UnixDirectory and Linux_ComputerSystem
+ * XXX
+ */
+ if (!check_valid_classes(cop)) {
+ CMReturn(CMPI_RC_OK);
+ }
+
+ if (CMClassPathIsA(_cb, cop, LMI_UnixDirectory_ClassName, &st)) {
+ /* got LMI_UnixDirectory */
+ /* ignore this association if the directory is not root */
+ if (strcmp(path, "/")) {
+ CMReturn(CMPI_RC_OK);
+ }
+
+ CIM_ComputerSystemRef cim_csr;
+ CIM_ComputerSystemRef_Init(&cim_csr, _cb, ns);
+ CIM_ComputerSystemRef_Set_Name(&cim_csr, get_system_name());
+ CIM_ComputerSystemRef_Set_CreationClassName(&cim_csr, comp_ccname);
+ o = CIM_ComputerSystemRef_ToObjectPath(&cim_csr, &st);
+ CMSetClassName(o, comp_ccname);
+ if (names) {
+ CMReturnObjectPath(cr, o);
+ } else {
+ ci = _cb->bft->getInstance(_cb, cc, o, properties, &st);
+ CMReturnInstance(cr, ci);
+ }
+ } else {
+ /* got Linux_ComputerSystem */
+ LMI_UnixDirectory lmi_ud;
+ LMI_UnixDirectory_Init(&lmi_ud, _cb, ns);
+ fill_logicalfile(LMI_UnixDirectory, &lmi_ud, "/", LMI_UnixDirectory_ClassName);
+ o = LMI_UnixDirectory_ToObjectPath(&lmi_ud, &st);
+ if (names) {
+ CMReturnObjectPath(cr, o);
+ } else {
+ ci = _cb->bft->getInstance(_cb, cc, o, properties, &st);
+ CMReturnInstance(cr, ci);
+ }
+ }
+
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus references(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* role,
+ const char** properties,
+ const int names)
+{
+ LMI_RootDirectory lmi_rd;
+ CMPIObjectPath *o;
+ CMPIInstance *ci;
+ CMPIStatus st;
+ const char *comp_ccname = get_system_creation_class_name();
+ const char *ns = KNameSpace(cop);
+
+ CMPIData pathd;
+ CMPIData cd;
+ pathd = CMGetKey(cop, "Name", &st);
+ cd = CMGetKey(cop, "CreationClassName", &st);
+ const char *path = KChars(pathd.value.string);
+ const char *ccname = KChars(cd.value.string);
+
+ /*
+ * allow only LMI_UnixDirectory and Linux_ComputerSystem
+ * XXX
+ */
+ if (!check_valid_classes(cop)) {
+ CMReturn(CMPI_RC_OK);
+ }
+
+ LMI_RootDirectory_Init(&lmi_rd, _cb, ns);
+
+ if (!strcmp(ccname, LMI_UnixDirectory_ClassName)) {
+ /* got UnixDirectory */
+ /* ignore this association if the directory is not root */
+ if (strcmp(path, "/")) {
+ CMReturn(CMPI_RC_OK);
+ }
+ st = lmi_check_required(_cb, cop, LOGICALFILE);
+ if (st.rc != CMPI_RC_OK) {
+ return st;
+ }
+ LMI_RootDirectory_SetObjectPath_PartComponent(&lmi_rd, cop);
+
+ CIM_ComputerSystemRef cim_csr;
+ CIM_ComputerSystemRef_Init(&cim_csr, _cb, ns);
+ CIM_ComputerSystemRef_Set_Name(&cim_csr, get_system_name());
+ CIM_ComputerSystemRef_Set_CreationClassName(&cim_csr, comp_ccname);
+ o = CIM_ComputerSystemRef_ToObjectPath(&cim_csr, &st);
+ CMSetClassName(o, comp_ccname);
+ LMI_RootDirectory_SetObjectPath_GroupComponent(&lmi_rd, o);
+ } else {
+ /* got Linux_ComputerSystem */
+ LMI_RootDirectory_SetObjectPath_GroupComponent(&lmi_rd, cop);
+
+ LMI_UnixDirectory lmi_ud;
+ LMI_UnixDirectory_Init(&lmi_ud, _cb, ns);
+ fill_logicalfile(LMI_UnixDirectory, &lmi_ud, "/", LMI_UnixDirectory_ClassName);
+ o = LMI_UnixDirectory_ToObjectPath(&lmi_ud, &st);
+ LMI_RootDirectory_SetObjectPath_PartComponent(&lmi_rd, o);
+ }
+
+ if (names) {
+ o = LMI_RootDirectory_ToObjectPath(&lmi_rd, &st);
+ CMReturnObjectPath(cr, o);
+ } else {
+ ci = LMI_RootDirectory_ToInstance(&lmi_rd, &st);
+ CMReturnInstance(cr, ci);
+ }
+ CMReturn(CMPI_RC_OK);
+}
+
+static void LMI_RootDirectoryInitialize()
+{
+}
+
+static CMPIStatus LMI_RootDirectoryCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_RootDirectoryEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_RootDirectoryEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_RootDirectoryGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ /* TODO TBI */
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_RootDirectoryCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_RootDirectoryModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char**properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_RootDirectoryDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_RootDirectoryExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_RootDirectoryAssociationCleanup(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_RootDirectoryAssociators(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* resultClass,
+ const char* role,
+ const char* resultRole,
+ const char** properties)
+{
+ return associators(mi, cc, cr, cop, assocClass, resultClass, role,
+ resultRole, properties, 0);
+}
+
+static CMPIStatus LMI_RootDirectoryAssociatorNames(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* resultClass,
+ const char* role,
+ const char* resultRole)
+{
+ return associators(mi, cc, cr, cop, assocClass, resultClass, role,
+ resultRole, NULL, 1);
+}
+
+static CMPIStatus LMI_RootDirectoryReferences(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* role,
+ const char** properties)
+{
+ return references(mi, cc, cr, cop, assocClass, role, properties, 0);
+}
+
+static CMPIStatus LMI_RootDirectoryReferenceNames(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* role)
+{
+ return references(mi, cc, cr, cop, assocClass, role, NULL, 1);
+}
+
+CMInstanceMIStub(
+ LMI_RootDirectory,
+ LMI_RootDirectory,
+ _cb,
+ LMI_RootDirectoryInitialize())
+
+CMAssociationMIStub(
+ LMI_RootDirectory,
+ LMI_RootDirectory,
+ _cb,
+ LMI_RootDirectoryInitialize())
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "LMI_RootDirectory",
+ "LMI_RootDirectory",
+ "instance association")
+/* vi: set et: */
diff --git a/src/logicalfile/LMI_SymbolicLinkProvider.c b/src/logicalfile/LMI_SymbolicLinkProvider.c
new file mode 100644
index 0000000..c93c087
--- /dev/null
+++ b/src/logicalfile/LMI_SymbolicLinkProvider.c
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Jan Synacek <jsynacek@redhat.com>
+ */
+#include <konkret/konkret.h>
+#include "LMI_SymbolicLink.h"
+#include "file.h"
+
+static const CMPIBroker* _cb = NULL;
+
+static void LMI_SymbolicLinkInitialize()
+{
+}
+
+static CMPIStatus LMI_SymbolicLinkCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_SymbolicLinkEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_SymbolicLinkEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_SymbolicLinkGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ LMI_SymbolicLink lmi_file;
+ const char *path;
+ char rpath[PATH_MAX];
+
+ LMI_SymbolicLink_InitFromObjectPath(&lmi_file, _cb, cop);
+ path = KChars(lmi_file.Name.value);
+ fill_basic(SymbolicLink, path, S_IFLNK, "No such symlink: %s");
+ realpath(path, rpath);
+ LMI_SymbolicLink_Set_TargetFile(&lmi_file, rpath);
+
+ KReturnInstance(cr, lmi_file);
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_SymbolicLinkCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_SymbolicLinkModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_SymbolicLinkDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_SymbolicLinkExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+CMInstanceMIStub(
+ LMI_SymbolicLink,
+ LMI_SymbolicLink,
+ _cb,
+ LMI_SymbolicLinkInitialize())
+
+static CMPIStatus LMI_SymbolicLinkMethodCleanup(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_SymbolicLinkInvokeMethod(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* meth,
+ const CMPIArgs* in,
+ CMPIArgs* out)
+{
+ return LMI_SymbolicLink_DispatchMethod(
+ _cb, mi, cc, cr, cop, meth, in, out);
+}
+
+CMMethodMIStub(
+ LMI_SymbolicLink,
+ LMI_SymbolicLink,
+ _cb,
+ LMI_SymbolicLinkInitialize())
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "LMI_SymbolicLink",
+ "LMI_SymbolicLink",
+ "instance method")
+/* vi: set et: */
diff --git a/src/logicalfile/LMI_UnixDeviceFileProvider.c b/src/logicalfile/LMI_UnixDeviceFileProvider.c
new file mode 100644
index 0000000..e8aa7dd
--- /dev/null
+++ b/src/logicalfile/LMI_UnixDeviceFileProvider.c
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Jan Synacek <jsynacek@redhat.com>
+ */
+#include <konkret/konkret.h>
+#include "LMI_UnixDeviceFile.h"
+#include "file.h"
+
+static const CMPIBroker* _cb = NULL;
+
+static void LMI_UnixDeviceFileInitialize()
+{
+}
+
+static CMPIStatus LMI_UnixDeviceFileCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_UnixDeviceFileEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixDeviceFileEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixDeviceFileGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ LMI_UnixDeviceFile lmi_file;
+ const char *path;
+ char tmp[16];
+
+ LMI_UnixDeviceFile_InitFromObjectPath(&lmi_file, _cb, cop);
+ path = KChars(lmi_file.Name.value);
+ fill_basic(UnixDeviceFile, path, S_IFCHR | S_IFBLK, "No such device: %s");
+
+ sprintf(tmp, "%u", sb.st_rdev);
+ LMI_UnixDeviceFile_Set_DeviceId(&lmi_file, tmp);
+ sprintf(tmp, "%u", major(sb.st_rdev));
+ LMI_UnixDeviceFile_Set_DeviceMajor(&lmi_file, tmp);
+ sprintf(tmp, "%u", minor(sb.st_rdev));
+ LMI_UnixDeviceFile_Set_DeviceMinor(&lmi_file, tmp);
+
+ KReturnInstance(cr, lmi_file);
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_UnixDeviceFileCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixDeviceFileModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixDeviceFileDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixDeviceFileExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+CMInstanceMIStub(
+ LMI_UnixDeviceFile,
+ LMI_UnixDeviceFile,
+ _cb,
+ LMI_UnixDeviceFileInitialize())
+
+static CMPIStatus LMI_UnixDeviceFileMethodCleanup(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_UnixDeviceFileInvokeMethod(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* meth,
+ const CMPIArgs* in,
+ CMPIArgs* out)
+{
+ return LMI_UnixDeviceFile_DispatchMethod(
+ _cb, mi, cc, cr, cop, meth, in, out);
+}
+
+CMMethodMIStub(
+ LMI_UnixDeviceFile,
+ LMI_UnixDeviceFile,
+ _cb,
+ LMI_UnixDeviceFileInitialize())
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "LMI_UnixDeviceFile",
+ "LMI_UnixDeviceFile",
+ "instance method")
+/* vi: set et: */
diff --git a/src/logicalfile/LMI_UnixDirectoryProvider.c b/src/logicalfile/LMI_UnixDirectoryProvider.c
new file mode 100644
index 0000000..6483c43
--- /dev/null
+++ b/src/logicalfile/LMI_UnixDirectoryProvider.c
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Jan Synacek <jsynacek@redhat.com>
+ */
+#include <errno.h>
+#include <unistd.h>
+#include <konkret/konkret.h>
+#include "LMI_UnixDirectory.h"
+#include "file.h"
+
+static const CMPIBroker* _cb = NULL;
+
+static void LMI_UnixDirectoryInitialize()
+{
+}
+
+static CMPIStatus LMI_UnixDirectoryCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixDirectoryEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixDirectoryEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixDirectoryGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ get_instance(UnixDirectory, S_IFDIR, "No such directory: %s");
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_UnixDirectoryCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ LMI_UnixDirectory lmi_ud;
+ LMI_UnixDirectory_InitFromInstance(&lmi_ud, _cb, ci);
+ CMPIStatus st;
+ CMPIObjectPath *iop = CMGetObjectPath(ci, &st);
+ CMPIData pathd = CMGetKey(iop, "Name", &st);
+ const char *path = KChars(pathd.value.string);
+
+ if (mkdir(path, 0777) < 0) {
+ char errmsg[BUFLEN];
+ snprintf(errmsg, BUFLEN, "Can't mkdir: %s (%s)", path, strerror(errno));
+ CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, errmsg);
+ }
+
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_UnixDirectoryModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixDirectoryDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMPIStatus st;
+ CMPIData pathd = CMGetKey(cop, "Name", &st);
+ const char *path = KChars(pathd.value.string);
+
+ if (rmdir(path) < 0) {
+ char errmsg[BUFLEN];
+ snprintf(errmsg, BUFLEN, "Can't mkdir: %s (%s)", path, strerror(errno));
+ CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, errmsg);
+ }
+
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_UnixDirectoryExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+CMInstanceMIStub(
+ LMI_UnixDirectory,
+ LMI_UnixDirectory,
+ _cb,
+ LMI_UnixDirectoryInitialize())
+
+static CMPIStatus LMI_UnixDirectoryMethodCleanup(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_UnixDirectoryInvokeMethod(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* meth,
+ const CMPIArgs* in,
+ CMPIArgs* out)
+{
+ return LMI_UnixDirectory_DispatchMethod(
+ _cb, mi, cc, cr, cop, meth, in, out);
+}
+
+CMMethodMIStub(
+ LMI_UnixDirectory,
+ LMI_UnixDirectory,
+ _cb,
+ LMI_UnixDirectoryInitialize())
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "LMI_UnixDirectory",
+ "LMI_UnixDirectory",
+ "instance method")
+/* vi: set et: */
diff --git a/src/logicalfile/LMI_UnixFileProvider.c b/src/logicalfile/LMI_UnixFileProvider.c
new file mode 100644
index 0000000..937fa04
--- /dev/null
+++ b/src/logicalfile/LMI_UnixFileProvider.c
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Jan Synacek <jsynacek@redhat.com>
+ */
+#include <konkret/konkret.h>
+#include "LMI_UnixFile.h"
+#include "file.h"
+
+static const CMPIBroker* _cb = NULL;
+
+static void LMI_UnixFileInitialize()
+{
+}
+
+static CMPIStatus LMI_UnixFileCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_UnixFileEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixFileEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixFileGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ LMI_UnixFile lmi_file;
+ CMPIStatus st;
+ struct stat sb;
+ char aux[BUFLEN];
+ const char *path;
+
+ st = lmi_check_required(_cb, cop, UNIXFILE);
+ if (st.rc != CMPI_RC_OK) {
+ return st;
+ }
+
+ LMI_UnixFile_InitFromObjectPath(&lmi_file, _cb, cop);
+ path = KChars(lmi_file.LFName.value);
+
+ if (stat(path, &sb) < 0) {
+ snprintf(aux, BUFLEN, "Can't stat file: %s", path);
+ CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, aux);
+ }
+ sprintf(aux, "%u", sb.st_uid);
+ LMI_UnixFile_Set_UserID(&lmi_file, aux);
+ sprintf(aux, "%u", sb.st_gid);
+ LMI_UnixFile_Set_GroupID(&lmi_file, aux);
+ LMI_UnixFile_Set_SetUid(&lmi_file, sb.st_mode & S_IFMT & S_ISUID);
+ LMI_UnixFile_Set_SetGid(&lmi_file, sb.st_mode & S_IFMT & S_ISGID);
+ sprintf(aux, "%u", (unsigned int)sb.st_ino);
+ LMI_UnixFile_Set_FileInodeNumber(&lmi_file, aux);
+ LMI_UnixFile_Set_LinkCount(&lmi_file, sb.st_nlink);
+ /* sticky bit */
+ LMI_UnixFile_Set_SaveText(&lmi_file, sb.st_mode & S_IFMT & S_ISVTX);
+
+ KReturnInstance(cr, lmi_file);
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_UnixFileCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixFileModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixFileDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixFileExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+CMInstanceMIStub(
+ LMI_UnixFile,
+ LMI_UnixFile,
+ _cb,
+ LMI_UnixFileInitialize())
+
+static CMPIStatus LMI_UnixFileMethodCleanup(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_UnixFileInvokeMethod(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* meth,
+ const CMPIArgs* in,
+ CMPIArgs* out)
+{
+ return LMI_UnixFile_DispatchMethod(
+ _cb, mi, cc, cr, cop, meth, in, out);
+}
+
+CMMethodMIStub(
+ LMI_UnixFile,
+ LMI_UnixFile,
+ _cb,
+ LMI_UnixFileInitialize())
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "LMI_UnixFile",
+ "LMI_UnixFile",
+ "instance method")
+/* vi: set et: */
diff --git a/src/logicalfile/LMI_UnixSocketProvider.c b/src/logicalfile/LMI_UnixSocketProvider.c
new file mode 100644
index 0000000..56fb6bd
--- /dev/null
+++ b/src/logicalfile/LMI_UnixSocketProvider.c
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Jan Synacek <jsynacek@redhat.com>
+ */
+#include <konkret/konkret.h>
+#include "LMI_UnixSocket.h"
+#include "file.h"
+
+static const CMPIBroker* _cb = NULL;
+
+static void LMI_UnixSocketInitialize()
+{
+}
+
+static CMPIStatus LMI_UnixSocketCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_UnixSocketEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixSocketEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixSocketGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ get_instance(UnixSocket, S_IFSOCK, "No such socket: %s");
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_UnixSocketCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixSocketModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixSocketDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_UnixSocketExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+CMInstanceMIStub(
+ LMI_UnixSocket,
+ LMI_UnixSocket,
+ _cb,
+ LMI_UnixSocketInitialize())
+
+static CMPIStatus LMI_UnixSocketMethodCleanup(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_UnixSocketInvokeMethod(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* meth,
+ const CMPIArgs* in,
+ CMPIArgs* out)
+{
+ return LMI_UnixSocket_DispatchMethod(
+ _cb, mi, cc, cr, cop, meth, in, out);
+}
+
+CMMethodMIStub(
+ LMI_UnixSocket,
+ LMI_UnixSocket,
+ _cb,
+ LMI_UnixSocketInitialize())
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "LMI_UnixSocket",
+ "LMI_UnixSocket",
+ "instance method")
+/* vi: set et: */
diff --git a/src/logicalfile/file.c b/src/logicalfile/file.c
new file mode 100644
index 0000000..c17f0fc
--- /dev/null
+++ b/src/logicalfile/file.c
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Jan Synacek <jsynacek@redhat.com>
+ */
+#include "file.h"
+
+static const char *LOGICALFILE_REQUIRED_NAMES[] = {
+ "CSCreationClassName",
+ "CSName",
+ "CreationClassName",
+ "FSCreationClassName",
+ "FSName",
+ "Name",
+ NULL
+};
+
+static const char *UNIXFILE_REQUIRED_NAMES[] = {
+ "CSCreationClassName",
+ "CSName",
+ "LFCreationClassName",
+ "FSCreationClassName",
+ "FSName",
+ "LFName",
+ NULL
+};
+
+CMPIStatus lmi_check_required(
+ const CMPIBroker *b,
+ const CMPIObjectPath *o,
+ const enum RequiredNames rn)
+{
+ const char **names;
+
+ switch (rn) {
+ case LOGICALFILE:
+ names = LOGICALFILE_REQUIRED_NAMES;
+ break;
+ case UNIXFILE:
+ names = UNIXFILE_REQUIRED_NAMES;
+ break;
+ default:
+ /* not possible! */
+ assert(0);
+ break;
+ }
+
+ for (int i = 0; names[i]; i++) {
+ if (CMIsNullValue(CMGetKey(o, names[i], NULL))) {
+ char errmsg[BUFLEN];
+ snprintf(errmsg, BUFLEN, "No '%s' specified", names[i]);
+ CMReturnWithChars(b, CMPI_RC_ERR_FAILED, errmsg);
+ }
+ }
+ CMReturn(CMPI_RC_OK);
+}
+
+void get_class_from_stat(const struct stat *sb, char *fileclass) {
+ (S_ISREG(sb->st_mode)) ? strcpy(fileclass, "LMI_DataFile") :
+ (S_ISDIR(sb->st_mode)) ? strcpy(fileclass, "LMI_UnixDirectory") :
+ (S_ISCHR(sb->st_mode)) ? strcpy(fileclass, "LMI_UnixDeviceFile") :
+ (S_ISBLK(sb->st_mode)) ? strcpy(fileclass, "LMI_UnixDeviceFile") :
+ (S_ISLNK(sb->st_mode)) ? strcpy(fileclass, "LMI_SymbolicLink") :
+ (S_ISFIFO(sb->st_mode)) ? strcpy(fileclass, "LMI_FIFOPipeFile") :
+ (S_ISSOCK(sb->st_mode)) ? strcpy(fileclass, "LMI_UnixSocket") :
+ strcpy(fileclass, "Unknown");
+ assert(strcmp(fileclass, "Unknown") != 0);
+}
+
+int get_class_from_path(const char *path, char *fileclass)
+{
+ int rc = 0;
+ struct stat sb;
+
+ if (lstat(path, &sb) < 0) {
+ rc = 1;
+ } else {
+ get_class_from_stat(&sb, fileclass);
+ }
+
+ return rc;
+}
+
+void _dump_objectpath(const CMPIObjectPath *o)
+{
+ printf("OP: %s\n", CMGetCharsPtr(o->ft->toString(o, NULL), NULL));
+}
+/* vi: set et: */
diff --git a/src/logicalfile/file.h b/src/logicalfile/file.h
new file mode 100644
index 0000000..b1b3358
--- /dev/null
+++ b/src/logicalfile/file.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Jan Synacek <jsynacek@redhat.com>
+ */
+#ifndef _FILE_H
+#define _FILE_H
+
+#include <linux/limits.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <libgen.h>
+#include <konkret/konkret.h>
+#include <assert.h>
+#include "globals.h"
+
+#ifndef BUFLEN
+ #define BUFLEN 512
+#endif
+#ifndef PATH_MAX
+ #define PATH_MAX 4096
+#endif
+
+#define FSCREATIONCLASSNAME "FSCCNToBeAgreedOn"
+#define FSNAME "FSNToBeAgreedOn"
+
+#define sb_permmask(sb) ((sb).st_mode & (S_IRWXU | S_IRWXG | S_IRWXO))
+#define sb_isreadable(sb) ( \
+ (sb_permmask(sb) & S_IRUSR) || \
+ (sb_permmask(sb) & S_IRGRP) || \
+ (sb_permmask(sb) & S_IROTH) \
+)
+#define sb_iswriteable(sb) ( \
+ (sb_permmask(sb) & S_IWUSR) || \
+ (sb_permmask(sb) & S_IWGRP) || \
+ (sb_permmask(sb) & S_IWOTH) \
+)
+#define sb_isexecutable(sb) ( \
+ (sb_permmask(sb) & S_IXUSR) || \
+ (sb_permmask(sb) & S_IXGRP) || \
+ (sb_permmask(sb) & S_IXOTH) \
+)
+#define stoms(t) ((t)*1000000)
+
+#define fill_logicalfile(type, obj, name, creation_class) \
+ type##_Set_Name((obj), (name)); \
+ type##_Set_CSCreationClassName((obj), get_system_creation_class_name()); \
+ type##_Set_CSName((obj), get_system_name()); \
+ type##_Set_FSCreationClassName((obj), FSCREATIONCLASSNAME); \
+ type##_Set_FSName((obj), FSNAME); \
+ type##_Set_CreationClassName((obj), (creation_class));
+
+#define fill_basic(cmpitype, path, stattype, error) \
+ struct stat sb; \
+ char errmsg[BUFLEN]; \
+ \
+ if (lstat((path), &sb) < 0 || !(sb.st_mode & S_IFMT & (stattype))) { \
+ snprintf(errmsg, BUFLEN, error, (path)); \
+ CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, errmsg); \
+ } \
+ \
+ LMI_##cmpitype##_Set_Readable(&lmi_file, sb_isreadable(sb)); \
+ LMI_##cmpitype##_Set_Writeable(&lmi_file, sb_iswriteable(sb)); \
+ LMI_##cmpitype##_Set_Executable(&lmi_file, sb_isexecutable(sb)); \
+ LMI_##cmpitype##_Set_FileSize(&lmi_file, sb.st_size); \
+ LMI_##cmpitype##_Set_LastAccessed(&lmi_file, CMNewDateTimeFromBinary(_cb, stoms(sb.st_atime), 0, NULL)); \
+ LMI_##cmpitype##_Set_LastModified(&lmi_file, CMNewDateTimeFromBinary(_cb, stoms(sb.st_mtime), 0, NULL));
+
+#define get_instance(cmpitype, stattype, error) \
+ LMI_##cmpitype lmi_file; \
+ CMPIStatus st; \
+ \
+ LMI_##cmpitype##_InitFromObjectPath(&lmi_file, _cb, cop); \
+ st = lmi_check_required(_cb, cop, LOGICALFILE); \
+ if (st.rc != CMPI_RC_OK) { \
+ return st; \
+ } \
+ fill_basic(cmpitype, KChars(lmi_file.Name.value), stattype, error) \
+ KReturnInstance(cr, lmi_file);
+
+enum RequiredNames {
+ LOGICALFILE,
+ UNIXFILE,
+};
+
+CMPIStatus lmi_check_required(const CMPIBroker *, const CMPIObjectPath *, const enum RequiredNames);
+void get_class_from_stat(const struct stat *, char *);
+int get_class_from_path(const char *, char *);
+
+void _dump_objectpath(const CMPIObjectPath *);
+
+#endif /* _FILE_H */
+/* vi: set et: */
diff --git a/src/power/LMI_AssociatedPowerManagementServiceProvider.c b/src/power/LMI_AssociatedPowerManagementServiceProvider.c
index 3b9847b..fd6ffdb 100644
--- a/src/power/LMI_AssociatedPowerManagementServiceProvider.c
+++ b/src/power/LMI_AssociatedPowerManagementServiceProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/power/LMI_ConcreteJobProvider.c b/src/power/LMI_ConcreteJobProvider.c
index 67ceccc..4841852 100644
--- a/src/power/LMI_ConcreteJobProvider.c
+++ b/src/power/LMI_ConcreteJobProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/power/LMI_ElementCapabilitiesProvider.c b/src/power/LMI_ElementCapabilitiesProvider.c
index d7baf24..3a49518 100644
--- a/src/power/LMI_ElementCapabilitiesProvider.c
+++ b/src/power/LMI_ElementCapabilitiesProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/power/LMI_HostedPowerManagementServiceProvider.c b/src/power/LMI_HostedPowerManagementServiceProvider.c
index 702080c..889dd2c 100644
--- a/src/power/LMI_HostedPowerManagementServiceProvider.c
+++ b/src/power/LMI_HostedPowerManagementServiceProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/power/LMI_PowerManagementCapabilitiesProvider.c b/src/power/LMI_PowerManagementCapabilitiesProvider.c
index fba267e..be6759f 100644
--- a/src/power/LMI_PowerManagementCapabilitiesProvider.c
+++ b/src/power/LMI_PowerManagementCapabilitiesProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/power/LMI_PowerManagementServiceProvider.c b/src/power/LMI_PowerManagementServiceProvider.c
index 8017080..655d594 100644
--- a/src/power/LMI_PowerManagementServiceProvider.c
+++ b/src/power/LMI_PowerManagementServiceProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/power/power.c b/src/power/power.c
index 3423a2a..f5ba71a 100644
--- a/src/power/power.c
+++ b/src/power/power.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/power/power.h b/src/power/power.h
index ceb0ff2..a52eaef 100644
--- a/src/power/power.h
+++ b/src/power/power.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/python/openlmi/common/__init__.py b/src/python/openlmi/common/__init__.py
index 9acc604..2d19515 100644
--- a/src/python/openlmi/common/__init__.py
+++ b/src/python/openlmi/common/__init__.py
@@ -1,6 +1,6 @@
# Software Management Providers
#
-# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/python/openlmi/common/cmpi_logging.py b/src/python/openlmi/common/cmpi_logging.py
index 3e59882..c8755f5 100644
--- a/src/python/openlmi/common/cmpi_logging.py
+++ b/src/python/openlmi/common/cmpi_logging.py
@@ -1,6 +1,6 @@
# -*- Coding:utf-8 -*-
#
-# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/service/LMI_ServiceProvider.c b/src/service/LMI_ServiceProvider.c
index 1a1b411..7c8ffdb 100644
--- a/src/service/LMI_ServiceProvider.c
+++ b/src/service/LMI_ServiceProvider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/service/util/servicedisc.sh b/src/service/util/servicedisc.sh
index 6f95936..8a929a7 100755
--- a/src/service/util/servicedisc.sh
+++ b/src/service/util/servicedisc.sh
@@ -2,7 +2,7 @@
#
# servicedisc.sh
#
-# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/service/util/serviceutil.c b/src/service/util/serviceutil.c
index f5e3b67..bb8a472 100644
--- a/src/service/util/serviceutil.c
+++ b/src/service/util/serviceutil.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -61,7 +61,6 @@ SList *
Service_Find_All(void)
{
char svname[256];
- char cmdbuffer[STATUS_BUFSIZE];
Control *cc = malloc(sizeof(Control));
SList *slist;
diff --git a/src/service/util/serviceutil.h b/src/service/util/serviceutil.h
index e1318ea..055f43f 100644
--- a/src/service/util/serviceutil.h
+++ b/src/service/util/serviceutil.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/src/service/util/serviceutil.sh b/src/service/util/serviceutil.sh
index 5c26651..2172ae2 100755
--- a/src/service/util/serviceutil.sh
+++ b/src/service/util/serviceutil.sh
@@ -2,7 +2,7 @@
#
# serviceutil.sh
#
-# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/cli/software.py b/src/software/cli/software.py
index 39c9f7d..55c3592 100755
--- a/src/software/cli/software.py
+++ b/src/software/cli/software.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -209,7 +209,7 @@ def main(args):
if args.debug:
sys.stderr.write('url:\t%s\n'%args.url)
conn = pywbem.WBEMConnection(args.url, auth)
-
+
if args.command == 'list':
func, attrs = \
{ 'available' : (list_available, tuple())
diff --git a/src/software/openlmi/__init__.py b/src/software/openlmi/__init__.py
index 4a016e8..aa4170a 100644
--- a/src/software/openlmi/__init__.py
+++ b/src/software/openlmi/__init__.py
@@ -1,6 +1,6 @@
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/openlmi/software/LMI_HostedSoftwareCollection.py b/src/software/openlmi/software/LMI_HostedSoftwareCollection.py
index c49ec13..113ce7c 100644
--- a/src/software/openlmi/software/LMI_HostedSoftwareCollection.py
+++ b/src/software/openlmi/software/LMI_HostedSoftwareCollection.py
@@ -1,6 +1,6 @@
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,13 +28,13 @@ from openlmi.common import cmpi_logging
from openlmi.software.core import ComputerSystem, SystemCollection
class LMI_HostedSoftwareCollection(CIMProvider2):
- """Instrument the CIM class LMI_HostedSoftwareCollection
+ """Instrument the CIM class LMI_HostedSoftwareCollection
HostedSoftwareCollection defines a SystemSpecificCollection in the context of a
scoping System. It represents a Collection that has meaning only in
the context of a System, a Collection whose elements are restricted by
the definition of the System, or both of these types of Collections.
-
+
"""
def __init__ (self, _env):
@@ -47,19 +47,19 @@ class LMI_HostedSoftwareCollection(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstance to be returned. The
- key properties are set on this instance to correspond to the
+ model -- A template of the pywbem.CIMInstance to be returned. The
+ key properties are set on this instance to correspond to the
instanceName that was requested. The properties of the model
- are already filtered according to the PropertyList from the
+ are already filtered according to the PropertyList from the
request. Only properties present in the model need to be
- given values. If you prefer, you can set all of the
- values, and the instance will be filtered for you.
+ given values. If you prefer, you can set all of the
+ values, and the instance will be filtered for you.
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -83,17 +83,17 @@ class LMI_HostedSoftwareCollection(CIMProvider2):
"""Enumerate instances.
The WBEM operations EnumerateInstances and EnumerateInstanceNames
- are both mapped to this method.
+ are both mapped to this method.
This method is a python generator
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstances to be generated.
- The properties of the model are already filtered according to
- the PropertyList from the request. Only properties present in
- the model need to be given values. If you prefer, you can
- always set all of the values, and the instance will be filtered
- for you.
+ model -- A template of the pywbem.CIMInstances to be generated.
+ The properties of the model are already filtered according to
+ the PropertyList from the request. Only properties present in
+ the model need to be given values. If you prefer, you can
+ always set all of the values, and the instance will be filtered
+ for you.
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
@@ -103,12 +103,12 @@ class LMI_HostedSoftwareCollection(CIMProvider2):
"""
# Prime model.path with knowledge of the keys, so key values on
# the CIMInstanceName (model.path) will automatically be set when
- # we set property values on the model.
+ # we set property values on the model.
model.path.update({'Dependent': None, 'Antecedent': None})
-
+
model["Antecedent"] = ComputerSystem.get_path()
model["Dependent"] = SystemCollection.get_path()
-
+
yield model
@@ -118,22 +118,22 @@ class LMI_HostedSoftwareCollection(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance -- The new pywbem.CIMInstance. If modifying an existing
- instance, the properties on this instance have been filtered by
+ instance -- The new pywbem.CIMInstance. If modifying an existing
+ instance, the properties on this instance have been filtered by
the PropertyList from the request.
modify_existing -- True if ModifyInstance, False if CreateInstance
- Return the new instance. The keys must be set on the new instance.
+ Return the new instance. The keys must be set on the new instance.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
+ CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
valid if modify_existing is False, indicating that the operation
was CreateInstance)
- CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
+ CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
if modify_existing is True, indicating that the operation
was ModifyInstance)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -147,61 +147,61 @@ class LMI_HostedSoftwareCollection(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance_name -- A pywbem.CIMInstanceName specifying the instance
+ instance_name -- A pywbem.CIMInstanceName specifying the instance
to delete.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
+ CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
namespace)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
- """
+ """
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
-
+
@cmpi_logging.trace_method
def references(self, env, object_name, model, result_class_name, role,
result_role, keys_only):
"""Instrument Associations.
- All four association-related operations (Associators, AssociatorNames,
- References, ReferenceNames) are mapped to this method.
+ All four association-related operations (Associators, AssociatorNames,
+ References, ReferenceNames) are mapped to this method.
This method is a python generator
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName that defines the source
+ object_name -- A pywbem.CIMInstanceName that defines the source
CIM Object whose associated Objects are to be returned.
model -- A template pywbem.CIMInstance to serve as a model
of the objects to be returned. Only properties present on this
- model need to be set.
- result_class_name -- If not empty, this string acts as a filter on
- the returned set of Instances by mandating that each returned
- Instances MUST represent an association between object_name
+ model need to be set.
+ result_class_name -- If not empty, this string acts as a filter on
+ the returned set of Instances by mandating that each returned
+ Instances MUST represent an association between object_name
and an Instance of a Class whose name matches this parameter
- or a subclass.
- role -- If not empty, MUST be a valid Property name. It acts as a
- filter on the returned set of Instances by mandating that each
- returned Instance MUST refer to object_name via a Property
+ or a subclass.
+ role -- If not empty, MUST be a valid Property name. It acts as a
+ filter on the returned set of Instances by mandating that each
+ returned Instance MUST refer to object_name via a Property
whose name matches the value of this parameter.
- result_role -- If not empty, MUST be a valid Property name. It acts
- as a filter on the returned set of Instances by mandating that
- each returned Instance MUST represent associations of
- object_name to other Instances, where the other Instances play
- the specified result_role in the association (i.e. the
- name of the Property in the Association Class that refers to
- the Object related to object_name MUST match the value of this
+ result_role -- If not empty, MUST be a valid Property name. It acts
+ as a filter on the returned set of Instances by mandating that
+ each returned Instance MUST represent associations of
+ object_name to other Instances, where the other Instances play
+ the specified result_role in the association (i.e. the
+ name of the Property in the Association Class that refers to
+ the Object related to object_name MUST match the value of this
parameter).
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
- The following diagram may be helpful in understanding the role,
+ The following diagram may be helpful in understanding the role,
result_role, and result_class_name parameters.
+------------------------+ +-------------------+
| object_name.classname | | result_class_name |
@@ -219,15 +219,15 @@ class LMI_HostedSoftwareCollection(CIMProvider2):
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
CIM_ERR_FAILED (some other unspecified error occurred)
"""
ch = env.get_cimom_handle()
- # If you want to get references for free, implemented in terms
+ # If you want to get references for free, implemented in terms
# of enum_instances, just leave the code below unaltered.
- if ch.is_subclass(object_name.namespace,
+ if ch.is_subclass(object_name.namespace,
sub=object_name.classname,
super='CIM_SystemSpecificCollection') or \
ch.is_subclass(object_name.namespace,
diff --git a/src/software/openlmi/software/LMI_HostedSoftwareIdentityResource.py b/src/software/openlmi/software/LMI_HostedSoftwareIdentityResource.py
index 89ef382..d6e07b0 100644
--- a/src/software/openlmi/software/LMI_HostedSoftwareIdentityResource.py
+++ b/src/software/openlmi/software/LMI_HostedSoftwareIdentityResource.py
@@ -1,6 +1,6 @@
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -61,7 +61,7 @@ def generate_repository_referents(env, object_name, model, _keys_only):
yield model
class LMI_HostedSoftwareIdentityResource(CIMProvider2):
- """Instrument the CIM class LMI_HostedSoftwareIdentityResource
+ """Instrument the CIM class LMI_HostedSoftwareIdentityResource
CIM_HostedAccessPoint is an association between a Service AccessPoint
and the System on which it is provided. The cardinality of this
@@ -70,7 +70,7 @@ class LMI_HostedSoftwareIdentityResource(CIMProvider2):
implementation of the ServiceAccessPoint is modeled, it must be
implemented by a Device or SoftwareFeature that is part of the System
that is hosting the ServiceAccessPoint.
-
+
"""
def __init__ (self, _env):
@@ -83,19 +83,19 @@ class LMI_HostedSoftwareIdentityResource(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstance to be returned. The
- key properties are set on this instance to correspond to the
+ model -- A template of the pywbem.CIMInstance to be returned. The
+ key properties are set on this instance to correspond to the
instanceName that was requested. The properties of the model
- are already filtered according to the PropertyList from the
+ are already filtered according to the PropertyList from the
request. Only properties present in the model need to be
- given values. If you prefer, you can set all of the
- values, and the instance will be filtered for you.
+ given values. If you prefer, you can set all of the
+ values, and the instance will be filtered for you.
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -121,17 +121,17 @@ class LMI_HostedSoftwareIdentityResource(CIMProvider2):
"""Enumerate instances.
The WBEM operations EnumerateInstances and EnumerateInstanceNames
- are both mapped to this method.
+ are both mapped to this method.
This method is a python generator
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstances to be generated.
- The properties of the model are already filtered according to
- the PropertyList from the request. Only properties present in
- the model need to be given values. If you prefer, you can
- always set all of the values, and the instance will be filtered
- for you.
+ model -- A template of the pywbem.CIMInstances to be generated.
+ The properties of the model are already filtered according to
+ the PropertyList from the request. Only properties present in
+ the model need to be given values. If you prefer, you can
+ always set all of the values, and the instance will be filtered
+ for you.
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
@@ -139,12 +139,12 @@ class LMI_HostedSoftwareIdentityResource(CIMProvider2):
CIM_ERR_FAILED (some other unspecified error occurred)
"""
-
+
# Prime model.path with knowledge of the keys, so key values on
# the CIMInstanceName (model.path) will automatically be set when
- # we set property values on the model.
+ # we set property values on the model.
model.path.update({'Dependent': None, 'Antecedent': None})
-
+
repolist = YumDB.get_instance().get_repository_list('all')
model["Antecedent"] = ComputerSystem.get_path()
repomodel = pywbem.CIMInstanceName(
@@ -161,22 +161,22 @@ class LMI_HostedSoftwareIdentityResource(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance -- The new pywbem.CIMInstance. If modifying an existing
- instance, the properties on this instance have been filtered by
+ instance -- The new pywbem.CIMInstance. If modifying an existing
+ instance, the properties on this instance have been filtered by
the PropertyList from the request.
modify_existing -- True if ModifyInstance, False if CreateInstance
- Return the new instance. The keys must be set on the new instance.
+ Return the new instance. The keys must be set on the new instance.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
+ CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
valid if modify_existing is False, indicating that the operation
was CreateInstance)
- CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
+ CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
if modify_existing is True, indicating that the operation
was ModifyInstance)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -191,61 +191,61 @@ class LMI_HostedSoftwareIdentityResource(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance_name -- A pywbem.CIMInstanceName specifying the instance
+ instance_name -- A pywbem.CIMInstanceName specifying the instance
to delete.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
+ CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
namespace)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
- """
+ """
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
-
+
@cmpi_logging.trace_method
def references(self, env, object_name, model, result_class_name, role,
result_role, keys_only):
"""Instrument Associations.
- All four association-related operations (Associators, AssociatorNames,
- References, ReferenceNames) are mapped to this method.
+ All four association-related operations (Associators, AssociatorNames,
+ References, ReferenceNames) are mapped to this method.
This method is a python generator
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName that defines the source
+ object_name -- A pywbem.CIMInstanceName that defines the source
CIM Object whose associated Objects are to be returned.
model -- A template pywbem.CIMInstance to serve as a model
of the objects to be returned. Only properties present on this
- model need to be set.
- result_class_name -- If not empty, this string acts as a filter on
- the returned set of Instances by mandating that each returned
- Instances MUST represent an association between object_name
+ model need to be set.
+ result_class_name -- If not empty, this string acts as a filter on
+ the returned set of Instances by mandating that each returned
+ Instances MUST represent an association between object_name
and an Instance of a Class whose name matches this parameter
- or a subclass.
- role -- If not empty, MUST be a valid Property name. It acts as a
- filter on the returned set of Instances by mandating that each
- returned Instance MUST refer to object_name via a Property
+ or a subclass.
+ role -- If not empty, MUST be a valid Property name. It acts as a
+ filter on the returned set of Instances by mandating that each
+ returned Instance MUST refer to object_name via a Property
whose name matches the value of this parameter.
- result_role -- If not empty, MUST be a valid Property name. It acts
- as a filter on the returned set of Instances by mandating that
- each returned Instance MUST represent associations of
- object_name to other Instances, where the other Instances play
- the specified result_role in the association (i.e. the
- name of the Property in the Association Class that refers to
- the Object related to object_name MUST match the value of this
+ result_role -- If not empty, MUST be a valid Property name. It acts
+ as a filter on the returned set of Instances by mandating that
+ each returned Instance MUST represent associations of
+ object_name to other Instances, where the other Instances play
+ the specified result_role in the association (i.e. the
+ name of the Property in the Association Class that refers to
+ the Object related to object_name MUST match the value of this
parameter).
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
- The following diagram may be helpful in understanding the role,
+ The following diagram may be helpful in understanding the role,
result_role, and result_class_name parameters.
+------------------------+ +-------------------+
| object_name.classname | | result_class_name |
@@ -263,7 +263,7 @@ class LMI_HostedSoftwareIdentityResource(CIMProvider2):
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
CIM_ERR_FAILED (some other unspecified error occurred)
diff --git a/src/software/openlmi/software/LMI_InstalledSoftwareIdentity.py b/src/software/openlmi/software/LMI_InstalledSoftwareIdentity.py
index a0bfa7a..ab4fbea 100644
--- a/src/software/openlmi/software/LMI_InstalledSoftwareIdentity.py
+++ b/src/software/openlmi/software/LMI_InstalledSoftwareIdentity.py
@@ -1,6 +1,6 @@
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -63,14 +63,14 @@ def generate_package_referents(_env, object_name, model, _keys_only):
yield model
class LMI_InstalledSoftwareIdentity(CIMProvider2):
- """Instrument the CIM class LMI_InstalledSoftwareIdentity
+ """Instrument the CIM class LMI_InstalledSoftwareIdentity
The InstalledSoftwareIdentity association identifies the System on
which a SoftwareIdentity is installed. This class is a corollary to
InstalledSoftwareElement, but deals with the asset aspects of software
(as indicated by SoftwareIdentity), versus the deployment aspects (as
indicated by SoftwareElement).
-
+
"""
def __init__ (self, _env):
@@ -83,19 +83,19 @@ class LMI_InstalledSoftwareIdentity(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstance to be returned. The
- key properties are set on this instance to correspond to the
+ model -- A template of the pywbem.CIMInstance to be returned. The
+ key properties are set on this instance to correspond to the
instanceName that was requested. The properties of the model
- are already filtered according to the PropertyList from the
+ are already filtered according to the PropertyList from the
request. Only properties present in the model need to be
- given values. If you prefer, you can set all of the
- values, and the instance will be filtered for you.
+ given values. If you prefer, you can set all of the
+ values, and the instance will be filtered for you.
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -118,17 +118,17 @@ class LMI_InstalledSoftwareIdentity(CIMProvider2):
"""Enumerate instances.
The WBEM operations EnumerateInstances and EnumerateInstanceNames
- are both mapped to this method.
+ are both mapped to this method.
This method is a python generator
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstances to be generated.
- The properties of the model are already filtered according to
- the PropertyList from the request. Only properties present in
- the model need to be given values. If you prefer, you can
- always set all of the values, and the instance will be filtered
- for you.
+ model -- A template of the pywbem.CIMInstances to be generated.
+ The properties of the model are already filtered according to
+ the PropertyList from the request. Only properties present in
+ the model need to be given values. If you prefer, you can
+ always set all of the values, and the instance will be filtered
+ for you.
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
@@ -137,7 +137,7 @@ class LMI_InstalledSoftwareIdentity(CIMProvider2):
"""
# Prime model.path with knowledge of the keys, so key values on
# the CIMInstanceName (model.path) will automatically be set when
- # we set property values on the model.
+ # we set property values on the model.
model.path.update({'InstalledSoftware': None, 'System': None})
model['System'] = ComputerSystem.get_path()
@@ -157,22 +157,22 @@ class LMI_InstalledSoftwareIdentity(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance -- The new pywbem.CIMInstance. If modifying an existing
- instance, the properties on this instance have been filtered by
+ instance -- The new pywbem.CIMInstance. If modifying an existing
+ instance, the properties on this instance have been filtered by
the PropertyList from the request.
modify_existing -- True if ModifyInstance, False if CreateInstance
- Return the new instance. The keys must be set on the new instance.
+ Return the new instance. The keys must be set on the new instance.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
+ CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
valid if modify_existing is False, indicating that the operation
was CreateInstance)
- CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
+ CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
if modify_existing is True, indicating that the operation
was ModifyInstance)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -208,21 +208,21 @@ class LMI_InstalledSoftwareIdentity(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance_name -- A pywbem.CIMInstanceName specifying the instance
+ instance_name -- A pywbem.CIMInstanceName specifying the instance
to delete.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
+ CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
namespace)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
- """
+ """
if not "InstalledSoftware" in instance_name:
raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER,
"Missing InstalledSoftware property.")
@@ -243,38 +243,38 @@ class LMI_InstalledSoftwareIdentity(CIMProvider2):
result_role, keys_only):
"""Instrument Associations.
- All four association-related operations (Associators, AssociatorNames,
- References, ReferenceNames) are mapped to this method.
+ All four association-related operations (Associators, AssociatorNames,
+ References, ReferenceNames) are mapped to this method.
This method is a python generator
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName that defines the source
+ object_name -- A pywbem.CIMInstanceName that defines the source
CIM Object whose associated Objects are to be returned.
model -- A template pywbem.CIMInstance to serve as a model
of the objects to be returned. Only properties present on this
- model need to be set.
- result_class_name -- If not empty, this string acts as a filter on
- the returned set of Instances by mandating that each returned
- Instances MUST represent an association between object_name
+ model need to be set.
+ result_class_name -- If not empty, this string acts as a filter on
+ the returned set of Instances by mandating that each returned
+ Instances MUST represent an association between object_name
and an Instance of a Class whose name matches this parameter
- or a subclass.
- role -- If not empty, MUST be a valid Property name. It acts as a
- filter on the returned set of Instances by mandating that each
- returned Instance MUST refer to object_name via a Property
+ or a subclass.
+ role -- If not empty, MUST be a valid Property name. It acts as a
+ filter on the returned set of Instances by mandating that each
+ returned Instance MUST refer to object_name via a Property
whose name matches the value of this parameter.
- result_role -- If not empty, MUST be a valid Property name. It acts
- as a filter on the returned set of Instances by mandating that
- each returned Instance MUST represent associations of
- object_name to other Instances, where the other Instances play
- the specified result_role in the association (i.e. the
- name of the Property in the Association Class that refers to
- the Object related to object_name MUST match the value of this
+ result_role -- If not empty, MUST be a valid Property name. It acts
+ as a filter on the returned set of Instances by mandating that
+ each returned Instance MUST represent associations of
+ object_name to other Instances, where the other Instances play
+ the specified result_role in the association (i.e. the
+ name of the Property in the Association Class that refers to
+ the Object related to object_name MUST match the value of this
parameter).
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
- The following diagram may be helpful in understanding the role,
+ The following diagram may be helpful in understanding the role,
result_role, and result_class_name parameters.
+------------------------+ +-------------------+
| object_name.classname | | result_class_name |
@@ -292,7 +292,7 @@ class LMI_InstalledSoftwareIdentity(CIMProvider2):
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -302,7 +302,7 @@ class LMI_InstalledSoftwareIdentity(CIMProvider2):
("InstalledSoftware", "LMI_SoftwareIdentity",
generate_package_referents)
]
-
+
for ref in generate_references(env, object_name, model,
result_class_name, role, result_role, keys_only, handlers):
yield ref
diff --git a/src/software/openlmi/software/LMI_MemberOfSoftwareCollection.py b/src/software/openlmi/software/LMI_MemberOfSoftwareCollection.py
index 53cbcb8..1868efa 100644
--- a/src/software/openlmi/software/LMI_MemberOfSoftwareCollection.py
+++ b/src/software/openlmi/software/LMI_MemberOfSoftwareCollection.py
@@ -1,6 +1,6 @@
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -69,7 +69,7 @@ def generate_member_referents(_env, object_name, model, _keys_only):
yield model
class LMI_MemberOfSoftwareCollection(CIMProvider2):
- """Instrument the CIM class LMI_MemberOfSoftwareCollection
+ """Instrument the CIM class LMI_MemberOfSoftwareCollection
LMI_MemberOfSoftwareCollection is an aggregation used to establish
membership of ManagedElements in a Collection.
@@ -85,19 +85,19 @@ class LMI_MemberOfSoftwareCollection(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstance to be returned. The
- key properties are set on this instance to correspond to the
+ model -- A template of the pywbem.CIMInstance to be returned. The
+ key properties are set on this instance to correspond to the
instanceName that was requested. The properties of the model
- are already filtered according to the PropertyList from the
+ are already filtered according to the PropertyList from the
request. Only properties present in the model need to be
- given values. If you prefer, you can set all of the
- values, and the instance will be filtered for you.
+ given values. If you prefer, you can set all of the
+ values, and the instance will be filtered for you.
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -122,17 +122,17 @@ class LMI_MemberOfSoftwareCollection(CIMProvider2):
"""Enumerate instances.
The WBEM operations EnumerateInstances and EnumerateInstanceNames
- are both mapped to this method.
+ are both mapped to this method.
This method is a python generator
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstances to be generated.
- The properties of the model are already filtered according to
- the PropertyList from the request. Only properties present in
- the model need to be given values. If you prefer, you can
- always set all of the values, and the instance will be filtered
- for you.
+ model -- A template of the pywbem.CIMInstances to be generated.
+ The properties of the model are already filtered according to
+ the PropertyList from the request. Only properties present in
+ the model need to be given values. If you prefer, you can
+ always set all of the values, and the instance will be filtered
+ for you.
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
@@ -141,7 +141,7 @@ class LMI_MemberOfSoftwareCollection(CIMProvider2):
"""
# Prime model.path with knowledge of the keys, so key values on
# the CIMInstanceName (model.path) will automatically be set when
- # we set property values on the model.
+ # we set property values on the model.
model.path.update({'Member': None, 'Collection': None})
model['Collection'] = SystemCollection.get_path()
@@ -162,22 +162,22 @@ class LMI_MemberOfSoftwareCollection(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance -- The new pywbem.CIMInstance. If modifying an existing
- instance, the properties on this instance have been filtered by
+ instance -- The new pywbem.CIMInstance. If modifying an existing
+ instance, the properties on this instance have been filtered by
the PropertyList from the request.
modify_existing -- True if ModifyInstance, False if CreateInstance
- Return the new instance. The keys must be set on the new instance.
+ Return the new instance. The keys must be set on the new instance.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
+ CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
valid if modify_existing is False, indicating that the operation
was CreateInstance)
- CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
+ CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
if modify_existing is True, indicating that the operation
was ModifyInstance)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -191,61 +191,61 @@ class LMI_MemberOfSoftwareCollection(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance_name -- A pywbem.CIMInstanceName specifying the instance
+ instance_name -- A pywbem.CIMInstanceName specifying the instance
to delete.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
+ CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
namespace)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
- """
+ """
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
-
+
@cmpi_logging.trace_method
def references(self, env, object_name, model, result_class_name, role,
result_role, keys_only):
"""Instrument Associations.
- All four association-related operations (Associators, AssociatorNames,
- References, ReferenceNames) are mapped to this method.
+ All four association-related operations (Associators, AssociatorNames,
+ References, ReferenceNames) are mapped to this method.
This method is a python generator
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName that defines the source
+ object_name -- A pywbem.CIMInstanceName that defines the source
CIM Object whose associated Objects are to be returned.
model -- A template pywbem.CIMInstance to serve as a model
of the objects to be returned. Only properties present on this
- model need to be set.
- result_class_name -- If not empty, this string acts as a filter on
- the returned set of Instances by mandating that each returned
- Instances MUST represent an association between object_name
+ model need to be set.
+ result_class_name -- If not empty, this string acts as a filter on
+ the returned set of Instances by mandating that each returned
+ Instances MUST represent an association between object_name
and an Instance of a Class whose name matches this parameter
- or a subclass.
- role -- If not empty, MUST be a valid Property name. It acts as a
- filter on the returned set of Instances by mandating that each
- returned Instance MUST refer to object_name via a Property
+ or a subclass.
+ role -- If not empty, MUST be a valid Property name. It acts as a
+ filter on the returned set of Instances by mandating that each
+ returned Instance MUST refer to object_name via a Property
whose name matches the value of this parameter.
- result_role -- If not empty, MUST be a valid Property name. It acts
- as a filter on the returned set of Instances by mandating that
- each returned Instance MUST represent associations of
- object_name to other Instances, where the other Instances play
- the specified result_role in the association (i.e. the
- name of the Property in the Association Class that refers to
- the Object related to object_name MUST match the value of this
+ result_role -- If not empty, MUST be a valid Property name. It acts
+ as a filter on the returned set of Instances by mandating that
+ each returned Instance MUST represent associations of
+ object_name to other Instances, where the other Instances play
+ the specified result_role in the association (i.e. the
+ name of the Property in the Association Class that refers to
+ the Object related to object_name MUST match the value of this
parameter).
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
- The following diagram may be helpful in understanding the role,
+ The following diagram may be helpful in understanding the role,
result_role, and result_class_name parameters.
+------------------------+ +-------------------+
| object_name.classname | | result_class_name |
@@ -263,7 +263,7 @@ class LMI_MemberOfSoftwareCollection(CIMProvider2):
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
CIM_ERR_FAILED (some other unspecified error occurred)
diff --git a/src/software/openlmi/software/LMI_ResourceForSoftwareIdentity.py b/src/software/openlmi/software/LMI_ResourceForSoftwareIdentity.py
index f25a5a2..e7815a7 100644
--- a/src/software/openlmi/software/LMI_ResourceForSoftwareIdentity.py
+++ b/src/software/openlmi/software/LMI_ResourceForSoftwareIdentity.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -70,7 +70,7 @@ def generate_repository_referents(env, object_name, model, _keys_only):
yield model
class LMI_ResourceForSoftwareIdentity(CIMProvider2):
- """Instrument the CIM class LMI_ResourceForSoftwareIdentity
+ """Instrument the CIM class LMI_ResourceForSoftwareIdentity
CIM_SAPAvailableForElement conveys the semantics of a Service Access
Point that is available for a ManagedElement. When
@@ -79,7 +79,7 @@ class LMI_ResourceForSoftwareIdentity(CIMProvider2):
available only for the associated ManagedElements. For example, a
device might provide management access through a URL. This association
allows the URL to be advertised for the device.
-
+
"""
def __init__ (self, _env):
@@ -92,19 +92,19 @@ class LMI_ResourceForSoftwareIdentity(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstance to be returned. The
- key properties are set on this instance to correspond to the
+ model -- A template of the pywbem.CIMInstance to be returned. The
+ key properties are set on this instance to correspond to the
instanceName that was requested. The properties of the model
- are already filtered according to the PropertyList from the
+ are already filtered according to the PropertyList from the
request. Only properties present in the model need to be
- given values. If you prefer, you can set all of the
- values, and the instance will be filtered for you.
+ given values. If you prefer, you can set all of the
+ values, and the instance will be filtered for you.
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
"""
@@ -144,17 +144,17 @@ class LMI_ResourceForSoftwareIdentity(CIMProvider2):
"""Enumerate instances.
The WBEM operations EnumerateInstances and EnumerateInstanceNames
- are both mapped to this method.
+ are both mapped to this method.
This method is a python generator
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstances to be generated.
- The properties of the model are already filtered according to
- the PropertyList from the request. Only properties present in
- the model need to be given values. If you prefer, you can
- always set all of the values, and the instance will be filtered
- for you.
+ model -- A template of the pywbem.CIMInstances to be generated.
+ The properties of the model are already filtered according to
+ the PropertyList from the request. Only properties present in
+ the model need to be given values. If you prefer, you can
+ always set all of the values, and the instance will be filtered
+ for you.
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
@@ -164,9 +164,9 @@ class LMI_ResourceForSoftwareIdentity(CIMProvider2):
"""
# Prime model.path with knowledge of the keys, so key values on
# the CIMInstanceName (model.path) will automatically be set when
- # we set property values on the model.
+ # we set property values on the model.
model.path.update({'ManagedElement': None, 'AvailableSAP': None})
-
+
elem_model = pywbem.CIMInstanceName(
classname="LMI_SoftwareIdentity",
namespace="root/cimv2")
@@ -198,22 +198,22 @@ class LMI_ResourceForSoftwareIdentity(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance -- The new pywbem.CIMInstance. If modifying an existing
- instance, the properties on this instance have been filtered by
+ instance -- The new pywbem.CIMInstance. If modifying an existing
+ instance, the properties on this instance have been filtered by
the PropertyList from the request.
modify_existing -- True if ModifyInstance, False if CreateInstance
- Return the new instance. The keys must be set on the new instance.
+ Return the new instance. The keys must be set on the new instance.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
+ CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
valid if modify_existing is False, indicating that the operation
was CreateInstance)
- CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
+ CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
if modify_existing is True, indicating that the operation
was ModifyInstance)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -227,61 +227,61 @@ class LMI_ResourceForSoftwareIdentity(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance_name -- A pywbem.CIMInstanceName specifying the instance
+ instance_name -- A pywbem.CIMInstanceName specifying the instance
to delete.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
+ CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
namespace)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
- """
+ """
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
-
+
@cmpi_logging.trace_method
def references(self, env, object_name, model, result_class_name, role,
result_role, keys_only):
"""Instrument Associations.
- All four association-related operations (Associators, AssociatorNames,
- References, ReferenceNames) are mapped to this method.
+ All four association-related operations (Associators, AssociatorNames,
+ References, ReferenceNames) are mapped to this method.
This method is a python generator
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName that defines the source
+ object_name -- A pywbem.CIMInstanceName that defines the source
CIM Object whose associated Objects are to be returned.
model -- A template pywbem.CIMInstance to serve as a model
of the objects to be returned. Only properties present on this
- model need to be set.
- result_class_name -- If not empty, this string acts as a filter on
- the returned set of Instances by mandating that each returned
- Instances MUST represent an association between object_name
+ model need to be set.
+ result_class_name -- If not empty, this string acts as a filter on
+ the returned set of Instances by mandating that each returned
+ Instances MUST represent an association between object_name
and an Instance of a Class whose name matches this parameter
- or a subclass.
- role -- If not empty, MUST be a valid Property name. It acts as a
- filter on the returned set of Instances by mandating that each
- returned Instance MUST refer to object_name via a Property
+ or a subclass.
+ role -- If not empty, MUST be a valid Property name. It acts as a
+ filter on the returned set of Instances by mandating that each
+ returned Instance MUST refer to object_name via a Property
whose name matches the value of this parameter.
- result_role -- If not empty, MUST be a valid Property name. It acts
- as a filter on the returned set of Instances by mandating that
- each returned Instance MUST represent associations of
- object_name to other Instances, where the other Instances play
- the specified result_role in the association (i.e. the
- name of the Property in the Association Class that refers to
- the Object related to object_name MUST match the value of this
+ result_role -- If not empty, MUST be a valid Property name. It acts
+ as a filter on the returned set of Instances by mandating that
+ each returned Instance MUST represent associations of
+ object_name to other Instances, where the other Instances play
+ the specified result_role in the association (i.e. the
+ name of the Property in the Association Class that refers to
+ the Object related to object_name MUST match the value of this
parameter).
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
- The following diagram may be helpful in understanding the role,
+ The following diagram may be helpful in understanding the role,
result_role, and result_class_name parameters.
+------------------------+ +-------------------+
| object_name.classname | | result_class_name |
@@ -299,7 +299,7 @@ class LMI_ResourceForSoftwareIdentity(CIMProvider2):
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
CIM_ERR_FAILED (some other unspecified error occurred)
diff --git a/src/software/openlmi/software/LMI_SoftwareIdentity.py b/src/software/openlmi/software/LMI_SoftwareIdentity.py
index 18ef98c..62c9875 100644
--- a/src/software/openlmi/software/LMI_SoftwareIdentity.py
+++ b/src/software/openlmi/software/LMI_SoftwareIdentity.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ from openlmi.software.core import Identity
from openlmi.software.yumdb import YumDB
class LMI_SoftwareIdentity(CIMProvider2):
- """Instrument the CIM class LMI_SoftwareIdentity
+ """Instrument the CIM class LMI_SoftwareIdentity
SoftwareIdentity provides descriptive information about a software
component for asset tracking and/or installation dependency
@@ -65,7 +65,7 @@ class LMI_SoftwareIdentity(CIMProvider2):
software to any LogicalFiles that result from installing it. As above,
there may not be sufficient detail or instrumentation to instantiate
this association.
-
+
"""
def __init__ (self, _env):
@@ -78,19 +78,19 @@ class LMI_SoftwareIdentity(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstance to be returned. The
- key properties are set on this instance to correspond to the
+ model -- A template of the pywbem.CIMInstance to be returned. The
+ key properties are set on this instance to correspond to the
instanceName that was requested. The properties of the model
- are already filtered according to the PropertyList from the
+ are already filtered according to the PropertyList from the
request. Only properties present in the model need to be
- given values. If you prefer, you can set all of the
- values, and the instance will be filtered for you.
+ given values. If you prefer, you can set all of the
+ values, and the instance will be filtered for you.
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -104,17 +104,17 @@ class LMI_SoftwareIdentity(CIMProvider2):
"""Enumerate instances.
The WBEM operations EnumerateInstances and EnumerateInstanceNames
- are both mapped to this method.
+ are both mapped to this method.
This method is a python generator
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstances to be generated.
- The properties of the model are already filtered according to
- the PropertyList from the request. Only properties present in
- the model need to be given values. If you prefer, you can
- always set all of the values, and the instance will be filtered
- for you.
+ model -- A template of the pywbem.CIMInstances to be generated.
+ The properties of the model are already filtered according to
+ the PropertyList from the request. Only properties present in
+ the model need to be given values. If you prefer, you can
+ always set all of the values, and the instance will be filtered
+ for you.
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
@@ -124,7 +124,7 @@ class LMI_SoftwareIdentity(CIMProvider2):
"""
# Prime model.path with knowledge of the keys, so key values on
# the CIMInstanceName (model.path) will automatically be set when
- # we set property values on the model.
+ # we set property values on the model.
model.path.update({'InstanceID': None})
with YumDB.get_instance() as ydb:
@@ -139,22 +139,22 @@ class LMI_SoftwareIdentity(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance -- The new pywbem.CIMInstance. If modifying an existing
- instance, the properties on this instance have been filtered by
+ instance -- The new pywbem.CIMInstance. If modifying an existing
+ instance, the properties on this instance have been filtered by
the PropertyList from the request.
modify_existing -- True if ModifyInstance, False if CreateInstance
- Return the new instance. The keys must be set on the new instance.
+ Return the new instance. The keys must be set on the new instance.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
+ CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
valid if modify_existing is False, indicating that the operation
was CreateInstance)
- CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
+ CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
if modify_existing is True, indicating that the operation
was ModifyInstance)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -168,21 +168,21 @@ class LMI_SoftwareIdentity(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance_name -- A pywbem.CIMInstanceName specifying the instance
+ instance_name -- A pywbem.CIMInstanceName specifying the instance
to delete.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
+ CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
namespace)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
- """
+ """
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
diff --git a/src/software/openlmi/software/LMI_SoftwareIdentityResource.py b/src/software/openlmi/software/LMI_SoftwareIdentityResource.py
index 7cd5bbe..1d1564a 100644
--- a/src/software/openlmi/software/LMI_SoftwareIdentityResource.py
+++ b/src/software/openlmi/software/LMI_SoftwareIdentityResource.py
@@ -1,6 +1,6 @@
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -33,7 +33,7 @@ from openlmi.software.core import IdentityResource
from openlmi.software.yumdb import YumDB, errors
class LMI_SoftwareIdentityResource(CIMProvider2):
- """Instrument the CIM class LMI_SoftwareIdentityResource
+ """Instrument the CIM class LMI_SoftwareIdentityResource
SoftwareIdentityResource describes the URL of a file or other resource
that contains all or part of of a SoftwareIdentity for use by the
@@ -46,7 +46,7 @@ class LMI_SoftwareIdentityResource(CIMProvider2):
SoftwareIdentity class without downloading the entire package.
SoftwareIdentityResources will be related to the SoftwareIdentity
using the SAPAvailableForElement association.
-
+
"""
def __init__ (self, _env):
@@ -59,19 +59,19 @@ class LMI_SoftwareIdentityResource(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstance to be returned. The
- key properties are set on this instance to correspond to the
+ model -- A template of the pywbem.CIMInstance to be returned. The
+ key properties are set on this instance to correspond to the
instanceName that was requested. The properties of the model
- are already filtered according to the PropertyList from the
+ are already filtered according to the PropertyList from the
request. Only properties present in the model need to be
- given values. If you prefer, you can set all of the
- values, and the instance will be filtered for you.
+ given values. If you prefer, you can set all of the
+ values, and the instance will be filtered for you.
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -87,17 +87,17 @@ class LMI_SoftwareIdentityResource(CIMProvider2):
"""Enumerate instances.
The WBEM operations EnumerateInstances and EnumerateInstanceNames
- are both mapped to this method.
+ are both mapped to this method.
This method is a python generator
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstances to be generated.
- The properties of the model are already filtered according to
- the PropertyList from the request. Only properties present in
- the model need to be given values. If you prefer, you can
- always set all of the values, and the instance will be filtered
- for you.
+ model -- A template of the pywbem.CIMInstances to be generated.
+ The properties of the model are already filtered according to
+ the PropertyList from the request. Only properties present in
+ the model need to be given values. If you prefer, you can
+ always set all of the values, and the instance will be filtered
+ for you.
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
@@ -107,10 +107,10 @@ class LMI_SoftwareIdentityResource(CIMProvider2):
"""
# Prime model.path with knowledge of the keys, so key values on
# the CIMInstanceName (model.path) will automatically be set when
- # we set property values on the model.
+ # we set property values on the model.
model.path.update({'CreationClassName': None, 'SystemName': None,
'Name': None, 'SystemCreationClassName': None})
-
+
repolist = YumDB.get_instance().get_repository_list('all')
for repo in repolist:
yield IdentityResource.repo2model(
@@ -122,22 +122,22 @@ class LMI_SoftwareIdentityResource(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance -- The new pywbem.CIMInstance. If modifying an existing
- instance, the properties on this instance have been filtered by
+ instance -- The new pywbem.CIMInstance. If modifying an existing
+ instance, the properties on this instance have been filtered by
the PropertyList from the request.
modify_existing -- True if ModifyInstance, False if CreateInstance
- Return the new instance. The keys must be set on the new instance.
+ Return the new instance. The keys must be set on the new instance.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
+ CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
valid if modify_existing is False, indicating that the operation
was CreateInstance)
- CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
+ CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
if modify_existing is True, indicating that the operation
was ModifyInstance)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -152,25 +152,25 @@ class LMI_SoftwareIdentityResource(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance_name -- A pywbem.CIMInstanceName specifying the instance
+ instance_name -- A pywbem.CIMInstanceName specifying the instance
to delete.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
+ CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
namespace)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
- """
+ """
# TODO removal should also be supported
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
-
+
@cmpi_logging.trace_method
def cim_method_requeststatechange(self, env, object_name,
param_requestedstate=None,
@@ -190,14 +190,14 @@ class LMI_SoftwareIdentityResource(CIMProvider2):
initiated, a ConcreteJob has been created, and its reference
returned in the output parameter Job. Any other return code
indicates an error condition.
-
+
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
- specifying the object on which the method RequestStateChange()
+ object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
+ specifying the object on which the method RequestStateChange()
should be invoked.
param_requestedstate -- The input parameter RequestedState (
- type pywbem.Uint16 Values.RequestStateChange.RequestedState)
+ type pywbem.Uint16 Values.RequestStateChange.RequestedState)
The state requested for the element. This information will be
placed into the RequestedState property of the instance if the
return code of the RequestStateChange method is 0 ('Completed
@@ -205,9 +205,9 @@ class LMI_SoftwareIdentityResource(CIMProvider2):
the description of the EnabledState and RequestedState
properties for the detailed explanations of the RequestedState
values.
-
+
param_timeoutperiod -- The input parameter TimeoutPeriod (
- type pywbem.CIMDateTime)
+ type pywbem.CIMDateTime)
A timeout period that specifies the maximum amount of time that
the client expects the transition to the new state to take.
The interval format must be used to specify the TimeoutPeriod.
@@ -216,7 +216,7 @@ class LMI_SoftwareIdentityResource(CIMProvider2):
does not contain 0 or null and the implementation does not
support this parameter, a return code of 'Use Of Timeout
Parameter Not Supported' shall be returned.
-
+
Returns a two-tuple containing the return value (
type pywbem.Uint32 Values.RequestStateChange)
@@ -224,17 +224,17 @@ class LMI_SoftwareIdentityResource(CIMProvider2):
Output parameters:
Job -- (type REF (pywbem.CIMInstanceName(
- classname='CIM_ConcreteJob', ...))
+ classname='CIM_ConcreteJob', ...))
May contain a reference to the ConcreteJob created to track the
state transition initiated by the method invocation.
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
unrecognized or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
+ CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
exist in the specified namespace)
- CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
+ CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
the invocation request)
CIM_ERR_FAILED (some other unspecified error occurred)
"""
@@ -274,4 +274,4 @@ class LMI_SoftwareIdentityResource(CIMProvider2):
rval = IdentityResource.Values.RequestStateChange. \
Completed_with_No_Error
return (rval, out_params)
-
+
diff --git a/src/software/openlmi/software/LMI_SoftwareInstallationJob.py b/src/software/openlmi/software/LMI_SoftwareInstallationJob.py
index df62f0d..ee12aa0 100644
--- a/src/software/openlmi/software/LMI_SoftwareInstallationJob.py
+++ b/src/software/openlmi/software/LMI_SoftwareInstallationJob.py
@@ -13,11 +13,11 @@ from openlmi.software.core import Error, InstallationJob
from openlmi.software.yumdb import errors, YumDB
class LMI_SoftwareInstallationJob(CIMProvider2):
- """Instrument the CIM class LMI_SoftwareInstallationJob
+ """Instrument the CIM class LMI_SoftwareInstallationJob
A concrete version of Job. This class represents a generic and
instantiable unit of work, such as a batch or a print job.
-
+
"""
def __init__ (self, _env):
@@ -31,19 +31,19 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstance to be returned. The
- key properties are set on this instance to correspond to the
+ model -- A template of the pywbem.CIMInstance to be returned. The
+ key properties are set on this instance to correspond to the
instanceName that was requested. The properties of the model
- are already filtered according to the PropertyList from the
+ are already filtered according to the PropertyList from the
request. Only properties present in the model need to be
- given values. If you prefer, you can set all of the
- values, and the instance will be filtered for you.
+ given values. If you prefer, you can set all of the
+ values, and the instance will be filtered for you.
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
"""
@@ -56,17 +56,17 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
"""Enumerate instances.
The WBEM operations EnumerateInstances and EnumerateInstanceNames
- are both mapped to this method.
+ are both mapped to this method.
This method is a python generator
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstances to be generated.
- The properties of the model are already filtered according to
- the PropertyList from the request. Only properties present in
- the model need to be given values. If you prefer, you can
- always set all of the values, and the instance will be filtered
- for you.
+ model -- A template of the pywbem.CIMInstances to be generated.
+ The properties of the model are already filtered according to
+ the PropertyList from the request. Only properties present in
+ the model need to be given values. If you prefer, you can
+ always set all of the values, and the instance will be filtered
+ for you.
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
@@ -75,9 +75,9 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
"""
# Prime model.path with knowledge of the keys, so key values on
# the CIMInstanceName (model.path) will automatically be set when
- # we set property values on the model.
+ # we set property values on the model.
model.path.update({'InstanceID': None})
-
+
for job in YumDB.get_instance().get_job_list():
yield InstallationJob.job2model(job, keys_only, model)
@@ -87,22 +87,22 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance -- The new pywbem.CIMInstance. If modifying an existing
- instance, the properties on this instance have been filtered by
+ instance -- The new pywbem.CIMInstance. If modifying an existing
+ instance, the properties on this instance have been filtered by
the PropertyList from the request.
modify_existing -- True if ModifyInstance, False if CreateInstance
- Return the new instance. The keys must be set on the new instance.
+ Return the new instance. The keys must be set on the new instance.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
+ CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
valid if modify_existing is False, indicating that the operation
was CreateInstance)
- CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
+ CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
if modify_existing is True, indicating that the operation
was ModifyInstance)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -119,21 +119,21 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance_name -- A pywbem.CIMInstanceName specifying the instance
+ instance_name -- A pywbem.CIMInstanceName specifying the instance
to delete.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
+ CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
namespace)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
- """
+ """
with YumDB.get_instance() as ydb:
job = InstallationJob.object_path2job(instance_name)
try:
@@ -159,15 +159,15 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
requests being overwritten or lost. If 0 is returned, then the
task completed successfully. Any other return code indicates an
error condition.
-
+
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
- specifying the object on which the method RequestStateChange()
+ object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
+ specifying the object on which the method RequestStateChange()
should be invoked.
param_requestedstate -- The input parameter RequestedState (
type pywbem.Uint16
- self.Values.RequestStateChange.RequestedState)
+ self.Values.RequestStateChange.RequestedState)
RequestStateChange changes the state of a job. The possible
values are as follows: Start (2) changes the state to
'Running'. Suspend (3) stops the job temporarily. The
@@ -180,9 +180,9 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
data or preserve the state. Service (6) puts the job into a
vendor-specific service state. It might be possible to restart
the job.
-
+
param_timeoutperiod -- The input parameter TimeoutPeriod (
- type pywbem.CIMDateTime)
+ type pywbem.CIMDateTime)
A timeout period that specifies the maximum amount of time that
the client expects the transition to the new state to take.
The interval format must be used to specify the TimeoutPeriod.
@@ -191,7 +191,7 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
does not contain 0 or null and the implementation does not
support this parameter, a return code of 'Use Of Timeout
Parameter Not Supported' must be returned.
-
+
Returns a two-tuple containing the return value (
type pywbem.Uint32 self.Values.RequestStateChange)
@@ -201,11 +201,11 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
unrecognized or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
+ CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
exist in the specified namespace)
- CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
+ CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
the invocation request)
CIM_ERR_FAILED (some other unspecified error occurred)
"""
@@ -227,7 +227,7 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
raise pywbem.CIMError(pywbem.CIM_ERR_FAILED,
getattr(exc, 'message', str(exc)))
return (self.values.GetErrors.Success, [])
-
+
@cmpi_logging.trace_method
def cim_method_geterrors(self, env, object_name):
"""Implements LMI_SoftwareInstallationJob.GetErrors()
@@ -239,11 +239,11 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
job. If Operatational Status is not "OK" or "Completed"then
GetErrors may return CIM_Error instances related to the running of
the job.
-
+
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
- specifying the object on which the method GetErrors()
+ object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
+ specifying the object on which the method GetErrors()
should be invoked.
Returns a two-tuple containing the return value (
@@ -251,19 +251,19 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
and a list of CIMParameter objects representing the output parameters
Output parameters:
- Errors -- (type pywbem.CIMInstance(classname='CIM_Error', ...))
+ Errors -- (type pywbem.CIMInstance(classname='CIM_Error', ...))
If the OperationalStatus on the Job is not "OK", then this
method will return one or more CIM Error instance(s).
Otherwise, when the Job is "OK", null is returned.
-
+
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
unrecognized or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
+ CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
exist in the specified namespace)
- CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
+ CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
the invocation request)
CIM_ERR_FAILED (some other unspecified error occurred)
"""
@@ -304,17 +304,17 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
'Kill' options to allow this distinction. A method to kill this
job and any underlying processes, and to remove any 'dangling'
associations.
-
+
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
- specifying the object on which the method KillJob()
+ object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
+ specifying the object on which the method KillJob()
should be invoked.
- param_deleteonkill -- The input parameter DeleteOnKill (type bool)
+ param_deleteonkill -- The input parameter DeleteOnKill (type bool)
Indicates whether or not the Job should be automatically
deleted upon termination. This parameter takes precedence over
the property, DeleteOnCompletion.
-
+
Returns a two-tuple containing the return value (
type pywbem.Uint32 self.Values.KillJob)
@@ -324,11 +324,11 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
unrecognized or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
+ CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
exist in the specified namespace)
- CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
+ CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
the invocation request)
CIM_ERR_FAILED (some other unspecified error occurred)
"""
@@ -344,11 +344,11 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
job has failed because of some internal problem or because the job
has been terminated by a client, then a CIM_Error instance is
returned.
-
+
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
- specifying the object on which the method GetError()
+ object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
+ specifying the object on which the method GetError()
should be invoked.
Returns a two-tuple containing the return value (
@@ -356,19 +356,19 @@ class LMI_SoftwareInstallationJob(CIMProvider2):
and a list of CIMParameter objects representing the output parameters
Output parameters:
- Error -- (type pywbem.CIMInstance(classname='CIM_Error', ...))
+ Error -- (type pywbem.CIMInstance(classname='CIM_Error', ...))
If the OperationalStatus on the Job is not "OK", then this
method will return a CIM Error instance. Otherwise, when the
Job is "OK", null is returned.
-
+
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
unrecognized or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
+ CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
exist in the specified namespace)
- CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
+ CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
the invocation request)
CIM_ERR_FAILED (some other unspecified error occurred)
"""
diff --git a/src/software/openlmi/software/LMI_SoftwareInstallationService.py b/src/software/openlmi/software/LMI_SoftwareInstallationService.py
index 97d4887..8d29b3d 100644
--- a/src/software/openlmi/software/LMI_SoftwareInstallationService.py
+++ b/src/software/openlmi/software/LMI_SoftwareInstallationService.py
@@ -1,6 +1,6 @@
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,11 +29,11 @@ from openlmi.software.core import InstallationJob
from openlmi.software.core import InstallationService
class LMI_SoftwareInstallationService(CIMProvider2):
- """Instrument the CIM class LMI_SoftwareInstallationService
+ """Instrument the CIM class LMI_SoftwareInstallationService
A subclass of service which provides methods to install (or update)
Software Identities in ManagedElements.
-
+
"""
def __init__ (self, _env):
@@ -47,19 +47,19 @@ class LMI_SoftwareInstallationService(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstance to be returned. The
- key properties are set on this instance to correspond to the
+ model -- A template of the pywbem.CIMInstance to be returned. The
+ key properties are set on this instance to correspond to the
instanceName that was requested. The properties of the model
- are already filtered according to the PropertyList from the
+ are already filtered according to the PropertyList from the
request. Only properties present in the model need to be
- given values. If you prefer, you can set all of the
- values, and the instance will be filtered for you.
+ given values. If you prefer, you can set all of the
+ values, and the instance will be filtered for you.
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -95,17 +95,17 @@ class LMI_SoftwareInstallationService(CIMProvider2):
"""Enumerate instances.
The WBEM operations EnumerateInstances and EnumerateInstanceNames
- are both mapped to this method.
+ are both mapped to this method.
This method is a python generator
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstances to be generated.
- The properties of the model are already filtered according to
- the PropertyList from the request. Only properties present in
- the model need to be given values. If you prefer, you can
- always set all of the values, and the instance will be filtered
- for you.
+ model -- A template of the pywbem.CIMInstances to be generated.
+ The properties of the model are already filtered according to
+ the PropertyList from the request. Only properties present in
+ the model need to be given values. If you prefer, you can
+ always set all of the values, and the instance will be filtered
+ for you.
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
@@ -114,7 +114,7 @@ class LMI_SoftwareInstallationService(CIMProvider2):
"""
model.path.update({'CreationClassName': None, 'SystemName': None,
'Name': None, 'SystemCreationClassName': None})
-
+
objpath = InstallationService.get_path()
for key, value in objpath.keybindings.items():
model[key] = value
@@ -128,22 +128,22 @@ class LMI_SoftwareInstallationService(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance -- The new pywbem.CIMInstance. If modifying an existing
- instance, the properties on this instance have been filtered by
+ instance -- The new pywbem.CIMInstance. If modifying an existing
+ instance, the properties on this instance have been filtered by
the PropertyList from the request.
modify_existing -- True if ModifyInstance, False if CreateInstance
- Return the new instance. The keys must be set on the new instance.
+ Return the new instance. The keys must be set on the new instance.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
+ CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
valid if modify_existing is False, indicating that the operation
was CreateInstance)
- CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
+ CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
if modify_existing is True, indicating that the operation
was ModifyInstance)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -157,24 +157,24 @@ class LMI_SoftwareInstallationService(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance_name -- A pywbem.CIMInstanceName specifying the instance
+ instance_name -- A pywbem.CIMInstanceName specifying the instance
to delete.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
+ CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
namespace)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
- """
+ """
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
-
+
@cmpi_logging.trace_method
def cim_method_requeststatechange(self, env, object_name,
param_requestedstate=None,
@@ -194,14 +194,14 @@ class LMI_SoftwareInstallationService(CIMProvider2):
initiated, a ConcreteJob has been created, and its reference
returned in the output parameter Job. Any other return code
indicates an error condition.
-
+
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
- specifying the object on which the method RequestStateChange()
+ object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
+ specifying the object on which the method RequestStateChange()
should be invoked.
param_requestedstate -- The input parameter RequestedState (
- type pywbem.Uint16 self.Values.RequestStateChange.RequestedState)
+ type pywbem.Uint16 self.Values.RequestStateChange.RequestedState)
The state requested for the element. This information will be
placed into the RequestedState property of the instance if the
return code of the RequestStateChange method is 0 ('Completed
@@ -209,9 +209,9 @@ class LMI_SoftwareInstallationService(CIMProvider2):
the description of the EnabledState and RequestedState
properties for the detailed explanations of the RequestedState
values.
-
+
param_timeoutperiod -- The input parameter TimeoutPeriod (
- type pywbem.CIMDateTime)
+ type pywbem.CIMDateTime)
A timeout period that specifies the maximum amount of time that
the client expects the transition to the new state to take.
The interval format must be used to specify the TimeoutPeriod.
@@ -220,7 +220,7 @@ class LMI_SoftwareInstallationService(CIMProvider2):
does not contain 0 or null and the implementation does not
support this parameter, a return code of 'Use Of Timeout
Parameter Not Supported' shall be returned.
-
+
Returns a two-tuple containing the return value (
type pywbem.Uint32 self.Values.RequestStateChange)
@@ -231,15 +231,15 @@ class LMI_SoftwareInstallationService(CIMProvider2):
classname='CIM_ConcreteJob', ...))
May contain a reference to the ConcreteJob created to track the
state transition initiated by the method invocation.
-
+
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
unrecognized or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
+ CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
exist in the specified namespace)
- CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
+ CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
the invocation request)
CIM_ERR_FAILED (some other unspecified error occurred)
"""
@@ -247,7 +247,7 @@ class LMI_SoftwareInstallationService(CIMProvider2):
out_params += [pywbem.CIMParameter('Job', type='reference', value=None)]
return ( self.values.RequestStateChange.Not_Supported
, out_params)
-
+
@cmpi_logging.trace_method
def cim_method_stopservice(self, env, object_name):
"""Implements LMI_SoftwareInstallationService.StopService()
@@ -268,11 +268,11 @@ class LMI_SoftwareInstallationService(CIMProvider2):
inherited from EnabledLogicalElement. This method is maintained
because it has been widely implemented, and its simple "stop"
semantics are convenient to use.
-
+
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
- specifying the object on which the method StopService()
+ object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
+ specifying the object on which the method StopService()
should be invoked.
Returns a two-tuple containing the return value (type pywbem.Uint32)
@@ -282,18 +282,18 @@ class LMI_SoftwareInstallationService(CIMProvider2):
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
unrecognized or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
+ CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
exist in the specified namespace)
- CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
+ CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
the invocation request)
CIM_ERR_FAILED (some other unspecified error occurred)
"""
rval = pywbem.Uint32(1) # Not Supported
return (rval, [])
-
+
@cmpi_logging.trace_method
def cim_method_installfromuri(self, env, object_name,
param_installoptionsvalues=None,
@@ -311,14 +311,14 @@ class LMI_SoftwareInstallationService(CIMProvider2):
If 4096/0x1000 is returned, a ConcreteJob will be started to to
perform the install. The Job's reference will be returned in the
output parameter Job.
-
+
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
- specifying the object on which the method InstallFromURI()
+ object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
+ specifying the object on which the method InstallFromURI()
should be invoked.
param_installoptionsvalues -- The input parameter \
- InstallOptionsValues (type [unicode,])
+ InstallOptionsValues (type [unicode,])
InstallOptionsValues is an array of strings providing
additionalinformation to InstallOptions for the method to
install the software. Each entry of this array is related to
@@ -329,21 +329,21 @@ class LMI_SoftwareInstallationService(CIMProvider2):
parameter of the
InstallationService.InstallFromSoftwareIdentity
method.
-
- param_uri -- The input parameter URI (type unicode)
+
+ param_uri -- The input parameter URI (type unicode)
A URI for the software based on RFC 2079.
-
+
param_installoptions -- The input parameter InstallOptions (
type [pywbem.Uint16,] self.Values.InstallFromURI.InstallOptions)
Options to control the install process. See the InstallOptions
parameter of the
InstallationService.InstallFromSoftwareIdentity method
for the description of these values.
-
+
param_target -- The input parameter Target (type REF (
- pywbem.CIMInstanceName(classname='CIM_ManagedElement', ...))
+ pywbem.CIMInstanceName(classname='CIM_ManagedElement', ...))
The installation target.
-
+
Returns a two-tuple containing the return value (
type pywbem.Uint32 self.Values.InstallFromURI)
@@ -351,17 +351,17 @@ class LMI_SoftwareInstallationService(CIMProvider2):
Output parameters:
Job -- (type REF (pywbem.CIMInstanceName(
- classname='CIM_ConcreteJob', ...))
+ classname='CIM_ConcreteJob', ...))
Reference to the job (may be null if job completed).
-
+
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
unrecognized or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
+ CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
exist in the specified namespace)
- CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
+ CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
the invocation request)
CIM_ERR_FAILED (some other unspecified error occurred)
"""
@@ -379,7 +379,7 @@ class LMI_SoftwareInstallationService(CIMProvider2):
"installation failed: %s", exc.description)
rval = exc.return_code
return (rval, out_params)
-
+
@cmpi_logging.trace_method
def cim_method_checksoftwareidentity(self, env, object_name,
param_source=None,
@@ -397,23 +397,23 @@ class LMI_SoftwareInstallationService(CIMProvider2):
parameters. The Collection parameter is only supported if
SoftwareInstallationServiceCapabilities.CanAddToCollection is
TRUE.
-
+
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
- specifying the object on which the method CheckSoftwareIdentity()
+ object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
+ specifying the object on which the method CheckSoftwareIdentity()
should be invoked.
param_source -- The input parameter Source (type REF (
- pywbem.CIMInstanceName(classname='CIM_SoftwareIdentity', ...))
+ pywbem.CIMInstanceName(classname='CIM_SoftwareIdentity', ...))
Reference to the SoftwareIdentity to be checked.
-
+
param_target -- The input parameter Target (type REF (
- pywbem.CIMInstanceName(classname='CIM_ManagedElement', ...))
+ pywbem.CIMInstanceName(classname='CIM_ManagedElement', ...))
Reference to the ManagedElement that the Software Identity is
going to be installed in (or updated).
-
+
param_collection -- The input parameter Collection (type REF (
- pywbem.CIMInstanceName(classname='CIM_Collection', ...))
+ pywbem.CIMInstanceName(classname='CIM_Collection', ...))
Reference to the Collection to which the Software Identity will
be added.
@@ -423,7 +423,7 @@ class LMI_SoftwareInstallationService(CIMProvider2):
Output parameters:
InstallCharacteristics -- (type [pywbem.Uint16,]
- self.Values.CheckSoftwareIdentity.InstallCharacteristics)
+ self.Values.CheckSoftwareIdentity.InstallCharacteristics)
The parameter describes the characteristics of the
installation/update that will take place if the Source
Software Identity is installed: Target automatic reset: The
@@ -433,11 +433,11 @@ class LMI_SoftwareInstallationService(CIMProvider2):
system itself) will automatically reset/reboot once the
installation is complete. Separate target reset required:
EnabledLogicalElement.RequestStateChange MUST be used to reset
- the target element after the SoftwareIdentity is installed.
+ the target element after the SoftwareIdentity is installed.
Separate system reset required:
EnabledLogicalElement.RequestStateChange MUST be used to
reset/reboot the containing system of the target
- ManagedElement after the SoftwareIdentity is installed.
+ ManagedElement after the SoftwareIdentity is installed.
Manual Reboot Required: The system MUST be manually rebooted
by the user. No reboot required : No reboot is required after
installation. User Intervention Recomended : It is
@@ -448,16 +448,16 @@ class LMI_SoftwareInstallationService(CIMProvider2):
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
unrecognized or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
+ CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
exist in the specified namespace)
- CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
+ CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
the invocation request)
CIM_ERR_FAILED (some other unspecified error occurred)
"""
raise pywbem.CIMError(pywbem.CIM_ERR_METHOD_NOT_AVAILABLE)
-
+
@cmpi_logging.trace_method
def cim_method_changeaffectedelementsassignedsequence(self,
env, object_name,
@@ -498,23 +498,23 @@ class LMI_SoftwareInstallationService(CIMProvider2):
instance via CIM_ServiceAffectsElement and are not present in the
ManagedElements parameter array, the AssignedSequence property on
the CIM_ServiceAffects association shall be assigned a value of 0.
-
+
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
+ object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
specifying the object on which the method
ChangeAffectedElementsAssignedSequence() should be invoked.
param_managedelements -- The input parameter ManagedElements (
type REF (pywbem.CIMInstanceName(
classname='CIM_ManagedElement', ...)) (Required)
An array of ManagedElements.
-
+
param_assignedsequence -- The input parameter AssignedSequence (
type [pywbem.Uint16,]) (Required)
An array of integers representing AssignedSequence for the
ManagedElement in the corresponding index of the
ManagedElements parameter.
-
+
Returns a two-tuple containing the return value (
type pywbem.Uint32 self.Values. \
@@ -523,18 +523,18 @@ class LMI_SoftwareInstallationService(CIMProvider2):
Output parameters:
Job -- (type REF (pywbem.CIMInstanceName(
- classname='CIM_ConcreteJob', ...))
+ classname='CIM_ConcreteJob', ...))
Reference to the job spawned if the operation continues after
the method returns. (May be null if the task is completed).
-
+
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
unrecognized or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
+ CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
exist in the specified namespace)
- CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
+ CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
the invocation request)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -562,16 +562,16 @@ class LMI_SoftwareInstallationService(CIMProvider2):
and no ConcreteJob instance was required. If 4096/0x1000 is
returned, a ConcreteJob will be started to perform the install.
The Job's reference will be returned in the output parameter Job.
-
+
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
+ object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
specifying the object on which the method
- InstallFromSoftwareIdentity()
+ InstallFromSoftwareIdentity()
should be invoked.
param_installoptions -- The input parameter InstallOptions (
type [pywbem.Uint16,] self.Values.InstallFromSoftwareIdentity.\
- InstallOptions)
+ InstallOptions)
Options to control the install process. Defer target/system
reset : do not automatically reset the target/system. Force
installation : Force the installation of the same or an older
@@ -592,26 +592,26 @@ class LMI_SoftwareInstallationService(CIMProvider2):
software in the administrative mode. ScheduleInstallAt:
Indicates the time at which theinstall or update of the
software will occur.
-
+
param_target -- The input parameter Target (type REF (
- pywbem.CIMInstanceName(classname='CIM_ManagedElement', ...))
+ pywbem.CIMInstanceName(classname='CIM_ManagedElement', ...))
The installation target. If NULL then the SOftwareIdentity will
be added to Collection only. The underlying implementation is
expected to be able to obtain any necessary metadata from the
Software Identity.
-
+
param_collection -- The input parameter Collection (type REF (
- pywbem.CIMInstanceName(classname='CIM_Collection', ...))
+ pywbem.CIMInstanceName(classname='CIM_Collection', ...))
Reference to the Collection to which the Software Identity
SHALL be added. If NULL then the SOftware Identity will not be
added to a Collection.
-
+
param_source -- The input parameter Source (type REF (
- pywbem.CIMInstanceName(classname='CIM_SoftwareIdentity', ...))
+ pywbem.CIMInstanceName(classname='CIM_SoftwareIdentity', ...))
Reference to the source of the install.
-
+
param_installoptionsvalues -- The input parameter
- InstallOptionsValues (type [unicode,])
+ InstallOptionsValues (type [unicode,])
InstallOptionsValues is an array of strings providing
additional information to InstallOptions for the method to
install the software. Each entry of this array is related to
@@ -629,7 +629,7 @@ class LMI_SoftwareInstallationService(CIMProvider2):
"Force installation","Install", "Update", "Repair" or "Reboot"
then a value at the corresponding index of InstallOptionValues
shall be NULL.
-
+
Returns a two-tuple containing the return value (
type pywbem.Uint32 self.Values.InstallFromSoftwareIdentity)
@@ -637,16 +637,16 @@ class LMI_SoftwareInstallationService(CIMProvider2):
Output parameters:
Job -- (type REF (pywbem.CIMInstanceName(
- classname='CIM_ConcreteJob', ...))
+ classname='CIM_ConcreteJob', ...))
Reference to the job (may be null if job completed).
-
+
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
unrecognized or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
+ CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
exist in the specified namespace)
- CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
+ CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
the invocation request)
CIM_ERR_FAILED (some other unspecified error occurred)
"""
@@ -665,7 +665,7 @@ class LMI_SoftwareInstallationService(CIMProvider2):
"installation failed: %s", exc.description)
rval = exc.return_code
return (rval, out_params)
-
+
@cmpi_logging.trace_method
def cim_method_startservice(self, env, object_name):
"""Implements LMI_SoftwareInstallationService.StartService()
@@ -686,11 +686,11 @@ class LMI_SoftwareInstallationService(CIMProvider2):
inherited from EnabledLogicalElement. This method is maintained
because it has been widely implemented, and its simple "start"
semantics are convenient to use.
-
+
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
- specifying the object on which the method StartService()
+ object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
+ specifying the object on which the method StartService()
should be invoked.
Returns a two-tuple containing the return value (type pywbem.Uint32)
@@ -700,17 +700,17 @@ class LMI_SoftwareInstallationService(CIMProvider2):
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
unrecognized or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
+ CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
exist in the specified namespace)
- CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
+ CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
the invocation request)
CIM_ERR_FAILED (some other unspecified error occurred)
"""
rval = pywbem.Uint32(1) # Not Supported
return (rval, [])
-
+
@cmpi_logging.trace_method
def cim_method_installfrombytestream(self, env, object_name,
param_installoptionsvalues=None,
@@ -728,13 +728,13 @@ class LMI_SoftwareInstallationService(CIMProvider2):
required. If 4096/0x1000 is returned, a ConcreteJob will be
started to to perform the install. The Job's reference will be
returned in the output parameter Job.
-
+
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
- specifying the object on which the method InstallFromByteStream()
+ object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
+ specifying the object on which the method InstallFromByteStream()
should be invoked.
- param_installoptionsvalues -- The input parameter InstallOptionsValues (type [unicode,])
+ param_installoptionsvalues -- The input parameter InstallOptionsValues (type [unicode,])
InstallOptionsValues is an array of strings providing
additional information to InstallOptions for the method to
install the software. Each entry of this array is related to
@@ -745,35 +745,35 @@ class LMI_SoftwareInstallationService(CIMProvider2):
parameter of the
InstallationService.InstallFromSoftwareIdentity
method.
-
- param_image -- The input parameter Image (type [pywbem.Uint8,])
+
+ param_image -- The input parameter Image (type [pywbem.Uint8,])
A array of bytes containing the install image.
-
- param_installoptions -- The input parameter InstallOptions (type [pywbem.Uint16,] self.Values.InstallFromByteStream.InstallOptions)
+
+ param_installoptions -- The input parameter InstallOptions (type [pywbem.Uint16,] self.Values.InstallFromByteStream.InstallOptions)
Options to control the install process. See the InstallOptions
parameter of the
InstallationService.InstallFromSoftwareIdentity method
for the description of these values.
-
- param_target -- The input parameter Target (type REF (pywbem.CIMInstanceName(classname='CIM_ManagedElement', ...))
+
+ param_target -- The input parameter Target (type REF (pywbem.CIMInstanceName(classname='CIM_ManagedElement', ...))
The installation target.
-
+
Returns a two-tuple containing the return value (type pywbem.Uint32 self.Values.InstallFromByteStream)
and a list of CIMParameter objects representing the output parameters
Output parameters:
- Job -- (type REF (pywbem.CIMInstanceName(classname='CIM_ConcreteJob', ...))
+ Job -- (type REF (pywbem.CIMInstanceName(classname='CIM_ConcreteJob', ...))
Reference to the job (may be null if job completed).
-
+
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
unrecognized or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
+ CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
exist in the specified namespace)
- CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
+ CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
the invocation request)
CIM_ERR_FAILED (some other unspecified error occurred)
diff --git a/src/software/openlmi/software/LMI_SystemSoftwareCollection.py b/src/software/openlmi/software/LMI_SystemSoftwareCollection.py
index fb43dc4..a392994 100644
--- a/src/software/openlmi/software/LMI_SystemSoftwareCollection.py
+++ b/src/software/openlmi/software/LMI_SystemSoftwareCollection.py
@@ -1,6 +1,6 @@
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ from openlmi.common import cmpi_logging
from openlmi.software.core import SystemCollection
class LMI_SystemSoftwareCollection(CIMProvider2):
- """Instrument the CIM class LMI_SystemSoftwareCollection
+ """Instrument the CIM class LMI_SystemSoftwareCollection
SystemSoftwareCollection represents the general concept of a collection
that is scoped (or contained) by a System. It represents a Collection
@@ -42,7 +42,7 @@ class LMI_SystemSoftwareCollection(CIMProvider2):
in the domain. In other words, the context of the Collection is
restricted to the domain, and its members are also limited by the
domain.
-
+
"""
def __init__ (self, _env):
@@ -55,19 +55,19 @@ class LMI_SystemSoftwareCollection(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstance to be returned. The
- key properties are set on this instance to correspond to the
+ model -- A template of the pywbem.CIMInstance to be returned. The
+ key properties are set on this instance to correspond to the
instanceName that was requested. The properties of the model
- are already filtered according to the PropertyList from the
+ are already filtered according to the PropertyList from the
request. Only properties present in the model need to be
- given values. If you prefer, you can set all of the
- values, and the instance will be filtered for you.
+ given values. If you prefer, you can set all of the
+ values, and the instance will be filtered for you.
Possible Errors:
CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -80,8 +80,8 @@ class LMI_SystemSoftwareCollection(CIMProvider2):
"No such instance.")
model['Caption'] = "System RPM Package Collection"
- #model['Description'] = '' # TODO
- #model['ElementName'] = '' # TODO
+ #model['Description'] = '' # TODO
+ #model['ElementName'] = '' # TODO
return model
@cmpi_logging.trace_method
@@ -89,17 +89,17 @@ class LMI_SystemSoftwareCollection(CIMProvider2):
"""Enumerate instances.
The WBEM operations EnumerateInstances and EnumerateInstanceNames
- are both mapped to this method.
+ are both mapped to this method.
This method is a python generator
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstances to be generated.
- The properties of the model are already filtered according to
- the PropertyList from the request. Only properties present in
- the model need to be given values. If you prefer, you can
- always set all of the values, and the instance will be filtered
- for you.
+ model -- A template of the pywbem.CIMInstances to be generated.
+ The properties of the model are already filtered according to
+ the PropertyList from the request. Only properties present in
+ the model need to be given values. If you prefer, you can
+ always set all of the values, and the instance will be filtered
+ for you.
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
@@ -109,9 +109,9 @@ class LMI_SystemSoftwareCollection(CIMProvider2):
"""
# Prime model.path with knowledge of the keys, so key values on
# the CIMInstanceName (model.path) will automatically be set when
- # we set property values on the model.
+ # we set property values on the model.
model.path.update({'InstanceID': None})
-
+
model['InstanceID'] = SystemCollection.get_path()["InstanceID"]
if keys_only is False:
yield self.get_instance(env, model)
@@ -124,22 +124,22 @@ class LMI_SystemSoftwareCollection(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance -- The new pywbem.CIMInstance. If modifying an existing
- instance, the properties on this instance have been filtered by
+ instance -- The new pywbem.CIMInstance. If modifying an existing
+ instance, the properties on this instance have been filtered by
the PropertyList from the request.
modify_existing -- True if ModifyInstance, False if CreateInstance
- Return the new instance. The keys must be set on the new instance.
+ Return the new instance. The keys must be set on the new instance.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
+ CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
valid if modify_existing is False, indicating that the operation
was CreateInstance)
- CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
+ CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
if modify_existing is True, indicating that the operation
was ModifyInstance)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -153,21 +153,21 @@ class LMI_SystemSoftwareCollection(CIMProvider2):
Keyword arguments:
env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance_name -- A pywbem.CIMInstanceName specifying the instance
+ instance_name -- A pywbem.CIMInstanceName specifying the instance
to delete.
Possible Errors:
CIM_ERR_ACCESS_DENIED
CIM_ERR_NOT_SUPPORTED
CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
- CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
+ CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
namespace)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
Instance does not exist in the specified namespace)
CIM_ERR_FAILED (some other unspecified error occurred)
- """
+ """
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
diff --git a/src/software/openlmi/software/__init__.py b/src/software/openlmi/software/__init__.py
index fcae716..ffdae3f 100644
--- a/src/software/openlmi/software/__init__.py
+++ b/src/software/openlmi/software/__init__.py
@@ -1,6 +1,6 @@
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/openlmi/software/cimom_entry.py b/src/software/openlmi/software/cimom_entry.py
index 7429b51..033e06f 100644
--- a/src/software/openlmi/software/cimom_entry.py
+++ b/src/software/openlmi/software/cimom_entry.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/openlmi/software/core/ComputerSystem.py b/src/software/openlmi/software/core/ComputerSystem.py
index b354164..9cbf725 100644
--- a/src/software/openlmi/software/core/ComputerSystem.py
+++ b/src/software/openlmi/software/core/ComputerSystem.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/src/software/openlmi/software/core/Error.py b/src/software/openlmi/software/core/Error.py
index aa91e7a..ccf4715 100644
--- a/src/software/openlmi/software/core/Error.py
+++ b/src/software/openlmi/software/core/Error.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/src/software/openlmi/software/core/Identity.py b/src/software/openlmi/software/core/Identity.py
index 6cde2d8..b7e8020 100644
--- a/src/software/openlmi/software/core/Identity.py
+++ b/src/software/openlmi/software/core/Identity.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
Just a common functionality related to LMI_SoftwareIdentity provider.
"""
-import pywbem
+import pywbem
from openlmi.common import cmpi_logging
from openlmi.software import util
@@ -245,40 +245,40 @@ def pkg2model(pkg_info, keys_only=True, model=None):
_set_key = model.__setitem__
_set_key('InstanceID', 'LMI:SoftwareIdentity:'+pkg_info.nevra)
if not keys_only:
- #model['BuildNumber'] = pywbem.Uint16() # TODO
+ #model['BuildNumber'] = pywbem.Uint16() # TODO
model['Caption'] = pkg_info.summary
- #model['ClassificationDescriptions'] = ['',] # TODO
+ #model['ClassificationDescriptions'] = ['',] # TODO
model['Classifications'] = [pywbem.Uint16(0)]
#model['CommunicationStatus'] = \
- # self.Values.CommunicationStatus.<VAL> # TODO
+ # self.Values.CommunicationStatus.<VAL> # TODO
model['Description'] = pkg_info.description
- #model['DetailedStatus'] = self.Values.DetailedStatus.<VAL> # TODO
+ #model['DetailedStatus'] = self.Values.DetailedStatus.<VAL> # TODO
model['ElementName'] = pkg_info.nevra
#model['ExtendedResourceType'] = \
- #self.Values.ExtendedResourceType.<VAL> # TODO
- #model['HealthState'] = self.Values.HealthState.<VAL> # TODO
- #model['IdentityInfoType'] = ['',] # TODO
- #model['IdentityInfoValue'] = ['',] # TODO
+ #self.Values.ExtendedResourceType.<VAL> # TODO
+ #model['HealthState'] = self.Values.HealthState.<VAL> # TODO
+ #model['IdentityInfoType'] = ['',] # TODO
+ #model['IdentityInfoValue'] = ['',] # TODO
if pkg_info.installed:
model['InstallDate'] = pywbem.CIMDateTime(pkg_info.install_time)
else:
model['InstallDate'] = pywbem.CIMProperty(
'InstallDate', None, type='datetime')
model['IsEntity'] = True
- #model['IsLargeBuildNumber'] = bool(False) # TODO
- #model['Languages'] = ['',] # TODO
- #model['LargeBuildNumber'] = pywbem.Uint64() # TODO
- #model['MajorVersion'] = pywbem.Uint16() # TODO
- #model['Manufacturer'] = '' # TODO
+ #model['IsLargeBuildNumber'] = bool(False) # TODO
+ #model['Languages'] = ['',] # TODO
+ #model['LargeBuildNumber'] = pywbem.Uint64() # TODO
+ #model['MajorVersion'] = pywbem.Uint16() # TODO
+ #model['Manufacturer'] = '' # TODO
#model['MinExtendedResourceTypeBuildNumber'] = \
- #pywbem.Uint16() # TODO
+ #pywbem.Uint16() # TODO
#model['MinExtendedResourceTypeMajorVersion'] = \
- #pywbem.Uint16() # TODO
+ #pywbem.Uint16() # TODO
#model['MinExtendedResourceTypeMinorVersion'] = \
- #pywbem.Uint16() # TODO
+ #pywbem.Uint16() # TODO
#model['MinExtendedResourceTypeRevisionNumber'] = \
- #pywbem.Uint16() # TODO
- #model['MinorVersion'] = pywbem.Uint16() # TODO
+ #pywbem.Uint16() # TODO
+ #model['MinorVersion'] = pywbem.Uint16() # TODO
model['Name'] = pkg_info.name
try:
model["Epoch"] = pywbem.Uint32(int(pkg_info.epoch))
@@ -290,18 +290,18 @@ def pkg2model(pkg_info, keys_only=True, model=None):
model['Release'] = pkg_info.release
model['Architecture'] = pkg_info.arch
#model['OperatingStatus'] = \
- #self.Values.OperatingStatus.<VAL> # TODO
+ #self.Values.OperatingStatus.<VAL> # TODO
#model['OperationalStatus'] = \
- #[self.Values.OperationalStatus.<VAL>,] # TODO
- #model['OtherExtendedResourceTypeDescription'] = '' # TODO
- #model['PrimaryStatus'] = self.Values.PrimaryStatus.<VAL> # TODO
- #model['ReleaseDate'] = pywbem.CIMDateTime() # TODO
- #model['RevisionNumber'] = pywbem.Uint16() # TODO
- #model['SerialNumber'] = '' # TODO
- #model['Status'] = self.Values.Status.<VAL> # TODO
- #model['StatusDescriptions'] = ['',] # TODO
- #model['TargetOperatingSystems'] = ['',] # TODO
- #model['TargetOSTypes'] = [pywbem.Uint16(),] # TODO
+ #[self.Values.OperationalStatus.<VAL>,] # TODO
+ #model['OtherExtendedResourceTypeDescription'] = '' # TODO
+ #model['PrimaryStatus'] = self.Values.PrimaryStatus.<VAL> # TODO
+ #model['ReleaseDate'] = pywbem.CIMDateTime() # TODO
+ #model['RevisionNumber'] = pywbem.Uint16() # TODO
+ #model['SerialNumber'] = '' # TODO
+ #model['Status'] = self.Values.Status.<VAL> # TODO
+ #model['StatusDescriptions'] = ['',] # TODO
+ #model['TargetOperatingSystems'] = ['',] # TODO
+ #model['TargetOSTypes'] = [pywbem.Uint16(),] # TODO
model['TargetTypes'] = ['rpm', 'yum']
model['VersionString'] = pkg_info.evra
return model
diff --git a/src/software/openlmi/software/core/IdentityResource.py b/src/software/openlmi/software/core/IdentityResource.py
index 660e15a..579b0f1 100644
--- a/src/software/openlmi/software/core/IdentityResource.py
+++ b/src/software/openlmi/software/core/IdentityResource.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/src/software/openlmi/software/core/InstallationJob.py b/src/software/openlmi/software/core/InstallationJob.py
index de13a84..b758f6e 100644
--- a/src/software/openlmi/software/core/InstallationJob.py
+++ b/src/software/openlmi/software/core/InstallationJob.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -402,7 +402,7 @@ def _fill_nonkeys(job, model):
job.__class__.__name__)
model['Description'] = pywbem.CIMProperty('Description',
type='string', value=None)
- if job.started:
+ if job.started:
if job.finished:
elapsed = job.finished - job.started
else:
diff --git a/src/software/openlmi/software/core/InstallationService.py b/src/software/openlmi/software/core/InstallationService.py
index 5ea87b7..56063f1 100644
--- a/src/software/openlmi/software/core/InstallationService.py
+++ b/src/software/openlmi/software/core/InstallationService.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ Just a common functionality related to LMI_SoftwareInstallationService
provider.
"""
-import pywbem
+import pywbem
from openlmi.common import cmpi_logging
from openlmi.software.core import ComputerSystem
diff --git a/src/software/openlmi/software/core/SystemCollection.py b/src/software/openlmi/software/core/SystemCollection.py
index 2a250af..6fced8e 100644
--- a/src/software/openlmi/software/core/SystemCollection.py
+++ b/src/software/openlmi/software/core/SystemCollection.py
@@ -1,6 +1,6 @@
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/src/software/openlmi/software/core/__init__.py b/src/software/openlmi/software/core/__init__.py
index ac52940..668e7be 100644
--- a/src/software/openlmi/software/core/__init__.py
+++ b/src/software/openlmi/software/core/__init__.py
@@ -1,6 +1,6 @@
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/openlmi/software/util/__init__.py b/src/software/openlmi/software/util/__init__.py
index 5aa19b8..f42f25a 100644
--- a/src/software/openlmi/software/util/__init__.py
+++ b/src/software/openlmi/software/util/__init__.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -57,7 +57,7 @@ def get_target_operating_system():
of CIM_SoftwareElement class and text is its testual representation.
"""
- system = platform.system()
+ system = platform.system()
if system.lower() == 'linux':
try:
val, dist = \
diff --git a/src/software/openlmi/software/util/singletonmixin.py b/src/software/openlmi/software/util/singletonmixin.py
index 7b26b8b..c252676 100644
--- a/src/software/openlmi/software/util/singletonmixin.py
+++ b/src/software/openlmi/software/util/singletonmixin.py
@@ -257,7 +257,7 @@ class Singleton(object):
try:
if hasattr(cls.c_instance, '_prepare_to_forget_singleton'):
# tell instance to release anything it might be holding onto.
- cls.c_instance._prepare_to_forget_singleton()
+ cls.c_instance._prepare_to_forget_singleton()
del cls.c_instance
_remove_singleton(cls)
except AttributeError:
diff --git a/src/software/openlmi/software/yumdb/__init__.py b/src/software/openlmi/software/yumdb/__init__.py
index b021e1e..13539bb 100644
--- a/src/software/openlmi/software/yumdb/__init__.py
+++ b/src/software/openlmi/software/yumdb/__init__.py
@@ -1,6 +1,6 @@
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -68,7 +68,7 @@ YUM_WORKER_DEBUG_LOGGING_CONFIG = {
"default": {
"()": DispatchingFormatter,
"formatters" : {
- "openlmi.software.yumdb.util.trace_function":
+ "openlmi.software.yumdb.util.trace_function":
"%(asctime)s %(levelname)s:%(message)s"
},
"default" : "%(asctime)s %(levelname)s:%(module)s:"
@@ -202,7 +202,7 @@ class YumDB(singletonmixin.Singleton):
Context manager for accessing yum/rpm database.
All requests are bundled into jobs -- instances of jobs.YumJob and
sent to YumWorker for processing.
-
+
YumWorker is a separate process handling all calls to yum api.
Communication is done via queues (uplink and downlink).
Uplink is used to send jobs to YumWorker and downlink for obtaining
@@ -528,7 +528,7 @@ class YumDB(singletonmixin.Singleton):
@param desired_pkg is an instance of PackageInfo,
which must be available
"""
- return self._do_job(_make_async_job(jobs.YumUpdateToPackage,
+ return self._do_job(_make_async_job(jobs.YumUpdateToPackage,
desired_pkg, async=async))
@job_request(async=True)
@@ -597,7 +597,7 @@ class YumDB(singletonmixin.Singleton):
@job_request()
def delete_job(self, jobid):
return self._do_job(jobs.YumJobDelete(jobid))
-
+
@job_request()
def terminate_job(self, jobid):
return self._do_job(jobs.YumJobTerminate(jobid))
diff --git a/src/software/openlmi/software/yumdb/errors.py b/src/software/openlmi/software/yumdb/errors.py
index 06d7ca1..101c40b 100644
--- a/src/software/openlmi/software/yumdb/errors.py
+++ b/src/software/openlmi/software/yumdb/errors.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/openlmi/software/yumdb/jobmanager.py b/src/software/openlmi/software/yumdb/jobmanager.py
index 13ee1f8..872e81f 100644
--- a/src/software/openlmi/software/yumdb/jobmanager.py
+++ b/src/software/openlmi/software/yumdb/jobmanager.py
@@ -1,6 +1,6 @@
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/openlmi/software/yumdb/jobs.py b/src/software/openlmi/software/yumdb/jobs.py
index 6260b79..a46a2ca 100644
--- a/src/software/openlmi/software/yumdb/jobs.py
+++ b/src/software/openlmi/software/yumdb/jobs.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -406,7 +406,7 @@ class YumFilterPackages(YumGetPackageList): #pylint: disable=R0903
filter on packages.
Arguments (plus those in YumGetPackageList):
name, epoch, version, release, arch, nevra, envra, evra
-
+
Some of those are redundant, but filtering is optimized for
speed, so supplying all of them won't affect performance.
@@ -526,7 +526,7 @@ class YumUpdatePackage(YumSpecificPackageJob): #pylint: disable=R0903
class YumCheckPackage(YumSpecificPackageJob): #pylint: disable=R0903
"""
Request verification information for instaled package and its files.
-
+
Worker replies with new instance of yumdb.PackageCheck.
"""
def __init__(self, pkg, async=False, metadata=None):
@@ -591,7 +591,7 @@ class YumFilterRepositories(YumGetRepositoryList): #pylint: disable=R0903
filter on packages.
Arguments (plus those in YumGetRepositoryList):
name, gpg_check, repo_gpg_check
-
+
Some of those are redundant, but filtering is optimized for
speed, so supplying all of them won't affect performance.
@@ -603,7 +603,7 @@ class YumFilterRepositories(YumGetRepositoryList): #pylint: disable=R0903
repoid=None, gpg_check=None, repo_gpg_check=None):
YumGetRepositoryList.__init__(self, kind)
self.repoid = repoid
- self.gpg_check = None if gpg_check is None else bool(gpg_check)
+ self.gpg_check = None if gpg_check is None else bool(gpg_check)
self.repo_gpg_check = (
None if repo_gpg_check is None else bool(repo_gpg_check))
diff --git a/src/software/openlmi/software/yumdb/packagecheck.py b/src/software/openlmi/software/yumdb/packagecheck.py
index 116b579..4cdc5ee 100644
--- a/src/software/openlmi/software/yumdb/packagecheck.py
+++ b/src/software/openlmi/software/yumdb/packagecheck.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/openlmi/software/yumdb/packageinfo.py b/src/software/openlmi/software/yumdb/packageinfo.py
index dfaa618..a088993 100644
--- a/src/software/openlmi/software/yumdb/packageinfo.py
+++ b/src/software/openlmi/software/yumdb/packageinfo.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -44,7 +44,7 @@ class PackageInfo(object):
'summary', 'description', 'license', 'group', 'vendor',
"repoid", 'size',
'installed', # boolean
- 'install_time' # datetime instance
+ 'install_time' # datetime instance
)
def __init__(self, objid, name, epoch, version, release, arch, **kwargs):
diff --git a/src/software/openlmi/software/yumdb/process.py b/src/software/openlmi/software/yumdb/process.py
index 9d93efb..5f43c35 100644
--- a/src/software/openlmi/software/yumdb/process.py
+++ b/src/software/openlmi/software/yumdb/process.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -100,7 +100,7 @@ def _get_package_filter_function(filters):
class RepoFilterSetter(object):
"""
- A context manager, that will set a repository filter lasting
+ A context manager, that will set a repository filter lasting
as long as the object itself.
"""
def __init__(self, yum_base, include_repos=None, exclude_repos=None):
@@ -198,7 +198,7 @@ class YumWorker(Process):
"""
The main process, that works with YUM API. It has two queues, one
for input jobs and second for results.
-
+
Jobs are dispatched by their class names to particular handler method.
It spawns a second thread for managing asynchronous jobs and queue
@@ -256,7 +256,7 @@ class YumWorker(Process):
"""
Only one process is allowed to work with package database at given time.
That's why we lock it.
-
+
Try to lock it in loop, until success.
"""
while True:
@@ -427,7 +427,7 @@ class YumWorker(Process):
assert self._yum_base is not None
for repodir in self._yum_base.conf.reposdir:
if os.path.exists(repodir):
- self._repodir_mtimes[repodir] = os.stat(repodir).st_mtime
+ self._repodir_mtimes[repodir] = os.stat(repodir).st_mtime
@trace_function
def _do_work(self, job):
diff --git a/src/software/openlmi/software/yumdb/repository.py b/src/software/openlmi/software/yumdb/repository.py
index 16541df..2863dac 100644
--- a/src/software/openlmi/software/yumdb/repository.py
+++ b/src/software/openlmi/software/yumdb/repository.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Software Management Providers
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -108,7 +108,7 @@ class Repository(object):
# on server
"mirror_list", # url of mirrorlist, or None
"mirror_urls", # list of urls obtained from mirrorlist or None
- #"persist_dir", #
+ #"persist_dir", #
#"pkg_count", # number of packages in directory
"pkg_dir", # directory with packages
#"proxy", # boolean saying whether this is a proxy
diff --git a/src/software/test/base.py b/src/software/test/base.py
index f0188ed..2fe1173 100644
--- a/src/software/test/base.py
+++ b/src/software/test/base.py
@@ -1,5 +1,5 @@
# -*- encoding: utf-8 -*-
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/test/package.py b/src/software/test/package.py
index 01cce2b..9f54a8d 100644
--- a/src/software/test/package.py
+++ b/src/software/test/package.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- Coding:utf-8 -*-
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/test/repository.py b/src/software/test/repository.py
index 1b66d15..8f88a17 100644
--- a/src/software/test/repository.py
+++ b/src/software/test/repository.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- Coding:utf-8 -*-
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/test/rpmcache.py b/src/software/test/rpmcache.py
index 6e61271..18b4779 100644
--- a/src/software/test/rpmcache.py
+++ b/src/software/test/rpmcache.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- Coding:utf-8 -*-
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -495,7 +495,7 @@ def get_pkg_database(
where
safe is a list of instances of Package, representing installed
software, these should be used for not-dangerous tests;
- both older
+ both older
dangerous is a list of instances of Package of selected packages,
that are not installed, but available; instances contain
both newer and older version of package
@@ -531,7 +531,7 @@ def get_pkg_database(
dangerous_pkgs = make_dangerous_list(installed)
safe_pkgs = make_safe_list(installed, exclude=set(
pkg.name for pkg in dangerous_pkgs))
-
+
if use_cache:
repolist = _get_repo_list() if repolist in (None, []) else repolist
_download_dangerous(repolist, dangerous_pkgs, cache_dir)
diff --git a/src/software/test/run.py b/src/software/test/run.py
index 18ee1c4..74c2cf3 100755
--- a/src/software/test/run.py
+++ b/src/software/test/run.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- Coding:utf-8 -*-
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/test/test_hosted_software_collection.py b/src/software/test/test_hosted_software_collection.py
index 3d2f30a..ccd00b8 100755
--- a/src/software/test/test_hosted_software_collection.py
+++ b/src/software/test/test_hosted_software_collection.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/test/test_hosted_software_identity_resource.py b/src/software/test/test_hosted_software_identity_resource.py
index 29ed5f9..6a60e61 100755
--- a/src/software/test/test_hosted_software_identity_resource.py
+++ b/src/software/test/test_hosted_software_identity_resource.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/test/test_installed_software_identity.py b/src/software/test/test_installed_software_identity.py
index 6a33b78..b796156 100755
--- a/src/software/test/test_installed_software_identity.py
+++ b/src/software/test/test_installed_software_identity.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -171,7 +171,7 @@ class TestInstalledSoftwareIdentity(base.SoftwareBaseTestCase):
objpath = self.make_op(pkg)
self.assertFalse(rpmcache.is_pkg_installed(pkg))
- inst = pywbem.CIMInstance(self.CLASS_NAME,
+ inst = pywbem.CIMInstance(self.CLASS_NAME,
properties={
"InstalledSoftware" : objpath["InstalledSoftware"],
"System" : objpath["System"]},
diff --git a/src/software/test/test_member_of_software_collection.py b/src/software/test/test_member_of_software_collection.py
index f5d5076..0f6bac8 100755
--- a/src/software/test/test_member_of_software_collection.py
+++ b/src/software/test/test_member_of_software_collection.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/test/test_resource_for_software_identity.py b/src/software/test/test_resource_for_software_identity.py
index c29b394..4c7e6b8 100755
--- a/src/software/test/test_resource_for_software_identity.py
+++ b/src/software/test/test_resource_for_software_identity.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/test/test_software_identity.py b/src/software/test/test_software_identity.py
index dc96315..cf92bab 100755
--- a/src/software/test/test_software_identity.py
+++ b/src/software/test/test_software_identity.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/test/test_software_identity_resource.py b/src/software/test/test_software_identity_resource.py
index 9e0b51a..34e5008 100755
--- a/src/software/test/test_software_identity_resource.py
+++ b/src/software/test/test_software_identity_resource.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/test/test_system_software_collection.py b/src/software/test/test_system_software_collection.py
index 2204415..d68da47 100755
--- a/src/software/test/test_system_software_collection.py
+++ b/src/software/test/test_system_software_collection.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
diff --git a/src/software/test/util.py b/src/software/test/util.py
index 4918b24..958f1d3 100644
--- a/src/software/test/util.py
+++ b/src/software/test/util.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- Coding:utf-8 -*-
#
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public