You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2013/12/05 22:53:19 UTC

git commit: updated refs/heads/4.2-workplace to 305cfb0

Updated Branches:
  refs/heads/4.2-workplace 65974e635 -> 305cfb0f3


update to new copyAsync signature


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

Branch: refs/heads/4.2-workplace
Commit: 305cfb0f3c87d5ad86afddbeaf823df6e44c1231
Parents: 65974e6
Author: edison su <su...@gmail.com>
Authored: Thu Dec 5 13:52:14 2013 -0800
Committer: edison su <su...@gmail.com>
Committed: Thu Dec 5 13:53:01 2013 -0800

----------------------------------------------------------------------
 .../src/com/xensource/xenapi/Types.java         | 50 ++++++++++++++++++++
 .../src/com/xensource/xenapi/VDI.java           | 19 +++++---
 .../xen/resource/CitrixResourceBase.java        |  2 +-
 .../xen/resource/XenServerStorageProcessor.java |  7 ++-
 4 files changed, 66 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/305cfb0f/deps/XenServerJava/src/com/xensource/xenapi/Types.java
----------------------------------------------------------------------
diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Types.java b/deps/XenServerJava/src/com/xensource/xenapi/Types.java
index bde887a..36e38c1 100644
--- a/deps/XenServerJava/src/com/xensource/xenapi/Types.java
+++ b/deps/XenServerJava/src/com/xensource/xenapi/Types.java
@@ -1278,6 +1278,17 @@ public class Types
                 String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : "";
                 throw new Types.CrlNameInvalid(p1);
             }
+            if (ErrorDescription[0].equals("VDI_NOT_SPARSE"))
+            {
+                String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : "";
+                throw new Types.VdiNotSparse(p1);
+            }
+            if (ErrorDescription[0].equals("VDI_TOO_SMALL"))
+            {
+                String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : "";
+                String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : "";
+                throw new Types.VdiTooSmall(p1, p2);
+            }
             if (ErrorDescription[0].equals("HOST_POWER_ON_MODE_DISABLED"))
             {
                 throw new Types.HostPowerOnModeDisabled();
@@ -7574,6 +7585,45 @@ public class Types
     }
 
     /**
+     * The VDI is too small. Please resize it to at least the minimum size.
+     */
+    public static class VdiTooSmall extends XenAPIException {
+        public final String vdi;
+        public final String minimumSize;
+
+        /**
+         * Create a new VdiTooSmall
+         *
+         * @param vdi
+         * @param minimumSize
+         */
+        public VdiTooSmall(String vdi, String minimumSize) {
+            super("The VDI is too small. Please resize it to at least the minimum size.");
+            this.vdi = vdi;
+            this.minimumSize = minimumSize;
+        }
+
+    }
+
+    /**
+     * The VDI is not stored using a sparse format. It is not possible to query and manipulate only the changed blocks (or 'block differences' or 'disk deltas') between two VDIs. Please select a VDI which uses a sparse-aware technology such as VHD.
+     */
+    public static class VdiNotSparse extends XenAPIException {
+        public final String vdi;
+
+        /**
+         * Create a new VdiNotSparse
+         *
+         * @param vdi
+         */
+        public VdiNotSparse(String vdi) {
+            super("The VDI is not stored using a sparse format. It is not possible to query and manipulate only the changed blocks (or 'block differences' or 'disk deltas') between two VDIs. Please select a VDI which uses a sparse-aware technology such as VHD.");
+            this.vdi = vdi;
+        }
+
+    }
+
+    /**
      * The hosts in this pool are not homogeneous.
      */
     public static class HostsNotHomogeneous extends XenAPIException {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/305cfb0f/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 5f7b050..068be2f 100644
--- a/deps/XenServerJava/src/com/xensource/xenapi/VDI.java
+++ b/deps/XenServerJava/src/com/xensource/xenapi/VDI.java
@@ -1597,18 +1597,23 @@ public class VDI extends XenAPIObject {
     }
 
     /**
-     * Make a fresh VDI in the specified SR and copy the supplied VDI's data to the new disk
+     * 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
+     * @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 copyAsync(Connection c, SR sr) throws
-       BadServerResponse,
-       XenAPIException,
-       XmlRpcException {
+    public Task copyAsync(Connection c, SR sr, VDI baseVdi, VDI intoVdi) throws
+            BadServerResponse,
+            XenAPIException,
+            XmlRpcException,
+            Types.VdiReadonly,
+            Types.VdiTooSmall,
+            Types.VdiNotSparse {
         String method_call = "Async.VDI.copy";
         String session = c.getSessionReference();
-        Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(ref), Marshalling.toXMLRPC(sr)};
+        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);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/305cfb0f/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 607aff5..889c0e5 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
@@ -3798,7 +3798,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             wait = 2 * 60 * 60;
         }
         try {
-            task = vdi.copyAsync(conn, sr);
+            //task = vdi.copyAsync(conn, sr);
             // poll every 1 seconds , timeout after 2 hours
             waitForTask(conn, task, 1000, wait * 1000);
             checkForSuccess(conn, task);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/305cfb0f/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
index 69a13ed..f51d280 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
@@ -1133,12 +1133,11 @@ public class XenServerStorageProcessor implements StorageProcessor {
             }
             VDI dvdi = null;
             try {
-                Map<String,Object> params = new HashMap<String, Object>();
+                VDI previousSnapshotVdi = null;
                 if (prevSnapshotUuid != null) {
-                    VDI previousSnapshotVdi = VDI.getByUuid(conn,prevSnapshotUuid);
-                    params.put("base-vdi",  previousSnapshotVdi);
+                    previousSnapshotVdi = VDI.getByUuid(conn,prevSnapshotUuid);
                 }
-                task = snapshotvdi.copyV2Async(conn, ssSR, params);
+                task = snapshotvdi.copyAsync(conn, ssSR, previousSnapshotVdi, null);
                 // poll every 1 seconds ,
                 hypervisorResource.waitForTask(conn, task, 1000, wait * 1000);
                 hypervisorResource.checkForSuccess(conn, task);