summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-11-30 14:29:51 +0000
committerGerrit Code Review <review@openstack.org>2018-11-30 14:29:51 +0000
commitd4325cf6ac2e4be40e8b2425756cc1f6588f15da (patch)
tree425a82158f60c1368d9814e1a00a110272f2b2ab
parent1b53f38b9ccdb9eed98fe14028eb2ea9d0f4e126 (diff)
parentafbf9108d893ede0d147da2afe16c9e6d4bc76d4 (diff)
Merge "OpenStack: store ZK records for launch error nodes"
-rw-r--r--nodepool/driver/openstack/handler.py40
1 files changed, 24 insertions, 16 deletions
diff --git a/nodepool/driver/openstack/handler.py b/nodepool/driver/openstack/handler.py
index 4712392..c52d458 100644
--- a/nodepool/driver/openstack/handler.py
+++ b/nodepool/driver/openstack/handler.py
@@ -18,6 +18,7 @@ import pprint
18import random 18import random
19 19
20from kazoo import exceptions as kze 20from kazoo import exceptions as kze
21import openstack
21 22
22from nodepool import exceptions 23from nodepool import exceptions
23from nodepool import nodeutils as utils 24from nodepool import nodeutils as utils
@@ -122,22 +123,29 @@ class OpenStackNodeLauncher(NodeLauncher):
122 # because that isn't available in ZooKeeper until after the server is 123 # because that isn't available in ZooKeeper until after the server is
123 # active, which could cause a race in leak detection. 124 # active, which could cause a race in leak detection.
124 125
125 server = self.handler.manager.createServer( 126 try:
126 hostname, 127 server = self.handler.manager.createServer(
127 image=image_external, 128 hostname,
128 min_ram=self.label.min_ram, 129 image=image_external,
129 flavor_name=self.label.flavor_name, 130 min_ram=self.label.min_ram,
130 key_name=self.label.key_name, 131 flavor_name=self.label.flavor_name,
131 az=self.node.az, 132 key_name=self.label.key_name,
132 config_drive=config_drive, 133 az=self.node.az,
133 nodepool_node_id=self.node.id, 134 config_drive=config_drive,
134 nodepool_node_label=self.node.type[0], 135 nodepool_node_id=self.node.id,
135 nodepool_image_name=image_name, 136 nodepool_node_label=self.node.type[0],
136 networks=self.pool.networks, 137 nodepool_image_name=image_name,
137 security_groups=self.pool.security_groups, 138 networks=self.pool.networks,
138 boot_from_volume=self.label.boot_from_volume, 139 security_groups=self.pool.security_groups,
139 volume_size=self.label.volume_size, 140 boot_from_volume=self.label.boot_from_volume,
140 instance_properties=self.label.instance_properties) 141 volume_size=self.label.volume_size,
142 instance_properties=self.label.instance_properties)
143 except openstack.cloud.exc.OpenStackCloudCreateException as e:
144 if e.resource_id:
145 self.node.external_id = e.resource_id
146 # The outer exception handler will handle storing the
147 # node immediately after this.
148 raise
141 149
142 self.node.external_id = server.id 150 self.node.external_id = server.id
143 self.node.hostname = hostname 151 self.node.hostname = hostname