You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sa...@apache.org on 2014/02/25 06:13:25 UTC

[19/19] git commit: updated refs/heads/xenserverJAVA to 4e0c1bb

CLOUDSTACK-6058: XenServer 6.2sp1 xenapi customization as per CloudStack resource code.


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

Branch: refs/heads/xenserverJAVA
Commit: 4e0c1bb4e1c4711ed40737fc20fafe6126de733b
Parents: f501ec6
Author: Sanjay Tripathi <sa...@citrix.com>
Authored: Wed Jan 22 16:25:30 2014 +0530
Committer: Sanjay Tripathi <sa...@citrix.com>
Committed: Mon Feb 24 22:28:32 2014 +0530

----------------------------------------------------------------------
 .../src/com/xensource/xenapi/Connection.java    | 12 +++++++----
 .../src/com/xensource/xenapi/Event.java         | 15 ++++++++++++++
 .../src/com/xensource/xenapi/VDI.java           | 21 ++++++++++++++++++++
 3 files changed, 44 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e0c1bb4/deps/XenServerJava/src/com/xensource/xenapi/Connection.java
----------------------------------------------------------------------
diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Connection.java b/deps/XenServerJava/src/com/xensource/xenapi/Connection.java
index 63469df..661724f 100755
--- a/deps/XenServerJava/src/com/xensource/xenapi/Connection.java
+++ b/deps/XenServerJava/src/com/xensource/xenapi/Connection.java
@@ -58,6 +58,8 @@ public class Connection
     
     private APIVersion apiVersion;
 
+    protected int _wait = 600;
+
     /**
      * Updated when Session.login_with_password() is called.
      */
@@ -142,10 +144,10 @@ public class Connection
      * When this constructor is used, a call to dispose() will do nothing. The programmer is responsible for manually
      * logging out the Session.
      */
-    public Connection(URL url)
+    public Connection(URL url, int wait)
     {
         deprecatedConstructorUsed = false;
-
+        _wait = wait;
         this.client = getClientFromURL(url);
     }
 
@@ -257,6 +259,8 @@ public class Connection
     {
         config.setTimeZone(TimeZone.getTimeZone("UTC"));
         config.setServerURL(url);
+        config.setReplyTimeout(_wait * 1000);
+        config.setConnectionTimeout(5000);
         XmlRpcClient client = new XmlRpcClient();
         client.setConfig(config);
         return client;
@@ -276,7 +280,7 @@ public class Connection
     /**
      * The (auto-generated parts of) the bindings dispatch XMLRPC calls on this Connection's client through this method.
      */
-    Map dispatch(String method_call, Object[] method_params) throws XmlRpcException, XenAPIException
+    protected Map dispatch(String method_call, Object[] method_params) throws XmlRpcException, XenAPIException
     {
         Map response = (Map) client.execute(method_call, method_params);
 
@@ -320,7 +324,7 @@ public class Connection
                                 new Connection(new URL(client_url.getProtocol(),
                                                        (String)error[1],
                                                        client_url.getPort(),
-                                                       client_url.getFile()));
+                                                       client_url.getFile()), _wait);
                             tmp_conn.sessionReference = sessionReference;
                             try
                             {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e0c1bb4/deps/XenServerJava/src/com/xensource/xenapi/Event.java
----------------------------------------------------------------------
diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Event.java b/deps/XenServerJava/src/com/xensource/xenapi/Event.java
index 3014ba0..27db4a5 100644
--- a/deps/XenServerJava/src/com/xensource/xenapi/Event.java
+++ b/deps/XenServerJava/src/com/xensource/xenapi/Event.java
@@ -301,4 +301,19 @@ public class Event extends XenAPIObject {
             return Types.toString(result);
     }
 
+    public static Map properFrom(Connection c, Set<String> classes, String token, Double timeout) throws BadServerResponse, XenAPIException, XmlRpcException,
+       Types.SessionNotRegistered,
+       Types.EventsLost {
+        String method_call = "event.from";
+        String session = c.getSessionReference();
+        Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(classes), Marshalling.toXMLRPC(token), Marshalling.toXMLRPC(timeout)};
+        Map response = c.dispatch(method_call, method_params);
+        Object result = response.get("Value");
+        Map value = (Map)result;
+        Map<String, Object> from = new HashMap<String, Object>();
+        from.put("token", value.get("token"));
+        from.put("events", Types.toSetOfEventRecord(value.get("events")));
+        return from;
+    }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e0c1bb4/deps/XenServerJava/src/com/xensource/xenapi/VDI.java
----------------------------------------------------------------------
diff --git a/deps/XenServerJava/src/com/xensource/xenapi/VDI.java b/deps/XenServerJava/src/com/xensource/xenapi/VDI.java
index cf8d3ec..1431ce0 100644
--- a/deps/XenServerJava/src/com/xensource/xenapi/VDI.java
+++ b/deps/XenServerJava/src/com/xensource/xenapi/VDI.java
@@ -1470,6 +1470,27 @@ public class VDI extends XenAPIObject {
     }
 
     /**
+     * Copy either a full VDI or the block differences between two VDIs into either a fresh VDI or an existing VDI.
+     *
+     * @param sr The destination SR (only required if the destination VDI is not specified
+     * @param baseVdi The base VDI (only required if copying only changed blocks, by default all blocks will be copied)
+     * @param intoVdi The destination VDI to copy blocks into (if omitted then a destination SR must be provided and a fresh VDI will be created)
+     * @return Task
+     */
+    public Task copyAsync2(Connection c, SR sr, VDI baseVdi, VDI intoVdi) throws
+            BadServerResponse,
+            XenAPIException,
+            XmlRpcException,
+            Types.VdiReadonly {
+        String method_call = "Async.VDI.copy";
+        String session = c.getSessionReference();
+        Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sr), Marshalling.toXMLRPC(baseVdi), Marshalling.toXMLRPC(intoVdi)};
+        Map response = c.dispatch(method_call, method_params);
+        Object result = response.get("Value");
+        return Types.toTask(result);
+    }
+
+    /**
      * Make a fresh VDI in the specified SR and copy the supplied VDI's data to the new disk
      *
      * @param sr The destination SR