register-nodes: add support for pxe_ucs

This updates the register-nodes command to support use of the pxe_ucs
driver with Ironic.

Change-Id: Ia873276d5e24643057a0915dd83b3c2350403cc4
This commit is contained in:
Lucas Alvares Gomes 2015-08-31 17:23:06 +01:00
parent f08fea6880
commit 64a4ff33c2
2 changed files with 15 additions and 0 deletions

View File

@ -58,6 +58,11 @@ def _extract_driver_info(node):
# The fake_pxe driver doesn't need any credentials since there's
# no power management
pass
elif node["pm_type"] == "pxe_ucs":
driver_info = {"ucs_hostname": node["pm_addr"],
"ucs_username": node["pm_user"],
"ucs_password": node["pm_password"],
"ucs_service_profile": node["pm_service_profile"]}
else:
raise ValueError("Unknown pm_type: %s" % node["pm_type"])
if "pxe" in node["pm_type"]:

View File

@ -104,6 +104,16 @@ class NodesTest(base.TestCase):
"iboot_port": "8080"}
self.assertEqual(expected, nodes._extract_driver_info(node))
def test_extract_driver_info_pxe_ucs(self):
node = self._get_node()
node["pm_type"] = "pxe_ucs"
node["pm_service_profile"] = "foo_profile"
expected = {"ucs_hostname": "foo.bar",
"ucs_username": "test",
"ucs_password": "random",
"ucs_service_profile": "foo_profile"}
self.assertEqual(expected, nodes._extract_driver_info(node))
def test_extract_driver_info_pxe_ipmi_with_kernel_ramdisk(self):
node = self._get_node()
node["pm_type"] = "pxe_ipmi"