[ganeti/ganeti_webmgr] dbccb62 Changed API for serial proxy.

4 views
Skip to first unread message

g...@osuosl.org

unread,
Jan 3, 2014, 4:41:33 PM1/3/14
to ganeti-web...@googlegroups.com
The branch, bug/15495 has been updated

Old revision: 56456f2f515340359c823c51aa8c0a118cf060bf, new revision: dbccb6206b3ccd801928221cb831b73c925cdae4.
via dbccb6206b3ccd801928221cb831b73c925cdae4 (commit)
from 56456f2f515340359c823c51aa8c0a118cf060bf (commit)

- Log -----------------------------------------------------------------
commit dbccb6206b3ccd801928221cb831b73c925cdae4
Author: Jack Twilley <j...@osuosl.org>
Date: Fri Jan 3 13:41:02 2014 -0800

Changed API for serial proxy.

Some changes were made to the serial proxy API, specifically the
addition of the user variable. A change was also made in how GWM gets
that information from Ganeti.


Summary of changes:
ganeti_webmgr/utils/vncdaemon/vapclient.py | 6 +++++-
ganeti_webmgr/virtualmachines/models.py | 19 +++++++++++++------
2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/ganeti_webmgr/utils/vncdaemon/vapclient.py b/ganeti_webmgr/utils/vncdaemon/vapclient.py
index 315d335..ea5bbe9 100644
--- a/ganeti_webmgr/utils/vncdaemon/vapclient.py
+++ b/ganeti_webmgr/utils/vncdaemon/vapclient.py
@@ -72,7 +72,7 @@ def request_forwarding(server, daddr, dport, password, sport=None, tls=False):
return False


-def request_ssh(proxy, sport, daddr, dport, password, command):
+def request_ssh(proxy, sport, daddr, dport, password, user, command):
"""
Ask TVAP/VNCAP for an SSH port.
"""
@@ -82,12 +82,16 @@ def request_ssh(proxy, sport, daddr, dport, password, command):
dport = int(dport)
if not password or not command:
return False
+ command = ' '.join(command)

request = {
"daddr": daddr,
"dport": dport,
"password": password,
+ "user": user,
"command": command,
+ "ws": True,
+ "tls": False,
}

if sport:

diff --git a/ganeti_webmgr/virtualmachines/models.py b/ganeti_webmgr/virtualmachines/models.py
index 323acf0..1a22e0a 100644
--- a/ganeti_webmgr/virtualmachines/models.py
+++ b/ganeti_webmgr/virtualmachines/models.py
@@ -291,17 +291,24 @@ class VirtualMachine(CachedClusterObject):
contacting the proxy.
"""

- command = self.rapi.GetInstanceConsole(self.hostname)["command"]
+ rapi = self.rapi.GetInstanceConsole(self.hostname)
+ # Return None if rapi["kind"] is not of type constants.CONS_SSH.
+ daddr = rapi["host"]
+ # As of Ganeti 2.4-2.6.0, port not sent by RAPI.
+ try:
+ dport = rapi["port"]
+ except KeyError:
+ dport = 22
+ user = rapi["user"]
+ # Password is initially null.
password = ''
- info_ = self.info
- port = info_['network_port']
- node = info_['pnode']
+ command = rapi["command"]

if settings.CONSOLE_PROXY:
proxy_server = settings.CONSOLE_PROXY.split(":")
password = generate_random_password()
- sport = request_ssh(proxy_server, sport, node, port,
- password, command)
+ sport = request_ssh(proxy_server, sport, daddr, dport,
+ password, user, command)

if sport:
return proxy_server[0], sport, password
Reply all
Reply to author
Forward
0 new messages