Export the MAC addresses of nodes for bare-metal.

The bare-metal hypervisor needs to let the network layer know the MAC
address of each node it has, or TFTP boot will fail, as the MAC
addresses quantum / nova dynamically allocate will not match the
actual MAC of the node as it boots. This change exports the MAC
addresses to the manager, which passes them onto the network driver in
use.

With this change administrators should register all the MAC addresses
of a given node with Nova bare-metal as interfaces, even though that
may duplicate the MAC for PXE boot provisioning. Long term the
dedicated provisioning MAC address will be removed.

Change-Id: I55f6031294a2c5d31975462f868aa27441e11ad2
This commit is contained in:
Robert Collins
2013-01-15 14:16:57 +13:00
parent 07fed5304b
commit d8d9beffa3

View File

@@ -136,6 +136,19 @@ class BareMetalDriverWithDBTestCase(bm_db_base.BMDBTestCase):
row = db.bm_node_get(self.context, self.node['id'])
self.assertEqual(row['task_state'], baremetal_states.ACTIVE)
def test_macs_for_instance(self):
self._create_node()
expected = set(['01:23:45:67:89:01', '01:23:45:67:89:02'])
self.assertEqual(
expected, self.driver.macs_for_instance(self.test_instance))
def test_macs_for_instance_no_interfaces(self):
# Nodes cannot boot with no MACs, so we raise an error if that happens.
self.nic_info = []
self._create_node()
self.assertRaises(exception.NovaException,
self.driver.macs_for_instance, self.test_instance)
def test_spawn_node_in_use(self):
self._create_node()
db.bm_node_update(self.context, self.node['id'],