Merge "Add option to prefix pool manager node names"
This commit is contained in:
commit
981e165130
@ -77,6 +77,7 @@ Pool Manager Section
|
||||
api_server = 10.0.0.1:8889 10.0.0.2:8889
|
||||
nodes = 10
|
||||
check_interval = 5
|
||||
node_basename = 'libra'
|
||||
|
||||
|
||||
Worker Command Line Options
|
||||
@ -200,6 +201,11 @@ Pool Manager Command Line Options
|
||||
Do not run as a daemon. This option is useful for debugging purposes
|
||||
only as the worker is intended to be run as a daemon normally.
|
||||
|
||||
.. option:: --node_basename <NODE_BASENAME>
|
||||
|
||||
A name to prefix the UUID name given to the nodes the pool manager
|
||||
generates.
|
||||
|
||||
.. option:: --nodes <NODES>
|
||||
|
||||
The size of the pool of spare nodes the pool manager should keep.
|
||||
@ -210,7 +216,11 @@ Pool Manager Command Line Options
|
||||
|
||||
.. option:: --nova_user <NOVA_USER>
|
||||
|
||||
The username to autenticate for the Nova API
|
||||
The username to authenticate for the Nova API
|
||||
|
||||
.. option:: --nova_pass <NOVA_PASS>
|
||||
|
||||
The password to authenticate for the Nova API
|
||||
|
||||
.. option:: --nova_tenant <NOVA_TENANT>
|
||||
|
||||
|
@ -50,3 +50,4 @@ nova_image_size = standard.medium
|
||||
api_server = 10.0.0.1:8889 10.0.0.2:8889
|
||||
nodes = 10
|
||||
check_interval = 5
|
||||
node_basename = 'libra'
|
||||
|
@ -107,7 +107,8 @@ class Server(object):
|
||||
self.args.nova_keyname,
|
||||
self.args.nova_secgroup,
|
||||
self.args.nova_image,
|
||||
self.args.nova_image_size
|
||||
self.args.nova_image_size,
|
||||
node_basename=self.args.node_basename
|
||||
)
|
||||
except Exception as exc:
|
||||
self.logger.error('Error initialising Nova connection {exc}'
|
||||
@ -180,6 +181,10 @@ def main():
|
||||
choices=known_drivers.keys(), default='hp_rest',
|
||||
help='type of device to use'
|
||||
)
|
||||
options.parser.add_argument(
|
||||
'--node_basename', dest='node_basename',
|
||||
help='prepend the name of all nodes with this'
|
||||
)
|
||||
options.parser.add_argument(
|
||||
'--nova_auth_url',
|
||||
help='the auth URL for the Nova API'
|
||||
|
@ -27,7 +27,7 @@ class NotFound(Exception):
|
||||
|
||||
class Node(object):
|
||||
def __init__(self, username, password, tenant, auth_url, region, keyname,
|
||||
secgroup, image, node_type):
|
||||
secgroup, image, node_type, node_basename=None):
|
||||
self.nova = client.HTTPClient(
|
||||
username,
|
||||
password,
|
||||
@ -39,6 +39,7 @@ class Node(object):
|
||||
)
|
||||
self.keyname = keyname
|
||||
self.secgroup = secgroup
|
||||
self.node_basename = node_basename
|
||||
if image.isdigit():
|
||||
self.image = image
|
||||
else:
|
||||
@ -97,8 +98,12 @@ class Node(object):
|
||||
def _create(self, node_id):
|
||||
""" create a nova node """
|
||||
url = "/servers"
|
||||
if self.node_basename:
|
||||
node_name = '{0}_{1}'.format(self.node_basename, node_id)
|
||||
else:
|
||||
node_name = '{0}'.format(node_id)
|
||||
body = {"server": {
|
||||
"name": '{0}'.format(node_id),
|
||||
"name": node_name,
|
||||
"imageRef": self.image,
|
||||
"key_name": self.keyname,
|
||||
"flavorRef": self.node_type,
|
||||
|
Loading…
x
Reference in New Issue
Block a user