From 054f6b019989a53c9f593200f5658d03bac69bd2 Mon Sep 17 00:00:00 2001 From: anthony Date: Fri, 15 Apr 2011 12:42:32 -0700 Subject: [PATCH] bug 9472: when get vnc port for a vm, check if the port is really used by this vm for security status 9472: resolved fixed --- scripts/vm/hypervisor/xenserver/vmops | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/scripts/vm/hypervisor/xenserver/vmops b/scripts/vm/hypervisor/xenserver/vmops index 32cd3a01c09..39cdfc3daab 100755 --- a/scripts/vm/hypervisor/xenserver/vmops +++ b/scripts/vm/hypervisor/xenserver/vmops @@ -46,15 +46,23 @@ def getvncport(session, args): domid = args['domID'] hvm = args['hvm'] if hvm == 'true': - path = "/local/domain/" + domid + "/console/vnc-port" + path1 = "/local/domain/" + domid + "/qemu-pid" + path2 = "/local/domain/" + domid + "/console/vnc-port" else: - path = "/local/domain/" + domid + "/serial/0/vnc-port" + path1 = "/local/domain/" + domid + "/serial/0/vncterm-pid" + path2 = "/local/domain/" + domid + "/serial/0/vnc-port" try: - cmd = ["xenstore-read", path] - txt = util.pread2(cmd) + cmd = ["xenstore-read", path1] + pid = util.pread2(cmd) + pid = pid.strip() + cmd = ["ps", pid] + util.pread2(cmd) + cmd = ["xenstore-read", path2] + vncport = util.pread2(cmd) + vncport = vncport.strip() + return vncport except: - txt = '' - return txt + return '' @echo def getgateway(session, args):