summaryrefslogtreecommitdiffstats
path: root/src/software/lmi/software/core/InstallationServiceAffectsElement.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/software/lmi/software/core/InstallationServiceAffectsElement.py')
-rw-r--r--src/software/lmi/software/core/InstallationServiceAffectsElement.py87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/software/lmi/software/core/InstallationServiceAffectsElement.py b/src/software/lmi/software/core/InstallationServiceAffectsElement.py
new file mode 100644
index 0000000..c305468
--- /dev/null
+++ b/src/software/lmi/software/core/InstallationServiceAffectsElement.py
@@ -0,0 +1,87 @@
+# -*- encoding: utf-8 -*-
+# Software Management Providers
+#
+# 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+"""
+Just a common functionality related to class
+LMI_SoftwareInstallationServiceAffectsElement.
+"""
+
+import pywbem
+
+from lmi.common import cmpi_logging
+from lmi.software.core import ComputerSystem
+from lmi.software.core import Identity
+
+class Values(object):
+ class ElementEffects(object):
+ Unknown = pywbem.Uint16(0)
+ Other = pywbem.Uint16(1)
+ Exclusive_Use = pywbem.Uint16(2)
+ Performance_Impact = pywbem.Uint16(3)
+ Element_Integrity = pywbem.Uint16(4)
+ Manages = pywbem.Uint16(5)
+ Consumes = pywbem.Uint16(6)
+ Enhances_Integrity = pywbem.Uint16(7)
+ Degrades_Integrity = pywbem.Uint16(8)
+ Enhances_Performance = pywbem.Uint16(9)
+ Degrades_Performance = pywbem.Uint16(10)
+ # DMTF_Reserved = ..
+ # Vendor_Reserved = 0x8000..0xFFFF
+ _reverse_map = {
+ 0 : 'Unknown',
+ 1 : 'Other',
+ 2 : 'Exclusive Use',
+ 3 : 'Performance Impact',
+ 4 : 'Element Integrity',
+ 5 : 'Manages',
+ 6 : 'Consumes',
+ 7 : 'Enhances Integrity',
+ 8 : 'Degrades Integrity',
+ 9 : 'Enhances Performance',
+ 10 : 'Degrades Performance'
+ }
+
+@cmpi_logging.trace_function
+def fill_model_computer_system(model, keys_only=True):
+ """
+ Fills model's AffectedElement and all non-key properties.
+ """
+ model["AffectedElement"] = ComputerSystem.get_path()
+ if not keys_only:
+ model["ElementEffects"] = [
+ Values.ElementEffects.Enhances_Integrity,
+ Values.ElementEffects.Degrades_Integrity,
+ Values.ElementEffects.Other,
+ Values.ElementEffects.Other]
+ model["OtherElementEffectsDescriptions"] = [
+ "Enhances Integrity",
+ "Degrades Integrity",
+ "Enhances Functionality",
+ "Degrades Functionality"]
+ return model
+
+@cmpi_logging.trace_function
+def fill_model_identity(model, pkg, keys_only=True, identity_model=None):
+ """
+ Fills model's AffectedElement and all non-key properties.
+ """
+ model["AffectedElement"] = Identity.pkg2model(pkg, model=identity_model)
+ if not keys_only:
+ model["ElementEffects"] = [Values.ElementEffects.Other]
+ model["OtherElementEffectsDescriptions"] = ["Allows to install"]
+ return model