summaryrefslogtreecommitdiffstats
path: root/deploy/get_para_from_deploy.py
diff options
context:
space:
mode:
authorYao Lu <lu.yao135@zte.com.cn>2016-11-29 22:39:37 +0800
committerzhouya <zhou.ya@zte.com.cn>2016-12-20 15:27:28 +0800
commit0b57e3be28f1b42d7cea436feb04fbcdf83e8484 (patch)
tree900413e47a5994aa36b00d2b7db0e14ca4e1815c /deploy/get_para_from_deploy.py
parenta5e3706c114f43224056fa222276491445ddcf55 (diff)
implement deploy on virthal pod
Change-Id: I600e21f0d36f37c75cac4ace5f7225e32ab93d56 Signed-off-by: Yao Lu <lu.yao135@zte.com.cn>
Diffstat (limited to 'deploy/get_para_from_deploy.py')
-rwxr-xr-xdeploy/get_para_from_deploy.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/deploy/get_para_from_deploy.py b/deploy/get_para_from_deploy.py
new file mode 100755
index 00000000..c0e08c56
--- /dev/null
+++ b/deploy/get_para_from_deploy.py
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+##############################################################################
+# Copyright (c) 2016 ZTE Coreporation and others.
+# hu.zhijiang@zte.com.cn
+# lu.yao135@zte.com.cn
+# 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
+##############################################################################
+import get_conf
+from oslo_config import cfg
+import sys
+
+_CLI_OPTS = [
+ cfg.StrOpt('dha',
+ help='The dha file path'),
+]
+
+
+def parse(conf, args):
+ conf.register_cli_opts(_CLI_OPTS)
+ conf(args=args)
+
+
+def get_yml_para(dha_file):
+ data = get_conf.init(dha_file)
+ disks = data.get("disks", 0)
+ daisyserver_size = disks.get("daisy", 0)
+ controller_node_size = disks.get("controller", 0)
+ compute_node_size = disks.get("compute", 0)
+ daisy_passwd = data.get("daisy_passwd", "")
+ daisy_ip = data.get("daisy_ip", "")
+ daisy_gateway = data.get("daisy_gateway", "")
+ return daisyserver_size, controller_node_size,\
+ compute_node_size, daisy_passwd, daisy_ip, daisy_gateway
+
+
+def get_conf_from_deploy():
+ conf = cfg.ConfigOpts()
+ parse(conf, sys.argv[1:])
+ daisyserver_size, controller_node_size, compute_node_size,\
+ daisy_passwd, daisy_ip, daisy_gateway = get_yml_para(conf['dha'])
+ print daisyserver_size
+ print controller_node_size
+ print compute_node_size
+ print daisy_passwd
+ print daisy_ip
+ print daisy_gateway
+
+if __name__ == "__main__":
+ get_conf_from_deploy()