You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/03/18 10:11:00 UTC
git commit: updated refs/heads/master to eddcb10
Repository: cloudstack
Updated Branches:
refs/heads/master b011c9bad -> eddcb101d
CLOUDSTACK-8331: have savepassword try all interfaces
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
(cherry picked from commit b8192114767040ef4869a7e71886df5965dadb37)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/eddcb101
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/eddcb101
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/eddcb101
Branch: refs/heads/master
Commit: eddcb101dc4e6ae8f5484fbf93485d05a1a99f6e
Parents: b011c9b
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Wed Mar 18 14:05:54 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Wed Mar 18 14:40:23 2015 +0530
----------------------------------------------------------------------
.../debian/config/opt/cloud/bin/passwd_server_ip.py | 13 +++++++++----
.../debian/config/opt/cloud/bin/savepassword.sh | 2 +-
2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eddcb101/systemvm/patches/debian/config/opt/cloud/bin/passwd_server_ip.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/passwd_server_ip.py b/systemvm/patches/debian/config/opt/cloud/bin/passwd_server_ip.py
index 7476666..91dec24 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/passwd_server_ip.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/passwd_server_ip.py
@@ -46,13 +46,17 @@ def getTokenFile():
return '/tmp/passwdsrvrtoken'
def getPasswordFile():
- return '/var/cache/cloud/passwords'
+ return '/var/cache/cloud/passwords-%s' % listeningAddress
def initToken():
global secureToken
- secureToken = binascii.hexlify(os.urandom(16))
- with open(getTokenFile(), 'w') as f:
- f.write(secureToken)
+ if os.path.exists(getTokenFile()):
+ with open(getTokenFile(), 'r') as f:
+ secureToken = f.read()
+ if not secureToken:
+ secureToken = binascii.hexlify(os.urandom(16))
+ with open(getTokenFile(), 'w') as f:
+ f.write(secureToken)
def checkToken(token):
return token == secureToken
@@ -152,6 +156,7 @@ class PasswordRequestHandler(BaseHTTPRequestHandler):
if not ip or not password:
syslog.syslog('serve_password: empty ip/password[%s/%s] received from savepassword' % (ip, password))
return
+ syslog.syslog('serve_password: password saved for VM IP %s' % ip)
setPassword(ip, password)
savePasswordFile()
return
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eddcb101/systemvm/patches/debian/config/opt/cloud/bin/savepassword.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/savepassword.sh b/systemvm/patches/debian/config/opt/cloud/bin/savepassword.sh
index 7fdc99f..079b26f 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/savepassword.sh
+++ b/systemvm/patches/debian/config/opt/cloud/bin/savepassword.sh
@@ -38,7 +38,7 @@ fi
ps aux | grep passwd_server_ip.py |grep -v grep 2>&1 > /dev/null
if [ $? -eq 0 ]
then
- ips=$(ip addr show dev eth0 | grep inet | grep eth0 | awk '{print $2}')
+ ips=$(ip addr show | grep inet | awk '{print $2}')
for ip in $ips; do
server_ip=$(echo $ip | awk -F'/' '{print $1}')
curl --header "DomU_Request: save_password" "http://$server_ip:8080/" -F "ip=$VM_IP" -F "password=$PASSWORD" -F "token=$TOKEN" >/dev/null 2>/dev/null &