summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-01-15 04:15:09 +0000
committerGerrit Code Review <review@openstack.org>2013-01-15 04:15:09 +0000
commit7c4ea19d9b79a50557db1b3723f4d7fd5d574ff6 (patch)
treeebae054778bf60a3e24b5cf57aeeb336bfce0146
parent9f13289b3775b4d04f86ac7153fb3702035575c7 (diff)
parentf2baacd4e634b815fe011ced0d6e46f6c06b7fdd (diff)
downloadnova-7c4ea19d9b79a50557db1b3723f4d7fd5d574ff6.tar.gz
nova-7c4ea19d9b79a50557db1b3723f4d7fd5d574ff6.tar.xz
nova-7c4ea19d9b79a50557db1b3723f4d7fd5d574ff6.zip
Merge "Break out a helper function for working with bare metal nodes."
-rw-r--r--nova/virt/baremetal/driver.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/nova/virt/baremetal/driver.py b/nova/virt/baremetal/driver.py
index f66864127..62c0dff70 100644
--- a/nova/virt/baremetal/driver.py
+++ b/nova/virt/baremetal/driver.py
@@ -188,13 +188,22 @@ class BareMetalDriver(driver.ComputeDriver):
l.append(inst['name'])
return l
- def spawn(self, context, instance, image_meta, injected_files,
- admin_password, network_info=None, block_device_info=None):
+ def _require_node(self, instance):
+ """Get a node_id out of a manager instance dict.
+ The compute manager is meant to know the node id, so a missing node is
+ a significant issue - it may mean we've been passed someone elses data.
+ """
node_id = instance.get('node')
if not node_id:
raise exception.NovaException(_(
- "Baremetal node id not supplied to driver"))
+ "Baremetal node id not supplied to driver for %r")
+ % instance['uuid'])
+ return node_id
+
+ def spawn(self, context, instance, image_meta, injected_files,
+ admin_password, network_info=None, block_device_info=None):
+ node_id = self._require_node(instance)
# NOTE(deva): this db method will raise an exception if the node is
# already in use. We call it here to ensure no one else