Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathssh-devstack.sh
More file actions
Latest commit
executable file
·59 lines (50 loc) · 1.7 KB
/
Copy pathssh-devstack.sh
File metadata and controls
executable file
·59 lines (50 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
functionsyntax {
echo"SSHs in to the devstack on the XS host"
echo
echo"Syntax: $0 <private key> <host>"
exit 1
}
PrivID=${1:-$PrivID}
Devstack1=${2:-$Devstack1}
[ -z$Devstack1 ] && syntax
set -u
if [ !-e$PrivID ];then
echo"ID file $PrivID does not exist; Please specify valid private key"
exit 1
fi
ssh_options="-o BatchMode=yes -o StrictHostKeyChecking=no "
ssh_options+="-o UserKnownHostsFile=/dev/null -i $PrivID -X"
functionhostToDevstack() {
local __resultvar=$2
# Check if it's a XS host and we know how to get to the devstack DomU...
echo"$1 does not appear to be a devstack environment. Assume XAPI-compatible and trying to auto detect devstack VM"
ips=`ssh -o LogLevel=quiet $ssh_options root@$1"xe vm-list other-config:os-vpx=true params=networks"`
if [ -z"$ips" ];then
echo"No IPs - cannot detect domU"
exit 1
fi
ips=`echo $ips| sed -e 's#/ip: #\n#g'| sed -e 's/;.\+//' -e '1d'`
fornew_ipin$ips;do
if [ $new_ip=='10.255.255.255' ];then
echo"Skipping $new_ip"
continue
fi
echo"Attempting to log in to devstack VM $new_ip"
ssh -o LogLevel=quiet $ssh_options stack@$new_ip /bin/true >/dev/null 2>&1
if [ $?== 0 ] ;then
echo"Found DevStack VM as $new_ip"
eval$__resultvar="'$new_ip'"
return
fi
done
echo"Could not find devstack"
exit 1
}
# Test if we have the right host
ssh -o LogLevel=quiet $ssh_options stack@$Devstack1 /bin/true >/dev/null 2>&1
if [ $?!= 0 ] ;then
hostToDevstack $Devstack1 new_Devstack1
Devstack1=$new_Devstack1
fi
ssh -o LogLevel=quiet $ssh_options stack@$Devstack1