summaryrefslogtreecommitdiffstats
path: root/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'deploy')
-rw-r--r--deploy/config/schemas.py17
-rw-r--r--deploy/environment.py18
2 files changed, 17 insertions, 18 deletions
diff --git a/deploy/config/schemas.py b/deploy/config/schemas.py
index 3096d017..0e013eb9 100644
--- a/deploy/config/schemas.py
+++ b/deploy/config/schemas.py
@@ -7,6 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+import copy
from jsonschema import Draft4Validator, FormatChecker
import sys
import yaml
@@ -73,6 +74,10 @@ deploy_schema = {
'required': ['hosts', 'daisy_passwd', 'daisy_gateway']
}
+deploy_schema_bm = copy.deepcopy(deploy_schema)
+deploy_schema_bm['properties']['hosts']['items']['required'] = \
+ ['roles', 'ipmi_ip', 'ipmi_user', 'ipmi_pass']
+
def _validate(data, schema):
v = Draft4Validator(schema, format_checker=FormatChecker())
@@ -80,15 +85,11 @@ def _validate(data, schema):
return errors
-def item_validate(data, schema_type):
- if schema_type not in schema_mapping:
- return str('Schema Type %s does not exist' % schema_type)
- else:
- return _validate(data, schema_mapping.get(schema_type))
-
-
def deploy_schema_validate(data):
- return _validate(data, deploy_schema)
+ if data.get('adapter', 'libvirt') == 'ipmi':
+ return _validate(data, deploy_schema_bm)
+ else:
+ return _validate(data, deploy_schema)
def _main():
diff --git a/deploy/environment.py b/deploy/environment.py
index dd9e0142..5371e6ca 100644
--- a/deploy/environment.py
+++ b/deploy/environment.py
@@ -147,17 +147,15 @@ class BareMetalEnvironment(DaisyEnvironmentBase):
disks=[self.daisy_server_info['image']])
def reboot_nodes(self, boot_dev=None):
- # TODO: add ipmi info into deploy.yml, or read from PDF
- address = 106
for node in self.deploy_struct['hosts']:
- node['ipmiIp'] = '192.168.1.' + str(address)
- address += 1
- if address > 111:
- err_exit('the ipmi address exceeds the range 106~110')
- node['ipmiUser'] = 'zteroot'
- node['ipmiPass'] = 'superuser'
- ipmi_reboot_node(node['ipmiIp'], node['ipmiUser'],
- node['ipmiPass'], boot_source=boot_dev)
+ if 'ipmi_ip' not in node \
+ or 'ipmi_user' not in node \
+ or 'ipmi_pass' not in node:
+ err_exit('Missing ipmi information')
+ ipmi_reboot_node(node['ipmi_ip'],
+ node['ipmi_user'],
+ node['ipmi_pass'],
+ boot_source=boot_dev)
def deploy(self, deploy_file, net_file):
self.server.prepare_cluster(deploy_file, net_file)