Change in vdsm[master]: Add simple text-based console in vdsClient

Xu He Jie xuhj at linux.vnet.ibm.com
Wed Sep 19 07:15:08 UTC 2012


Xu He Jie has uploaded a new change for review.

Change subject: Add simple text-based console in vdsClient
......................................................................

Add simple text-based console in vdsClient

Add new command 'openConsole' in vdsClient. This command
invoke 'virsh console' directly. This is easy implement for text-based
console. It means we can have a vdsm text console right now.
We can improve text console in futrue.

Change-Id: I368dbcbc2e180161f256f3fb450c344acb6a6c8a
Signed-off-by: Xu He Jie <xuhj at linux.vnet.ibm.com>
---
M vdsm_cli/vdsClient.py
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/8041/1

diff --git a/vdsm_cli/vdsClient.py b/vdsm_cli/vdsClient.py
index fe2f083..e49e66a 100644
--- a/vdsm_cli/vdsClient.py
+++ b/vdsm_cli/vdsClient.py
@@ -24,6 +24,7 @@
 import re
 import socket
 import pprint as pp
+import subprocess
 
 from vdsm import vdscli
 try:
@@ -122,8 +123,10 @@
     def __init__(self):
         self.useSSL = False
         self.truststore = None
+        self.server = "0"
 
     def do_connect(self, server, port):
+        self.server = server
         self.s = vdscli.connect(server + ':' + port,
                                 self.useSSL, self.truststore)
 
@@ -1607,6 +1610,13 @@
 
         return status['status']['code'], status['status']['message']
 
+    def openVmConsole(self, args):
+        protocol = "tls" if self.useSSL else "tcp"
+        conn = "qemu+" + protocol + "://" + self.server + "/system"
+        p = subprocess.Popen(["virsh", "-c", conn, "console", args[0]])
+        p.wait()
+
+
 if __name__ == '__main__':
     if _glusterEnabled:
         serv = ge.GlusterService()
@@ -2265,6 +2275,9 @@
                        ('<vmId> <sdUUID> <imgUUID> <baseVolUUID> <volUUID>',
                        "Take a live snapshot"
                       )),
+        'openConsole': (serv.openVmConsole,
+                        ("<vmName>",
+                         "open pty console for vm")),
     }
     if _glusterEnabled:
         commands.update(ge.getGlusterCmdDict(serv))


--
To view, visit http://gerrit.ovirt.org/8041
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I368dbcbc2e180161f256f3fb450c344acb6a6c8a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj at linux.vnet.ibm.com>


More information about the vdsm-patches mailing list