1 ##############################################################################
2 # Copyright (c) 2015 Ericsson AB and others.
3 # stefan.k.berg@ericsson.com
4 # jonas.bjurel@ericsson.com
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
19 SSHPASS="r00tme" sshpass -e ssh -o UserKnownHostsFile=/dev/null \
20 -o StrictHostKeyChecking=no -o ConnectTimeout=15 "$@"
24 SSHPASS="r00tme" sshpass -e scp -o UserKnownHostsFile=/dev/null \
25 -o StrictHostKeyChecking=no -o ConnectTimeout=15 "$@"
29 fuel node | grep True | wc -l
33 ssh root@10.20.0.2 "fuel $@"
36 # Return MAC id for virsh node
38 virsh dumpxml $1 | grep "mac address" | head -1 | sed "s/.*'..:..:..:..:\(.*\)'.*/\1/"
41 # Wait for node with virtid name to come up
47 fuel node --node-id $mac 2>/dev/null | grep -q True && break
55 # Wait for node count to increase
62 expectCnt=$[initCnt+1]
66 if [ $cnt -eq $expectCnt ]; then
68 elif [ $cnt -lt $initCnt ]; then
69 error_exit "Node count decreased while waiting, $initCnt -> $cnt"
70 elif [ $cnt -gt $expectCnt ]; then
71 error_exit "Node count exceeded expect count, $cnt > $expectCnt"
80 virsh dumpxml $1 | grep -v "<boot.*>" | \
82 <boot dev='cdrom'/\>\n\
84 <bootmenu enable='no'/\>" > $tmpdir/vm.xml || error_exit "Could not set bootorder"
85 virsh define $tmpdir/vm.xml || error_exit "Could not set bootorder"
89 virsh dumpxml $1 | grep -v "<boot.*>" | \
92 <boot dev='cdrom'/\>\n\
93 <bootmenu enable='no'/\>" > $tmpdir/vm.xml || error_exit "Could not set bootorder"
94 virsh define $tmpdir/vm.xml || error_exit "Could not set bootorder"
98 virsh dumpxml $1 | grep -v '\.iso' | sed "s/<.*device='cdrom'.*/<disk type='file' device='cdrom'>/" | \
99 sed "/<.*device='cdrom'.*/a <source file='$2'/>" > $tmpdir/vm.xml \
100 || error_exit "Could not add isofile"
101 virsh define $tmpdir/vm.xml || error_exit "Could not add isofile"
105 virsh dumpxml $1 | grep -v '\.iso' | sed "s/<.*device='cdrom'.*/<disk type='block' device='cdrom'>/" \
107 || error_exit "Could not remove isofile"
108 virsh define $tmpdir/vm.xml || error_exit "Could not remove isofile"