Merge "Fetch list of AZs from nova if it's not configured" into feature/zuulv3
This commit is contained in:
commit
0e3eeeb1a5
@ -357,14 +357,16 @@ Example::
|
|||||||
**optional**
|
**optional**
|
||||||
|
|
||||||
``availability-zones`` (list)
|
``availability-zones`` (list)
|
||||||
Without it nodepool will rely on nova to schedule an availability zone.
|
A list of availability zones to use.
|
||||||
|
|
||||||
If it is provided, the value should be a list of availability zone names.
|
If this setting is omitted, nodepool will fetch the list of all
|
||||||
If you have more than one availability zone, you should specify them all
|
availability zones from nova. To restrict nodepool to a subset
|
||||||
here, rather than letting one get selected by nova. By doing so, you allow
|
of availability zones, supply a list of availability zone names
|
||||||
nodepool to group all nodes allocated for a node request into the same
|
in this setting.
|
||||||
zone, which will be selected at random from the list. If you do not list
|
|
||||||
your zones here, this grouping cannot be guaranteed.
|
Nodepool chooses an availability zone from the list at random
|
||||||
|
when creating nodes but ensures that all nodes for a given
|
||||||
|
request are placed in the same availability zone.
|
||||||
|
|
||||||
``networks`` (list)
|
``networks`` (list)
|
||||||
Specify custom Neutron networks that get attached to each
|
Specify custom Neutron networks that get attached to each
|
||||||
|
@ -234,6 +234,9 @@ class FakeOpenStackCloud(object):
|
|||||||
def delete_server(self, name_or_id, delete_ips=True):
|
def delete_server(self, name_or_id, delete_ips=True):
|
||||||
self._delete(name_or_id, self._server_list)
|
self._delete(name_or_id, self._server_list)
|
||||||
|
|
||||||
|
def list_availability_zone_names(self):
|
||||||
|
return ['fake-az1', 'fake-az2']
|
||||||
|
|
||||||
|
|
||||||
class FakeUploadFailCloud(FakeOpenStackCloud):
|
class FakeUploadFailCloud(FakeOpenStackCloud):
|
||||||
log = logging.getLogger("nodepool.FakeUploadFailCloud")
|
log = logging.getLogger("nodepool.FakeUploadFailCloud")
|
||||||
|
@ -662,8 +662,9 @@ class NodeRequestHandler(object):
|
|||||||
if not got_a_node:
|
if not got_a_node:
|
||||||
# Select grouping AZ if we didn't set AZ from a selected,
|
# Select grouping AZ if we didn't set AZ from a selected,
|
||||||
# pre-existing node
|
# pre-existing node
|
||||||
if not self.chosen_az and self.pool.azs:
|
if not self.chosen_az:
|
||||||
self.chosen_az = random.choice(self.pool.azs)
|
self.chosen_az = random.choice(
|
||||||
|
self.pool.azs or self.manager.getAZs())
|
||||||
|
|
||||||
# If we calculate that we're at capacity, pause until nodes
|
# If we calculate that we're at capacity, pause until nodes
|
||||||
# are released by Zuul and removed by the DeletedNodeWorker.
|
# are released by Zuul and removed by the DeletedNodeWorker.
|
||||||
|
@ -86,6 +86,7 @@ class ProviderManager(object):
|
|||||||
self._images = {}
|
self._images = {}
|
||||||
self._networks = {}
|
self._networks = {}
|
||||||
self.__flavors = {}
|
self.__flavors = {}
|
||||||
|
self.__azs = None
|
||||||
self._use_taskmanager = use_taskmanager
|
self._use_taskmanager = use_taskmanager
|
||||||
self._taskmanager = None
|
self._taskmanager = None
|
||||||
|
|
||||||
@ -331,6 +332,17 @@ class ProviderManager(object):
|
|||||||
with shade_inner_exceptions():
|
with shade_inner_exceptions():
|
||||||
self._client.delete_unattached_floating_ips()
|
self._client.delete_unattached_floating_ips()
|
||||||
|
|
||||||
|
def getAZs(self):
|
||||||
|
if self.__azs is None:
|
||||||
|
self.__azs = self._client.list_availability_zone_names()
|
||||||
|
if not self.__azs:
|
||||||
|
# If there are no zones, return a list containing None so that
|
||||||
|
# random.choice can pick None and pass that to Nova. If this
|
||||||
|
# feels dirty, please direct your ire to policy.json and the
|
||||||
|
# ability to turn off random portions of the OpenStack API.
|
||||||
|
self.__azs = [None]
|
||||||
|
return self.__azs
|
||||||
|
|
||||||
|
|
||||||
class FakeProviderManager(ProviderManager):
|
class FakeProviderManager(ProviderManager):
|
||||||
def __init__(self, provider, use_taskmanager):
|
def __init__(self, provider, use_taskmanager):
|
||||||
|
@ -10,7 +10,7 @@ PrettyTable>=0.6,<0.8
|
|||||||
# shade has a looser requirement on six than nodepool, so install six first
|
# shade has a looser requirement on six than nodepool, so install six first
|
||||||
six>=1.7.0
|
six>=1.7.0
|
||||||
os-client-config>=1.2.0
|
os-client-config>=1.2.0
|
||||||
shade>=1.12.0
|
shade>=1.18.1
|
||||||
diskimage-builder>=1.21.0
|
diskimage-builder>=1.21.0
|
||||||
voluptuous
|
voluptuous
|
||||||
kazoo
|
kazoo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user