From 6e07d682f940db33bd54ec46c1f88ae23d7ab799 Mon Sep 17 00:00:00 2001 From: Victor Lowther Date: Wed, 8 Apr 2015 13:50:33 -0500 Subject: [PATCH] Add pxe_drac driver support to os-cloud-config The pxe_drac driver has been in Ironic for awhile, may as well have support for it. Change-Id: I4e53d290b3ca16281ec49eba6c7702d96aa32cfd --- os_cloud_config/nodes.py | 11 +++++++++++ os_cloud_config/tests/test_nodes.py | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/os_cloud_config/nodes.py b/os_cloud_config/nodes.py index c5d2cd0..878f472 100644 --- a/os_cloud_config/nodes.py +++ b/os_cloud_config/nodes.py @@ -70,6 +70,10 @@ def _extract_driver_info(node): driver_info = {"ipmi_address": node["pm_addr"], "ipmi_username": node["pm_user"], "ipmi_password": node["pm_password"]} + elif node["pm_type"] == "pxe_drac": + driver_info = {"drac_host": node["pm_addr"], + "drac_username": node["pm_user"], + "drac_password": node["pm_password"]} elif node["pm_type"] == "pxe_ssh": if "pm_virt_type" not in node: node["pm_virt_type"] = "virsh" @@ -151,6 +155,9 @@ def _populate_node_mapping(ironic_in_use, client): elif node_details.driver == 'pxe_ilo': pm_addr = node_details.driver_info['ilo_address'] node_map['pm_addr'][pm_addr] = node['uuid'] + elif node_details.driver == 'pxe_drac': + pm_addr = node_details.driver_info['drac_host'] + node_map['pm_addr'][pm_addr] = node['uuid'] else: nodes = [bmn.to_dict() for bmn in client.baremetal.list()] for node in nodes: @@ -204,6 +211,10 @@ def _update_or_register_ironic_node(service_host, node, node_map, client=None, massage_map.update({'pm_addr': '/driver_info/ilo_address', 'pm_user': '/driver_info/ilo_username', 'pm_password': '/driver_info/ilo_password'}) + elif node['pm_type'] == 'pxe_drac': + massage_map.update({'pm_addr': '/driver_info/drac_host', + 'pm_user': '/driver_info/drac_username', + 'pm_password': '/driver_info/drac_password'}) if node_uuid: ironic_node = client.node.get(node_uuid) else: diff --git a/os_cloud_config/tests/test_nodes.py b/os_cloud_config/tests/test_nodes.py index 72a51aa..79485fb 100644 --- a/os_cloud_config/tests/test_nodes.py +++ b/os_cloud_config/tests/test_nodes.py @@ -148,6 +148,14 @@ class NodesTest(base.TestCase): "ssh_virt_type": "virsh"} self.assertEqual(expected, nodes._extract_driver_info(node)) + def test_extract_driver_info_pxe_drac(self): + node = self._get_node() + node["pm_type"] = "pxe_drac" + expected = {"drac_host": "foo.bar", + "drac_username": "test", + "drac_password": "random"} + self.assertEqual(expected, nodes._extract_driver_info(node)) + def test_extract_driver_info_pxe_ssh_with_pm_virt_type(self): node = self._get_node() node["pm_type"] = "pxe_ssh" @@ -284,6 +292,9 @@ class NodesTest(base.TestCase): def test_update_node_ironic_pxe_ipmitool(self): self._update_by_type('pxe_ipmitool') + def test_ipdate_node_ironic_pxe_drac(self): + self._update_by_type('pxe_drac') + def test_update_node_ironic_pxe_ilo(self): self._update_by_type('pxe_ilo') -- 1.9.1