summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSheldon Sandbekkhaug <sheldon.sandbekkhaug@calxeda.com>2013-07-26 14:51:13 -0500
committerSheldon Sandbekkhaug <sheldon.sandbekkhaug@calxeda.com>2013-07-26 14:51:13 -0500
commit5db2e3c8ce78140d8a8c190e841781291ecbdb40 (patch)
treea20cd9dbbd6bf51efee2924b0233768fca0466b5
parent26bf2b8a0248815e0430042617c73b2f1b7c9d4f (diff)
downloadcxmanage-5db2e3c8ce78140d8a8c190e841781291ecbdb40.tar.gz
(CXMAN-197) Change A9boot Name for Midway
Added a function to determine whether a node is running on Highbank or Midway based on firmware version (This method of checking should change to something better in the future) Moved the COMPONENTS from __init__ and made it a function in node.py Changed all references to COMPONENTS to correctly call node.get_components() node.get_components() returns "A9" or "A15" in the list depending on which chip the node is using.
-rw-r--r--cxmanage/__init__.py13
-rw-r--r--cxmanage/commands/info.py5
-rw-r--r--cxmanage/commands/tspackage.py6
-rw-r--r--cxmanage_api/node.py55
4 files changed, 61 insertions, 18 deletions
diff --git a/cxmanage/__init__.py b/cxmanage/__init__.py
index e2d416a..50b760a 100644
--- a/cxmanage/__init__.py
+++ b/cxmanage/__init__.py
@@ -322,16 +322,3 @@ def _print_command_status(tasks, counter):
dots = "".join(["." for x in range(counter % 4)]).ljust(3)
sys.stdout.write(message % (successes, errors, nodes_left, dots))
sys.stdout.flush()
-
-
-# These are needed for ipinfo and whenever version information is printed
-COMPONENTS = [
- ("ecme_version", "ECME version"),
- ("cdb_version", "CDB version"),
- ("stage2_version", "Stage2boot version"),
- ("bootlog_version", "Bootlog version"),
- ("a9boot_version", "A9boot version"),
- ("uboot_version", "Uboot version"),
- ("ubootenv_version", "Ubootenv version"),
- ("dtb_version", "DTB version")
-]
diff --git a/cxmanage/commands/info.py b/cxmanage/commands/info.py
index b1a03c0..1c307c6 100644
--- a/cxmanage/commands/info.py
+++ b/cxmanage/commands/info.py
@@ -29,7 +29,6 @@
# DAMAGE.
from cxmanage import get_tftp, get_nodes, get_node_strings, run_command
-from cxmanage import COMPONENTS
def info_command(args):
@@ -42,7 +41,6 @@ def info_command(args):
def info_basic_command(args):
"""Print basic info"""
- components = COMPONENTS
tftp = get_tftp(args)
nodes = get_nodes(args, tftp)
@@ -56,6 +54,9 @@ def info_basic_command(args):
for node in nodes:
if node in results:
result = results[node]
+ # Get mappings between attributes and formatted strings
+ components = node.get_components()
+
print "[ Info from %s ]" % node_strings[node]
print "Hardware version : %s" % result.hardware_version
print "Firmware version : %s" % result.firmware_version
diff --git a/cxmanage/commands/tspackage.py b/cxmanage/commands/tspackage.py
index 1a37e6e..744479a 100644
--- a/cxmanage/commands/tspackage.py
+++ b/cxmanage/commands/tspackage.py
@@ -10,7 +10,6 @@ import tarfile
import tempfile
from cxmanage import get_tftp, get_nodes, run_command
-from cxmanage import COMPONENTS
def tspackage_command(args):
@@ -93,8 +92,6 @@ def write_version_info(args, nodes):
"""
info_results, _ = run_command(args, nodes, "get_versions")
- # This will be used when writing version info to file
- components = COMPONENTS
for node in nodes:
lines = [] # The lines of text to write to file
@@ -118,6 +115,9 @@ def write_version_info(args, nodes):
"Firmware version : %s" %
info_result.firmware_version
)
+
+ # Get mappings between attributes and formatted strings
+ components = node.get_components()
for var, description in components:
if hasattr(info_result, var):
version = getattr(info_result, var)
diff --git a/cxmanage_api/node.py b/cxmanage_api/node.py
index b499f36..46f5562 100644
--- a/cxmanage_api/node.py
+++ b/cxmanage_api/node.py
@@ -1672,4 +1672,59 @@ class Node(object):
"Unable to increment SIMG priority, too high")
return priority
+ def get_chip_name(self):
+ """Returns the name of the "server-side" chip used by this node.
+
+ >>> node.get_chip_name
+ 'Highbank'
+
+ :rtype: string
+
+ Currently we check the firmware version to determine whether the chip
+ used by this node is Highbank or Midway.
+
+ """
+ versions = self.get_versions()
+ fwversion = versions.firmware_version
+
+ if "1000" in fwversion:
+ return "Highbank"
+ elif "2000" in fwversion:
+ return "Midway"
+ else:
+ # Cannot tell chip from firmware version; default to Highbank
+ return "Highbank"
+
+ def get_components(self):
+ """Get a list of tuples that map InfoBasicResult object attributes to
+ nicely-formatted strings.
+
+ :rtype: list of tuples
+
+ The first item in a tuple is the name of an attribute of a
+ pyipmi.info.InfoBasicResult object. The second item is a
+ human-readable, ready-to-print string describing that attribute.
+
+ """
+ components = []
+ components.append(("ecme_version", "ECME version"))
+ components.append(("cdb_version", "CDB version"))
+ components.append(("stage2_version", "Stage2boot version"))
+ components.append(("bootlog_version", "Bootlog version"))
+ if self.get_chip_name() == "Highbank":
+ components.append(
+ ("a9boot_version", "A9boot version")
+ )
+ elif self.get_chip_name() == "Midway":
+ # InfoBasicResult objects still reference the A15 as A9
+ components.append(
+ ("a9boot_version", "A15boot version")
+ )
+ components.append(("uboot_version", "Uboot version"))
+ components.append(("ubootenv_version", "Ubootenv version"))
+ components.append(("dtb_version", "DTB version"))
+
+ return components
+
+
# End of file: ./node.py