summaryrefslogtreecommitdiffstats
path: root/fuel/deploy/cloud
diff options
context:
space:
mode:
authorSzilard Cserey <szilard.cserey@ericsson.com>2015-06-17 12:14:54 +0200
committerSzilard Cserey <szilard.cserey@ericsson.com>2015-06-17 12:15:49 +0200
commitfbac78cb5277b044f3318c831d4da92663097a6c (patch)
tree3fc5b70bfc68977159f39ca663252be3ab8ab07c /fuel/deploy/cloud
parenteb887812da568cfb4908f6ae14449b2ceaeb5bc0 (diff)
Fuel Config Reap + Additional Refactoring for Autodeployment
1. Refactor the whole autodeployment code in such a way that the preparation of Fuel VM + networking and the autodeployment itself can be executed all at once 2. Functionality added that allows reaping of Fuel configuration from an existing environment and create DHA and DEA configuration files from it JIRA: [BGS-2] Create Fuel deployment script Change-Id: Ia22ae9b050085aaa4cadb4ee6c7bfd556c4bc18a Signed-off-by: Szilard Cserey <szilard.cserey@ericsson.com>
Diffstat (limited to 'fuel/deploy/cloud')
-rw-r--r--fuel/deploy/cloud/configure_nodes.py6
-rw-r--r--fuel/deploy/cloud/deploy.py44
-rw-r--r--fuel/deploy/cloud/deployment.py12
3 files changed, 24 insertions, 38 deletions
diff --git a/fuel/deploy/cloud/configure_nodes.py b/fuel/deploy/cloud/configure_nodes.py
index 4d1315a..a2f2a10 100644
--- a/fuel/deploy/cloud/configure_nodes.py
+++ b/fuel/deploy/cloud/configure_nodes.py
@@ -26,7 +26,7 @@ class ConfigureNodes(object):
log('Configure nodes')
for node_id, roles_blade in self.node_id_roles_dict.iteritems():
exec_cmd('fuel node set --node-id %s --role %s --env %s'
- % (node_id, ','.join(roles_blade[0]), self.env_id))
+ % (node_id, roles_blade[0], self.env_id))
self.download_deployment_config()
for node_id, roles_blade in self.node_id_roles_dict.iteritems():
@@ -37,8 +37,7 @@ class ConfigureNodes(object):
self.upload_deployment_config()
def modify_node_network_schemes(self, node_id, roles_blade):
- log('Modify node network transformations in environment %s'
- % self.env_id)
+ log('Modify network transformations for node %s' % node_id)
type = self.dea.get_node_property(roles_blade[1], 'transformations')
transformations = self.dea.get_transformations(type)
@@ -53,7 +52,6 @@ class ConfigureNodes(object):
with io.open(node_file, 'w') as stream:
yaml.dump(node, stream, default_flow_style=False)
-
def download_deployment_config(self):
log('Download deployment config for environment %s' % self.env_id)
exec_cmd('fuel deployment --env %s --default --dir %s'
diff --git a/fuel/deploy/cloud/deploy.py b/fuel/deploy/cloud/deploy.py
index c8714f8..c423834 100644
--- a/fuel/deploy/cloud/deploy.py
+++ b/fuel/deploy/cloud/deploy.py
@@ -19,6 +19,8 @@ parse = common.parse
err = common.err
check_file_exists = common.check_file_exists
log = common.log
+commafy = common.commafy
+ArgParser = common.ArgParser
class Deploy(object):
@@ -57,8 +59,8 @@ class Deploy(object):
log('Deleting node %s' % node[N['id']])
exec_cmd('fuel node --node-id %s --delete-from-db'
% node[N['id']])
- exec_cmd('dockerctl shell cobbler cobbler system remove '
- '--name node-%s' % node[N['id']])
+ exec_cmd('cobbler system remove --name node-%s'
+ % node[N['id']], False)
def check_previous_installation(self):
log('Check previous installation')
@@ -120,7 +122,7 @@ class Deploy(object):
self.node_ids_dict[blade] = node[N['id']]
def discovery_waiting_loop(self, discovered_macs):
- WAIT_LOOP = 180
+ WAIT_LOOP = 320
SLEEP_TIME = 10
all_discovered = False
for i in range(WAIT_LOOP):
@@ -147,13 +149,8 @@ class Deploy(object):
def assign_roles_to_cluster_node_ids(self):
self.node_id_roles_dict = {}
for blade, node_id in self.node_ids_dict.iteritems():
- role_list = []
- role = self.dea.get_node_role(blade)
- if role == 'controller':
- role_list.extend(['controller', 'mongo'])
- elif role == 'compute':
- role_list.extend(['compute'])
- self.node_id_roles_dict[node_id] = (role_list, blade)
+ roles = commafy(self.dea.get_node_role(blade))
+ self.node_id_roles_dict[node_id] = (roles, blade)
def configure_environment(self):
config_env = ConfigureEnvironment(self.dea, YAML_CONF_DIR,
@@ -175,25 +172,16 @@ class Deploy(object):
self.configure_environment()
self.deploy_cloud()
-def usage():
- print '''
- Usage:
- python deploy.py <dea_file> <macs_file>
-
- Example:
- python deploy.py dea.yaml macs.yaml
- '''
-
def parse_arguments():
- if len(sys.argv) != 3:
- log('Incorrect number of arguments')
- usage()
- sys.exit(1)
- dea_file = sys.argv[-2]
- macs_file = sys.argv[-1]
- check_file_exists(dea_file)
- check_file_exists(macs_file)
- return dea_file, macs_file
+ parser = ArgParser(prog='python %s' % __file__)
+ parser.add_argument('dea_file', action='store',
+ help='Deployment Environment Adapter: dea.yaml')
+ parser.add_argument('macs_file', action='store',
+ help='Blade MAC addresses: macs.yaml')
+ args = parser.parse_args()
+ check_file_exists(args.dea_file)
+ check_file_exists(args.macs_file)
+ return (args.dea_file, args.macs_file)
def main():
diff --git a/fuel/deploy/cloud/deployment.py b/fuel/deploy/cloud/deployment.py
index cf56c36..0054c5b 100644
--- a/fuel/deploy/cloud/deployment.py
+++ b/fuel/deploy/cloud/deployment.py
@@ -31,7 +31,7 @@ class Deployment(object):
% (self.yaml_config_dir, self.env_id)
if os.path.exists(deployment_dir):
shutil.rmtree(deployment_dir)
- exec_cmd('fuel --env %s deployment --default --dir %s'
+ exec_cmd('fuel deployment --env %s --download --dir %s'
% (self.env_id, self.yaml_config_dir))
def upload_deployment_info(self):
@@ -75,7 +75,8 @@ class Deployment(object):
if env[0][E['status']] == 'operational':
ready = True
break
- elif env[0][E['status']] == 'error':
+ elif (env[0][E['status']] == 'error'
+ or env[0][E['status']] == 'stopped'):
break
else:
time.sleep(SLEEP_TIME)
@@ -102,10 +103,9 @@ class Deployment(object):
def health_check(self):
log('Now running sanity and smoke health checks')
- exec_cmd('fuel health --env %s --check sanity,smoke --force'
- % self.env_id)
- log('Health checks passed !')
-
+ log(exec_cmd('fuel health --env %s --check sanity,smoke --force'
+ % self.env_id))
+
def deploy(self):
self.config_opnfv()
self.run_deploy()