summaryrefslogtreecommitdiffstats
path: root/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'deploy')
-rw-r--r--deploy/cloud/deployment.py116
-rw-r--r--deploy/common.py3
-rw-r--r--deploy/config/dea_base.yaml24
-rw-r--r--deploy/config/plugins/fuel-tacker_0.9.0.yaml48
-rw-r--r--deploy/deploy-config.py1
-rw-r--r--deploy/environments/execution_environment.py2
-rw-r--r--deploy/reap.py9
-rw-r--r--deploy/scenario/ha_odl-l2_sfc_heat_ceilometer_scenario.yaml9
-rw-r--r--deploy/scenario/no-ha_odl-l2_sfc_heat_ceilometer_scenario.yaml9
9 files changed, 152 insertions, 69 deletions
diff --git a/deploy/cloud/deployment.py b/deploy/cloud/deployment.py
index 4a9fcd9a8..ecccc241f 100644
--- a/deploy/cloud/deployment.py
+++ b/deploy/cloud/deployment.py
@@ -9,6 +9,7 @@
import time
import re
+import json
from common import (
N,
@@ -29,8 +30,16 @@ GREP_LINES_OF_LEADING_CONTEXT = 100
GREP_LINES_OF_TRAILING_CONTEXT = 100
LIST_OF_CHAR_TO_BE_ESCAPED = ['[', ']', '"']
-class Deployment(object):
+class DeployNotStart(Exception):
+ """Unable to start deployment"""
+
+
+class NodesGoOffline(Exception):
+ """Nodes goes offline during deployment"""
+
+
+class Deployment(object):
def __init__(self, dea, yaml_config_dir, env_id, node_id_roles_dict,
no_health_check, deploy_timeout):
@@ -43,7 +52,6 @@ class Deployment(object):
self.pattern = re.compile(
'\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d')
-
def collect_error_logs(self):
for node_id, roles_blade in self.node_id_roles_dict.iteritems():
log_list = []
@@ -89,7 +97,7 @@ class Deployment(object):
log_msg += details
if log_msg:
- log_list.append(log_msg)
+ log_list.append(log_msg)
if log_list:
role = ('controller' if 'controller' in roles_blade[0]
@@ -99,47 +107,88 @@ class Deployment(object):
for log_msg in log_list:
print(log_msg + '\n')
-
def run_deploy(self):
SLEEP_TIME = 60
- LOG_FILE = 'cloud.log'
+ abort_after = 60 * int(self.deploy_timeout)
+ start = time.time()
log('Starting deployment of environment %s' % self.env_id)
- deploy_proc = run_proc('fuel --env %s deploy-changes | strings > %s'
- % (self.env_id, LOG_FILE))
-
+ deploy_id = None
ready = False
- for i in range(int(self.deploy_timeout)):
- env = parse(exec_cmd('fuel env --env %s' % self.env_id))
- log('Environment status: %s' % env[0][E['status']])
- r, _ = exec_cmd('tail -2 %s | head -1' % LOG_FILE, False)
- if r:
- log(r)
- if env[0][E['status']] == 'operational':
- ready = True
- break
- elif (env[0][E['status']] == 'error'
- or env[0][E['status']] == 'stopped'):
- break
- else:
+ timeout = False
+
+ attempts = 0
+ while attempts < 3:
+ try:
+ if time.time() > start + abort_after:
+ timeout = True
+ break
+ if not deploy_id:
+ deploy_id = self._start_deploy_task()
+ sts, prg, msg = self._deployment_status(deploy_id)
+ if sts == 'error':
+ log('Error during deployment: {}'.format(msg))
+ break
+ if sts == 'running':
+ log('Environmnent deploymnet progress: {}%'.format(prg))
+ elif sts == 'ready':
+ ready = True
+ break
time.sleep(SLEEP_TIME)
-
- if (env[0][E['status']] <> 'operational'
- and env[0][E['status']] <> 'error'
- and env[0][E['status']] <> 'stopped'):
- err('Deployment timed out, environment %s is not operational, snapshot will not be performed'
- % self.env_id, self.collect_logs)
-
- run_proc_wait_terminated(deploy_proc)
- delete(LOG_FILE)
-
+ except (DeployNotStart, NodesGoOffline) as e:
+ log(e)
+ attempts += 1
+ deploy_id = None
+ time.sleep(SLEEP_TIME * attempts)
+
+ if timeout:
+ err('Deployment timed out, environment %s is not operational, '
+ 'snapshot will not be performed'
+ % self.env_id)
if ready:
- log('Environment %s successfully deployed' % self.env_id)
+ log('Environment %s successfully deployed'
+ % self.env_id)
else:
self.collect_error_logs()
err('Deployment failed, environment %s is not operational'
% self.env_id, self.collect_logs)
+ def _start_deploy_task(self):
+ out, _ = exec_cmd('fuel2 env deploy {}'.format(self.env_id), False)
+ id = self._deployment_task_id(out)
+ return id
+
+ def _deployment_task_id(self, response):
+ response = str(response)
+ if response.startswith('Deployment task with id'):
+ for s in response.split():
+ if s.isdigit():
+ return int(s)
+ raise DeployNotStart('Unable to start deployment: {}'.format(response))
+
+ def _deployment_status(self, id):
+ task = self._task_fields(id)
+ if task['status'] == 'error':
+ if task['message'].endswith(
+ 'offline. Remove them from environment and try again.'):
+ raise NodesGoOffline(task['message'])
+ return task['status'], task['progress'], task['message']
+
+ def _task_fields(self, id):
+ try:
+ out, _ = exec_cmd('fuel2 task show {} -f json'.format(id), False)
+ task_info = json.loads(out)
+ properties = {}
+ # for 9.0 this can be list of dicts or dict
+ # see https://bugs.launchpad.net/fuel/+bug/1625518
+ if isinstance(task_info, list):
+ for d in task_info:
+ properties.update({d['Field']: d['Value']})
+ else:
+ return task_info
+ return properties
+ except ValueError as e:
+ err('Unable to fetch task info: {}'.format(e))
def collect_logs(self):
log('Cleaning out any previous deployment logs')
@@ -155,7 +204,6 @@ class Deployment(object):
r, _ = exec_cmd('tar -czhf /root/deploy-%s.log.tar.gz /var/log/remote' % time.strftime("%Y%m%d-%H%M%S"), False)
log(r)
-
def verify_node_status(self):
node_list = parse(exec_cmd('fuel --env %s node' % self.env_id))
failed_nodes = []
@@ -169,7 +217,6 @@ class Deployment(object):
summary += '[node %s, status %s]\n' % (node, status)
err('Deployment failed: %s' % summary, self.collect_logs)
-
def health_check(self):
log('Now running sanity and smoke health checks')
r = exec_cmd('fuel health --env %s --check sanity,smoke --force' % self.env_id)
@@ -177,7 +224,6 @@ class Deployment(object):
if 'failure' in r:
err('Healthcheck failed!', self.collect_logs)
-
def deploy(self):
self.run_deploy()
self.verify_node_status()
diff --git a/deploy/common.py b/deploy/common.py
index 353045867..80832e201 100644
--- a/deploy/common.py
+++ b/deploy/common.py
@@ -18,6 +18,7 @@ import shutil
import stat
import errno
import time
+import shlex
N = {'id': 0, 'status': 1, 'name': 2, 'cluster': 3, 'ip': 4, 'mac': 5,
'roles': 6, 'pending_roles': 7, 'online': 8, 'group_id': 9}
@@ -41,7 +42,7 @@ os.chmod(LOGFILE, 0664)
def mask_arguments(cmd, mask_args, mask_str):
- cmd_line = cmd.split()
+ cmd_line = shlex.split(cmd)
for pos in mask_args:
# Don't mask the actual command; also check if we don't reference
# beyond bounds
diff --git a/deploy/config/dea_base.yaml b/deploy/config/dea_base.yaml
index 0b8485ba0..c1a0606bc 100644
--- a/deploy/config/dea_base.yaml
+++ b/deploy/config/dea_base.yaml
@@ -636,43 +636,25 @@ settings:
section: main universe multiverse
suite: trusty
type: deb
- uri: http://archive.ubuntu.com/ubuntu/
+ uri: http://10.20.0.2:8080/mirrors/ubuntu/
- name: ubuntu-updates
priority: null
section: main universe multiverse
suite: trusty-updates
type: deb
- uri: http://archive.ubuntu.com/ubuntu/
+ uri: http://10.20.0.2:8080/mirrors/ubuntu/
- name: ubuntu-security
priority: null
section: main universe multiverse
suite: trusty-security
type: deb
- uri: http://archive.ubuntu.com/ubuntu/
+ uri: http://10.20.0.2:8080/mirrors/ubuntu/
- name: mos
priority: 1050
section: main restricted
suite: mos9.0
type: deb
uri: http://10.20.0.2:8080/mitaka-9.0/ubuntu/x86_64
- - name: mos-updates
- priority: 1050
- section: main restricted
- suite: mos9.0-updates
- type: deb
- uri: http://mirror.fuel-infra.org/mos-repos/ubuntu/9.0/
- - name: mos-security
- priority: 1050
- section: main restricted
- suite: mos9.0-security
- type: deb
- uri: http://mirror.fuel-infra.org/mos-repos/ubuntu/9.0/
- - name: mos-holdback
- priority: 1100
- section: main restricted
- suite: mos9.0-holdback
- type: deb
- uri: http://mirror.fuel-infra.org/mos-repos/ubuntu/9.0/
- name: Auxiliary
priority: 1150
section: main restricted
diff --git a/deploy/config/plugins/fuel-tacker_0.9.0.yaml b/deploy/config/plugins/fuel-tacker_0.9.0.yaml
new file mode 100644
index 000000000..71e028ffd
--- /dev/null
+++ b/deploy/config/plugins/fuel-tacker_0.9.0.yaml
@@ -0,0 +1,48 @@
+##############################################################################
+# Copyright (c) 2015,2016 Ericsson AB and others.
+# mskalski@mirantis.com
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+plugin-config-metadata:
+ title: Tacker fuel plugin configuration template
+ version: 0.1
+ created: 03.10.2016
+ comment: None
+tacker:
+ metadata:
+ #chosen_id: Assigned during installation
+ class: plugin
+ default: false
+ enabled: true
+ label: Tacker VNF manager
+ toggleable: true
+ versions:
+ - metadata:
+ group: 'openstack_services'
+ db_password:
+ generator: 'password'
+ user_password:
+ generator: 'password'
+ user: 'tacker'
+ port: 8889
+ service: 'tacker-server'
+ restrictions:
+ - condition: "settings:opendaylight == null or settings:opendaylight.metadata.enabled == false or settings:opendaylight.enable_sfc.value == false"
+ strict: false
+ message: "Please install OpenDaylight Plugin with SFC features enabled"
+ - condition: "settings:fuel-plugin-ovs == null or settings:fuel-plugin-ovs.metadata.enabled == false"
+ strict: false
+ message: "Please install and enable Openvswitch plugin with NSH support."
+ #plugin_id: Assigned during installation
+ plugin_version: 0.2.0
+ debug:
+ value: false
+ label: 'Debug logging'
+ description: 'Debug logging mode provides more information, but requires more disk space.'
+ weight: 25
+ type: "checkbox"
+ weight: 70
diff --git a/deploy/deploy-config.py b/deploy/deploy-config.py
index 436002d36..8896080db 100644
--- a/deploy/deploy-config.py
+++ b/deploy/deploy-config.py
@@ -137,7 +137,6 @@ def merge_networks(list_1, list_2):
return [new_nets.get(net.get('name'), net) for net in list_1]
-
def merge_dicts(dict1, dict2):
for k in set(dict1).union(dict2):
if k in dict1 and k in dict2:
diff --git a/deploy/environments/execution_environment.py b/deploy/environments/execution_environment.py
index af0e130dd..7a0b4744e 100644
--- a/deploy/environments/execution_environment.py
+++ b/deploy/environments/execution_environment.py
@@ -46,7 +46,7 @@ class ExecutionEnvironment(object):
disk_files.append(source_file)
log('Deleting VM %s with disks %s' % (vm_name, disk_files))
exec_cmd('virsh destroy %s' % vm_name, False)
- exec_cmd('virsh undefine %s' % vm_name, False)
+ exec_cmd('virsh undefine --managed-save --remove-all-storage %s' % vm_name, False)
for file in disk_files:
delete(file)
diff --git a/deploy/reap.py b/deploy/reap.py
index eb02fe25d..69c98d10c 100644
--- a/deploy/reap.py
+++ b/deploy/reap.py
@@ -18,6 +18,7 @@ import shutil
import tempfile
import re
import netaddr
+import templater
from common import (
N,
@@ -79,8 +80,6 @@ DHA_2 = '''
# which may not be correct - please adjust as needed.
'''
-TEMPLATER = 'templater.py'
-
DISKS = {'fuel': '100G',
'controller': '100G',
'compute': '100G'}
@@ -353,8 +352,10 @@ class Reap(object):
self.download_config('network')
def create_base_dea(self):
- exec_cmd('python %s %s %s %s'
- % (TEMPLATER, self.dea_file, self.template, self.base_dea))
+ templater = templater.Templater(self.dea_file,
+ self.template,
+ self.base_dea)
+ templater.run()
def finale(self):
log('DEA file is available at %s' % self.dea_file)
diff --git a/deploy/scenario/ha_odl-l2_sfc_heat_ceilometer_scenario.yaml b/deploy/scenario/ha_odl-l2_sfc_heat_ceilometer_scenario.yaml
index e6aef2aba..c4789484c 100644
--- a/deploy/scenario/ha_odl-l2_sfc_heat_ceilometer_scenario.yaml
+++ b/deploy/scenario/ha_odl-l2_sfc_heat_ceilometer_scenario.yaml
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
+# Copyright (c) 2015,2016 Ericsson AB and others.
# jonas.bjurel@ericsson.com
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -22,7 +22,7 @@
# deployment configuration meta-data
deployment-scenario-metadata:
title: ODL-L2 SFC HA deployment
- version: 0.0.1
+ version: 0.0.2
created: Feb 10 2016
comment: Rebased to Fuel9
@@ -52,6 +52,9 @@ stack-extensions:
value: true
metadata:
plugin_version: 0.9.0
+ - module: tacker
+ module-config-name: fuel-tacker
+ module-config-version: 0.9.0
# Note that the module substitionion does not support arrays
# This is a quick fix
# - module: opendaylight
@@ -78,7 +81,7 @@ dea-override-config:
role: controller,opendaylight
- id: 2
interfaces: interfaces_1
- role: mongo,controller
+ role: mongo,controller,tacker
- id: 3
interfaces: interfaces_1
role: ceph-osd,controller
diff --git a/deploy/scenario/no-ha_odl-l2_sfc_heat_ceilometer_scenario.yaml b/deploy/scenario/no-ha_odl-l2_sfc_heat_ceilometer_scenario.yaml
index a8d9ed848..90a45d577 100644
--- a/deploy/scenario/no-ha_odl-l2_sfc_heat_ceilometer_scenario.yaml
+++ b/deploy/scenario/no-ha_odl-l2_sfc_heat_ceilometer_scenario.yaml
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
+# Copyright (c) 2015,2016 Ericsson AB and others.
# jonas.bjurel@ericsson.com
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -22,7 +22,7 @@
# deployment configuration meta-data
deployment-scenario-metadata:
title: ODL-L2-SFC No-HA deployment
- version: 0.0.2
+ version: 0.0.3
created: Feb 10 2016
comment: Fuel ODL-L2 SFC No HA with Ceph, Ceilometer and Heat Rebased for Fuel9
@@ -52,6 +52,9 @@ stack-extensions:
value: true
metadata:
plugin_version: 0.9.0
+ - module: tacker
+ module-config-name: fuel-tacker
+ module-config-version: 0.9.0
# Note that the module substitionion does not support arrays
# This is a quick fix
@@ -76,7 +79,7 @@ dea-override-config:
nodes:
- id: 1
interfaces: interfaces_1
- role: mongo,controller
+ role: mongo,controller,tacker
- id: 2
interfaces: interfaces_1
role: ceph-osd,opendaylight