Code Review
/
joid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
modified to enable the interface with internal-api space for
[joid.git]
/
ci
/
genBundle.py
diff --git
a/ci/genBundle.py
b/ci/genBundle.py
index
ffa1119
..
8075eeb
100644
(file)
--- a/
ci/genBundle.py
+++ b/
ci/genBundle.py
@@
-12,7
+12,9
@@
Parameters:
from optparse import OptionParser
from jinja2 import Environment, FileSystemLoader
from optparse import OptionParser
from jinja2 import Environment, FileSystemLoader
+from distutils.version import LooseVersion, StrictVersion
import os
import os
+import subprocess
import random
import yaml
import sys
import random
import yaml
import sys
@@
-34,7
+36,12
@@
labconfig_file = options.lab
scenarioconfig_file = 'default_deployment_config.yaml'
# Capture our current directory
scenarioconfig_file = 'default_deployment_config.yaml'
# Capture our current directory
-TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/bundle_tpl'
+jujuver = subprocess.check_output(["juju", "--version"])
+
+if LooseVersion(jujuver) >= LooseVersion('2'):
+ TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/juju2/bundle_tpl'
+else:
+ TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/bundle_tpl'
#
# Prepare variables
#
# Prepare variables
@@
-76,8
+83,14
@@
def unit_ceph_qty():
if config['os']['ha']['mode'] == 'ha':
return config['os']['ha']['cluster_size']
else:
if config['os']['ha']['mode'] == 'ha':
return config['os']['ha']['cluster_size']
else:
- return 2
+ if config['opnfv']['units'] >= 3:
+ return config['os']['ha']['cluster_size']
+ else:
+ return 2
+def unit_scaleio_qty():
+ """Return size of the scaleio cluster"""
+ return 3
def to_select(qty=False):
"""Return a random list of machines numbers to deploy"""
def to_select(qty=False):
"""Return a random list of machines numbers to deploy"""
@@
-85,10
+98,10
@@
def to_select(qty=False):
if not qty:
qty = config['os']['ha']['cluster_size'] if \
config['os']['ha']['mode'] == 'ha' else 1
if not qty:
qty = config['os']['ha']['cluster_size'] if \
config['os']['ha']['mode'] == 'ha' else 1
- if config['os']['h
a']['mode'] == 'ha'
:
+ if config['os']['h
yperconverged']
:
return random.sample(range(0, config['opnfv']['units']), qty)
else:
return random.sample(range(0, config['opnfv']['units']), qty)
else:
- return random.sample(range(0,
2
), qty)
+ return random.sample(range(0,
qty
), qty)
def get_password(key, length=16, special=False):
def get_password(key, length=16, special=False):
@@
-169,10
+182,18
@@
if 'sfc' in features:
config['os']['network']['sfc'] = True
if 'dpdk' in features:
config['os']['network']['dpdk'] = True
config['os']['network']['sfc'] = True
if 'dpdk' in features:
config['os']['network']['dpdk'] = True
+ config['os']['beta']['huge_pages'] = True
+ config['os']['beta']['cpu_pin'] = True
if 'bgpvpn' in features:
config['os']['network']['bgpvpn'] = True
if 'odll3' in features:
config['os']['network']['odll3'] = True
if 'bgpvpn' in features:
config['os']['network']['bgpvpn'] = True
if 'odll3' in features:
config['os']['network']['odll3'] = True
+if 'dishypcon' in features:
+ config['os']['hyperconverged'] = False
+if 'hugepages' in features:
+ config['os']['beta']['huge_pages'] = True
+ config['os']['beta']['cpu_pin'] = True
+
# Set beta option from extra
if 'publicapi' in extra:
# Set beta option from extra
if 'publicapi' in extra:
@@
-181,12
+202,17
@@
if 'radosgwcluster' in extra:
config['os']['beta']['hacluster_ceph_radosgw'] = True
if 'hugepages' in extra:
config['os']['beta']['huge_pages'] = True
config['os']['beta']['hacluster_ceph_radosgw'] = True
if 'hugepages' in extra:
config['os']['beta']['huge_pages'] = True
+ config['os']['beta']['cpu_pin'] = True
+if 'mitaka' in extra:
+ config['os']['release'] = 'mitaka'
if 'trusty' in extra:
config['ubuntu']['release'] = 'trusty'
if 'liberty' in extra:
config['os']['release'] = 'liberty'
if 'trusty' in extra:
config['ubuntu']['release'] = 'trusty'
if 'liberty' in extra:
config['os']['release'] = 'liberty'
-
-# pp(config)
+if 'xenial' in extra:
+ config['ubuntu']['release'] = 'xenial'
+if 'dishypcon' in extra:
+ config['os']['hyperconverged'] = False
#
# Transform template to bundle.yaml according to config
#
# Transform template to bundle.yaml according to config
@@
-201,7
+227,17
@@
template = env.get_template('bundle.yaml')
env.globals.update(get_password=get_password)
env.globals.update(unit_qty=unit_qty)
env.globals.update(unit_ceph_qty=unit_ceph_qty)
env.globals.update(get_password=get_password)
env.globals.update(unit_qty=unit_qty)
env.globals.update(unit_ceph_qty=unit_ceph_qty)
+env.globals.update(unit_scaleio_qty=unit_scaleio_qty)
env.globals.update(to_select=to_select)
# Render the template
env.globals.update(to_select=to_select)
# Render the template
-print(template.render(**config))
+output = template.render(**config)
+
+# Check output syntax
+try:
+ yaml.load(output)
+except yaml.YAMLError as exc:
+ print(exc)
+
+# print output
+print(output)