cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthon...@apache.org
Subject git commit: updated refs/heads/4.2 to f399372
Date Sat, 10 Aug 2013 00:22:15 GMT
Updated Branches:
  refs/heads/4.2 4a318a727 -> f39937223


CLOUDSTACK-3495
        CS used to access vnc server in xenserver dom0 to get VM console, now CS moves to
use XenServer console API. getvncport plugin is not needed any more.
        remove the code related to getvncport in XenServer


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f3993722
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f3993722
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f3993722

Branch: refs/heads/4.2
Commit: f39937223310cffde9308b16f26157f2e883d018
Parents: 4a318a7
Author: anthony <anthony@cloud.com>
Authored: Fri Aug 9 17:18:46 2013 -0700
Committer: anthony <anthony@cloud.com>
Committed: Fri Aug 9 17:21:56 2013 -0700

----------------------------------------------------------------------
 .../xen/resource/CitrixResourceBase.java        | 44 +-------------------
 scripts/vm/hypervisor/xenserver/vmops           | 31 +-------------
 scripts/vm/hypervisor/xenserver/xcposs/vmops    | 31 +-------------
 3 files changed, 5 insertions(+), 101 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3993722/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index e100211..deb3c31 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -2477,10 +2477,9 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
         try {
             Set<VM> vms = VM.getByNameLabel(conn, cmd.getName());
             if(vms.size() == 1) {
-                int vncport = getVncPort(conn, vms.iterator().next());
                 String consoleurl;
                 consoleurl = "consoleurl=" +getVncUrl(conn, vms.iterator().next()) + "&"
+"sessionref="+ conn.getSessionReference();
-                return new GetVncPortAnswer(cmd, consoleurl, vncport);
+                return new GetVncPortAnswer(cmd, consoleurl, -1);
             } else {
                 return new GetVncPortAnswer(cmd, "There are " + vms.size() + " VMs named
" + cmd.getName());
             }
@@ -3392,47 +3391,6 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
         return new ReadyAnswer(cmd);
     }
 
-    //
-    // using synchronized on VM name in the caller does not prevent multiple
-    // commands being sent against
-    // the same VM, there will be a race condition here in finally clause and
-    // the main block if
-    // there are multiple requests going on
-    //
-    // Therefore, a lazy solution is to add a synchronized guard here
-    protected int getVncPort(Connection conn, VM vm) {
-        VM.Record record;
-        try {
-            record = vm.getRecord(conn);
-            Set<Console> consoles = record.consoles;
-            if (consoles.isEmpty()) {
-                s_logger.warn("There are no Consoles available to the vm : " + record.nameDescription);
-                return -1;
-            }
-            consoles.iterator();
-        } catch (XenAPIException e) {
-            String msg = "Unable to get vnc-port due to " + e.toString();
-            s_logger.warn(msg, e);
-            return -1;
-        } catch (XmlRpcException e) {
-            String msg = "Unable to get vnc-port due to " + e.getMessage();
-            s_logger.warn(msg, e);
-            return -1;
-        }
-        String hvm = "true";
-        if (record.HVMBootPolicy.isEmpty()) {
-            hvm = "false";
-        }
-
-        String vncport = callHostPlugin(conn, "vmops", "getvncport", "domID", record.domid.toString(),
"hvm", hvm, "version", _host.product_version);
-        if (vncport == null || vncport.isEmpty()) {
-            return -1;
-        }
-
-        vncport = vncport.replace("\n", "");
-        return NumbersUtil.parseInt(vncport, -1);
-    }
-
     protected String getVncUrl(Connection conn, VM vm) {
         VM.Record record;
         Console c;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3993722/scripts/vm/hypervisor/xenserver/vmops
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmops b/scripts/vm/hypervisor/xenserver/vmops
index 928d0af..f53a967 100755
--- a/scripts/vm/hypervisor/xenserver/vmops
+++ b/scripts/vm/hypervisor/xenserver/vmops
@@ -73,34 +73,7 @@ def setup_iscsi(session, args):
        txt = ''
    return txt
  
-@echo
-def getvncport(session, args):
-    domid = args['domID']
-    hvm = args['hvm']
-    version = args['version']
-    if hvm == 'true':
-        path1 = "/local/domain/" + domid + "/qemu-pid"
-        path2 = "/local/domain/" + domid + "/console/vnc-port"
-    else:
-        if version[:3] == '6.0' or version[:3] == '6.1' or version[:3] == '6.2':
-            path1 = "/local/domain/" + domid + "/vncterm-pid"
-            path2 = "/local/domain/" + domid + "/console/vnc-port"
-        else:
-            path1 = "/local/domain/" + domid + "/serial/0/vncterm-pid"
-            path2 = "/local/domain/" + domid + "/serial/0/vnc-port"
-    try:
-        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:
-        return ''
-   
+
 @echo
 def getgateway(session, args):
     mgmt_ip = args['mgmtIP']
@@ -1663,7 +1636,7 @@ def bumpUpPriority(session, args):
 
 if __name__ == "__main__":
      XenAPIPlugin.dispatch({"pingtest": pingtest, "setup_iscsi":setup_iscsi, "gethostvmstats":
gethostvmstats, 
-                            "getvncport": getvncport, "getgateway": getgateway, "preparemigration":
preparemigration, 
+                            "getgateway": getgateway, "preparemigration": preparemigration,

                             "setIptables": setIptables, "pingdomr": pingdomr, "pingxenserver":
pingxenserver,  
                             "savePassword": savePassword, 
                             "saveDhcpEntry": saveDhcpEntry, "setFirewallRule": setFirewallRule,
"routerProxy": routerProxy, 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3993722/scripts/vm/hypervisor/xenserver/xcposs/vmops
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xcposs/vmops b/scripts/vm/hypervisor/xenserver/xcposs/vmops
index 6846e81..c5a9f94 100644
--- a/scripts/vm/hypervisor/xenserver/xcposs/vmops
+++ b/scripts/vm/hypervisor/xenserver/xcposs/vmops
@@ -61,34 +61,7 @@ def setup_iscsi(session, args):
        txt = ''
    return '> DONE <'
  
-@echo
-def getvncport(session, args):
-    domid = args['domID']
-    hvm = args['hvm']
-    version = args['version']
-    if hvm == 'true':
-        path1 = "/local/domain/" + domid + "/qemu-pid"
-        path2 = "/local/domain/" + domid + "/console/vnc-port"
-    else:
-        if version[:3] == '6.0':
-            path1 = "/local/domain/" + domid + "/vncterm-pid"
-            path2 = "/local/domain/" + domid + "/console/vnc-port"
-        else:
-            path1 = "/local/domain/" + domid + "/serial/0/vncterm-pid"
-            path2 = "/local/domain/" + domid + "/serial/0/vnc-port"
-    try:
-        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:
-        return ''
-   
+
 @echo
 def getgateway(session, args):
     mgmt_ip = args['mgmtIP']
@@ -1498,7 +1471,7 @@ def getDomRVersion(session, args):
 
 if __name__ == "__main__":
      XenAPIPlugin.dispatch({"pingtest": pingtest, "setup_iscsi":setup_iscsi, "gethostvmstats":
gethostvmstats, 
-                            "getvncport": getvncport, "getgateway": getgateway, "preparemigration":
preparemigration, 
+                            "getgateway": getgateway, "preparemigration": preparemigration,

                             "setIptables": setIptables, "pingdomr": pingdomr, "pingxenserver":
pingxenserver,  
                             "ipassoc": ipassoc, "savePassword": savePassword, 
                             "saveDhcpEntry": saveDhcpEntry, "setFirewallRule": setFirewallRule,



Mime
View raw message