diff options
author | meimei <meimei@huawei.com> | 2016-11-29 18:05:01 +0800 |
---|---|---|
committer | meimei <meimei@huawei.com> | 2016-11-29 18:09:16 +0800 |
commit | 6b2eccf0350f7f053e18ea2ac190489b00960809 (patch) | |
tree | 8968b2871c4bfc23bfa7077e857dae4d151e53d2 /deploy/reset_compute.py | |
parent | fcd0eefae931bb7bed0380574c1c7acaa31ffa28 (diff) |
Improve compass ci verification, clear all the warnnings
JIRA: COMPASS-494
MODIFY BY HAOJINGBO
Change-Id: I2b95d84157c860254b3b3f68f7b2a54393caf8f4
Signed-off-by: meimei <meimei@huawei.com>
Diffstat (limited to 'deploy/reset_compute.py')
-rw-r--r-- | deploy/reset_compute.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/deploy/reset_compute.py b/deploy/reset_compute.py index 717e8833..748b52c9 100644 --- a/deploy/reset_compute.py +++ b/deploy/reset_compute.py @@ -2,15 +2,17 @@ import os import sys import yaml + def exec_cmd(cmd): print cmd os.system(cmd) + def reset_baremetal(dha_info): print "reset_baremetal" hosts_info = yaml.load(open(dha_info)) - #print hosts_info + # print hosts_info ipmiUserDf = hosts_info.get('ipmiUser', 'root') ipmiPassDf = hosts_info.get('ipmiPass', 'Huawei@123') @@ -18,8 +20,8 @@ def reset_baremetal(dha_info): print ipmiPassDf hosts_list = hosts_info.get('hosts', []) - #print hosts_list - + # print hosts_list + for host in hosts_list: print host if ('compute' in host['roles']): @@ -29,7 +31,10 @@ def reset_baremetal(dha_info): print ipmiUser print ipmiPass print ipmiIp - exec_cmd("ipmitool -I lanplus -H %s -U %s -P %s chassis power reset >/dev/null" % (ipmiIp, ipmiUser, ipmiPass)) + exec_cmd( + "ipmitool -I lanplus -H %s -U %s -P %s chassis power reset \ + >/dev/null" % + (ipmiIp, ipmiUser, ipmiPass)) def reset_virtual(dha_info): @@ -45,15 +50,14 @@ def reset_virtual(dha_info): if ('compute' in host['roles']): name = host['name'] exec_cmd("virsh destroy %s" % name) - exec_cmd("virsh start %s" % name) + exec_cmd("virsh start %s" % name) if __name__ == "__main__": - deploy_type=sys.argv[1] - dha_info=sys.argv[2] + deploy_type = sys.argv[1] + dha_info = sys.argv[2] print deploy_type print dha_info - if (deploy_type == 'baremetal') : + if (deploy_type == 'baremetal'): reset_baremetal(dha_info) - elif (deploy_type == 'virtual') : + elif (deploy_type == 'virtual'): reset_virtual(dha_info) - |