From e9dade97d97f0d80fef3dd7d73b83cbe84eebf31 Mon Sep 17 00:00:00 2001 From: "Stefan K. Berg" Date: Tue, 8 Dec 2015 11:21:19 +0100 Subject: Reaping improvements for Fuel 7 In order to download the deployment information, the node id must be explicitly specified. The fuel setting commmand returns "ha_compact" as the mode for a cluster, but Fuel does itself not understand this when changing the settings - it needs to be named "ha". Added shebang for reap.py and deploy.py. Upped the default image sizes for the DHA template to match Fuel 7. Change-Id: I3ecacb83dc44454b90dedc98104658a16926dc1f Signed-off-by: Stefan K. Berg --- deploy/common.py | 4 +++- deploy/deploy.py | 1 + deploy/reap.py | 28 +++++++++++++++++++++++----- 3 files changed, 27 insertions(+), 6 deletions(-) mode change 100644 => 100755 deploy/deploy.py mode change 100644 => 100755 deploy/reap.py diff --git a/deploy/common.py b/deploy/common.py index 17fd2174a..ccd43d79a 100644 --- a/deploy/common.py +++ b/deploy/common.py @@ -39,10 +39,12 @@ LOG.addHandler(out_handler) os.chmod(LOGFILE, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) def exec_cmd(cmd, check=True): + nul_f = open(os.devnull, 'w') process = subprocess.Popen(cmd, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, + stderr=nul_f, shell=True) + nul_f.close() response = process.communicate()[0].strip() return_code = process.returncode if check: diff --git a/deploy/deploy.py b/deploy/deploy.py old mode 100644 new mode 100755 index 4e209a932..8a4bfc40a --- a/deploy/deploy.py +++ b/deploy/deploy.py @@ -1,3 +1,4 @@ +#!/usr/bin/python ############################################################################### # Copyright (c) 2015 Ericsson AB and others. # szilard.cserey@ericsson.com diff --git a/deploy/reap.py b/deploy/reap.py old mode 100644 new mode 100755 index b7080cdae..2155f3faa --- a/deploy/reap.py +++ b/deploy/reap.py @@ -1,3 +1,4 @@ +#!/usr/bin/python ############################################################################### # Copyright (c) 2015 Ericsson AB and others. # szilard.cserey@ericsson.com @@ -72,9 +73,9 @@ DHA_2 = ''' # which may not be correct - please adjust as needed. ''' -DISKS = {'fuel': '30G', - 'controller': '30G', - 'compute': '30G'} +DISKS = {'fuel': '50G', + 'controller': '60G', + 'compute': '50G'} class Reap(object): @@ -101,6 +102,12 @@ class Reap(object): exec_cmd('fuel %s --env %s --download --dir %s' % (config_type, self.env_id, self.temp_dir)) + def download_node_config(self, nodeid): + log('Download node %s config for environment %s to %s' + % (nodeid, self.env_id,self.temp_dir)) + exec_cmd('fuel deployment --node-id %s --env %s --default --dir %s' + % (nodeid, self.env_id, self.temp_dir)) + def write(self, file, text, newline=True): mode = 'a' if os.path.isfile(file) else 'w' with open(file, mode) as f: @@ -152,7 +159,6 @@ class Reap(object): real_node_ids = [node[N['id']] for node in node_list] real_node_ids.sort() min_node = real_node_ids[0] - interfaces = {} transformations = {} dea_nodes = [] @@ -169,6 +175,7 @@ class Reap(object): 'role': roles} dha_node = {'id': node_id} if_name, mac = self.reap_interface(real_node_id, interfaces) + log('reap transformation for node %s' % real_node_id) tr_name = self.reap_transformation(real_node_id, roles, transformations) dea_node.update( @@ -212,6 +219,11 @@ class Reap(object): network_file = ('%s/network_%s.yaml' % (self.temp_dir, self.env_id)) network = self.read_yaml(network_file) + + # ha_compact not understood by Fuel when deploying...OD + if self.env[E['mode']] == 'ha_compact': + self.env[E['mode']] = 'ha' + env = {'environment': {'name': self.env[E['name']], 'mode': self.env[E['mode']], @@ -289,7 +301,13 @@ class Reap(object): self.write(self.dha_file, DHA_1.format(date=date, comment=self.comment)) self.get_env() - self.download_config('deployment') + + # Need to download deployment with explicit node ids + node_list = parse(exec_cmd('fuel node')) + real_node_ids = [node[N['id']] for node in node_list] + real_node_ids.sort() + self.download_node_config(','.join(real_node_ids)) + self.download_config('settings') self.download_config('network') -- cgit 1.2.3-korg