aboutsummaryrefslogtreecommitdiffstats
path: root/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'deploy')
-rw-r--r--deploy/conf/hardware_environment/huawei-us-deploy-bare-1/os-nosdn-nofeature-ha.yml10
-rwxr-xr-xdeploy/deploy_host.sh8
-rw-r--r--deploy/rename_nics.py29
3 files changed, 45 insertions, 2 deletions
diff --git a/deploy/conf/hardware_environment/huawei-us-deploy-bare-1/os-nosdn-nofeature-ha.yml b/deploy/conf/hardware_environment/huawei-us-deploy-bare-1/os-nosdn-nofeature-ha.yml
index 4b812dfb..18b9f072 100644
--- a/deploy/conf/hardware_environment/huawei-us-deploy-bare-1/os-nosdn-nofeature-ha.yml
+++ b/deploy/conf/hardware_environment/huawei-us-deploy-bare-1/os-nosdn-nofeature-ha.yml
@@ -9,6 +9,8 @@ ipmiVer: '2.0'
hosts:
- name: host1
mac: 'F8:4A:BF:55:A2:8D'
+ interfaces:
+ eth1: 'F8:4A:BF:55:A2:8E'
ipmiIp: 172.16.130.26
ipmiPass: Huawei@123
roles:
@@ -17,6 +19,8 @@ hosts:
- name: host2
mac: 'D8:49:0B:DA:5A:B7'
+ interfaces:
+ eth1: 'D8:49:0B:DA:5A:B8'
ipmiIp: 172.16.130.27
ipmiPass: huawei@123
roles:
@@ -25,6 +29,8 @@ hosts:
- name: host3
mac: 'D8:49:0B:DA:2A:28'
+ interfaces:
+ eth1: 'D8:49:0B:DA:2A:29'
ipmiIp: 172.16.130.29
ipmiPass: Huawei@123
roles:
@@ -33,6 +39,8 @@ hosts:
- name: host4
mac: 'D8:49:0B:DA:5B:5D'
+ interfaces:
+ eth1: 'D8:49:0B:DA:5B:5E'
ipmiIp: 172.16.130.30
ipmiPass: Huawei@123
roles:
@@ -40,6 +48,8 @@ hosts:
- name: host5
mac: 'D8:49:0B:DA:56:85'
+ interfaces:
+ eth1: 'D8:49:0B:DA:56:86'
ipmiIp: 172.16.130.31
ipmiPass: Huawei@123
roles:
diff --git a/deploy/deploy_host.sh b/deploy/deploy_host.sh
index 1b03f043..9617b241 100755
--- a/deploy/deploy_host.sh
+++ b/deploy/deploy_host.sh
@@ -8,14 +8,18 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
rsa_file=$compass_vm_dir/boot.rsa
+
+function rename_nics(){
+ python $COMPASS_DIR/deploy/rename_nics.py $DHA $rsa_file $MGMT_IP
+}
+
function deploy_host(){
ssh $ssh_args root@${MGMT_IP} mkdir -p /opt/compass/bin/ansible_callbacks
scp $ssh_args -r ${COMPASS_DIR}/deploy/status_callback.py root@${MGMT_IP}:/opt/compass/bin/ansible_callbacks/status_callback.py
# avoid nodes reboot to fast, cobbler can not give response
- (sleep 20;reboot_hosts) &
-
+ (sleep 20; rename_nics; reboot_hosts) &
if [[ "$REDEPLOY_HOST" == true ]]; then
deploy_flag="redeploy"
else
diff --git a/deploy/rename_nics.py b/deploy/rename_nics.py
new file mode 100644
index 00000000..ef52d63a
--- /dev/null
+++ b/deploy/rename_nics.py
@@ -0,0 +1,29 @@
+import os
+import sys
+import yaml
+
+def exec_cmd(cmd):
+ print cmd
+ os.system(cmd)
+
+def rename_nics(dha_info, rsa_file, compass_ip):
+ for host in dha_info['hosts']:
+ host_name = host['name']
+ interfaces = host.get('interfaces')
+ if interfaces:
+ for interface in interfaces:
+ nic_name = interfaces.keys()[0]
+ mac = interfaces.values()[0]
+
+ exec_cmd("ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
+ -i %s root@%s \
+ 'cobbler system edit --name=%s --interface=%s --mac=%s'" \
+ % (rsa_file, compass_ip, host_name, nic_name, mac))
+
+ exec_cmd("ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
+ -i %s root@%s \
+ 'cobbler sync'" % (rsa_file, compass_ip))
+
+if __name__ == "__main__":
+ assert(len(sys.argv) == 4)
+ rename_nics(yaml.load(open(sys.argv[1])), sys.argv[2], sys.argv[3])