def test_dhcp_options_for_instance(self): node = self._create_node() fake_bootfile = "pxelinux.0" self.mox.StubOutWithMock(pxe, 'get_pxe_bootfile_name') pxe.get_pxe_bootfile_name(mox.IgnoreArg()).AndReturn(fake_bootfile) self.mox.ReplayAll() expected = [{'opt_name': 'bootfile-name', 'opt_value': fake_bootfile}, {'opt_name': 'server-ip-address', 'opt_value': CONF.my_ip}, {'opt_name': 'tftp-server', 'opt_value': CONF.my_ip}] res = self.driver.dhcp_options_for_instance(node['instance']) self.assertEqual(expected.sort(), res.sort()) self.mox.VerifyAll()
def test_dhcp_options_for_instance(self): node = self._create_node() fake_bootfile = "pxelinux.0" self.mox.StubOutWithMock(pxe, "get_pxe_bootfile_name") pxe.get_pxe_bootfile_name(mox.IgnoreArg()).AndReturn(fake_bootfile) self.mox.ReplayAll() expected = [ {"opt_name": "bootfile-name", "opt_value": fake_bootfile}, {"opt_name": "server-ip-address", "opt_value": CONF.my_ip}, {"opt_name": "tftp-server", "opt_value": CONF.my_ip}, ] res = self.driver.dhcp_options_for_instance(node["instance"]) self.assertEqual(expected.sort(), res.sort()) self.mox.VerifyAll()
def dhcp_options_for_instance(self, instance): # NOTE(deva): This only works for PXE driver currently: # If not running the PXE driver, you should not enable # DHCP updates in nova.conf. bootfile_name = pxe.get_pxe_bootfile_name(instance) opts = [ {"opt_name": "bootfile-name", "opt_value": bootfile_name}, {"opt_name": "server-ip-address", "opt_value": CONF.my_ip}, {"opt_name": "tftp-server", "opt_value": CONF.my_ip}, ] return opts
def dhcp_options_for_instance(self, instance): # NOTE(deva): This only works for PXE driver currently: # If not running the PXE driver, you should not enable # DHCP updates in nova.conf. bootfile_name = pxe.get_pxe_bootfile_name(instance) opts = [{'opt_name': 'bootfile-name', 'opt_value': bootfile_name}, {'opt_name': 'server-ip-address', 'opt_value': CONF.my_ip}, {'opt_name': 'tftp-server', 'opt_value': CONF.my_ip} ] return opts