Make pool manager meet 1.2 API spec

Change-Id: I8383272a4d289f8c9979793d6014a2a1bf73d88e
This commit is contained in:
Andrew Hutchings
2012-12-18 19:53:36 +00:00
parent 1146335192
commit 5528eabb2e
3 changed files with 17 additions and 5 deletions

View File

@@ -55,3 +55,4 @@ nodes = 10
check_interval = 5
failed_interval = 15
node_basename = 'libra'
az = 1

View File

@@ -19,7 +19,7 @@ import sys
from libra.mgm.drivers.base import MgmDriver
API_VERSION = 'v1'
API_VERSION = 'v1.2'
class HPRestDriver(MgmDriver):

View File

@@ -212,7 +212,12 @@ class Server(object):
for address in addresses:
if not address['addr'].startswith('10.'):
break
body['address'] = address['addr']
body['publicIpAddr'] = address['addr']
body['floatingIpAddr'] = address['addr']
body['az'] = self.args.az
body['type'] = "basename: {0}, image: {1}".format(
self.args.node_basename, self.args.nova_image
)
return body
def find_unknown(self, name, nova):
@@ -270,8 +275,9 @@ class Server(object):
self.logger.warning('Aborting node building')
return
body = self.build_node_data(data)
self.logger.info('Adding node {name} on {ip}'
.format(name=body['name'], ip=body['address']))
self.logger.info('Adding node {name} on {ip}'.format(
name=body['name'], ip=body['publicIpAddr'])
)
status, response = api.add_node(body)
if not status:
self.logger.error(
@@ -313,6 +319,11 @@ def main():
'--datadir', dest='datadir',
help='directory to store data files'
)
options.parser.add_argument(
'--az', type=int,
help='The az number the node will reside in (to be passed to the API'
' server)'
)
options.parser.add_argument(
'--nodes', type=int, default=1,
help='number of nodes'
@@ -377,7 +388,7 @@ def main():
args = options.run()
required_args = [
'datadir',
'datadir', 'az',
'nova_image', 'nova_image_size', 'nova_secgroup', 'nova_keyname',
'nova_tenant', 'nova_region', 'nova_user', 'nova_pass', 'nova_auth_url'
]