cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [1/2] git commit: updated refs/heads/4.3 to f7e0a54
Date Thu, 09 Jan 2014 00:27:33 GMT
Updated Branches:
  refs/heads/4.3 4aad42e82 -> f7e0a540d


CLOUDSTACK-5831: return quiescevm field in volumeresponse


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

Branch: refs/heads/4.3
Commit: 086475647c66e3d7db88eed7ec9712136911e73f
Parents: d1c0aa1
Author: edison <sudison@gmail.com>
Authored: Wed Jan 8 16:04:21 2014 -0800
Committer: edison <sudison@gmail.com>
Committed: Wed Jan 8 16:04:21 2014 -0800

----------------------------------------------------------------------
 .../cloudstack/api/response/VolumeResponse.java | 17 +++++++++++++++
 .../com/cloud/api/query/QueryManagerImpl.java   | 23 ++++++++++++++++----
 2 files changed, 36 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/08647564/api/src/org/apache/cloudstack/api/response/VolumeResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/VolumeResponse.java b/api/src/org/apache/cloudstack/api/response/VolumeResponse.java
index 56c007f..ec33ff8 100644
--- a/api/src/org/apache/cloudstack/api/response/VolumeResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/VolumeResponse.java
@@ -193,6 +193,10 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
     @Param(description = "id of the primary storage hosting the disk volume; returned to
admin user only", since="4.3")
     private String storagePoolId;
 
+    @SerializedName(ApiConstants.SNAPSHOT_QUIESCEVM)
+    @Param(description = "need quiesce vm or not when taking snapshot", since="4.3")
+    private boolean needQuiescevm;
+
     public String getPath() {
         return path;
     }
@@ -408,4 +412,17 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
     public void setStoragePoolId(String storagePoolId) {
         this.storagePoolId = storagePoolId;
     }
+
+    public String getStoragePoolId() {
+        return storagePoolId;
+    }
+
+    public void setNeedQuiescevm(boolean quiescevm) {
+        this.needQuiescevm = quiescevm;
+    }
+
+    public boolean isNeedQuiescevm() {
+        return this.needQuiescevm;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/08647564/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index fe77d05..3d908b4 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -26,6 +26,7 @@ import java.util.Set;
 import javax.ejb.Local;
 import javax.inject.Inject;
 
+import org.apache.cloudstack.engine.subsystem.api.storage.*;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
@@ -84,10 +85,6 @@ import org.apache.cloudstack.api.response.UserVmResponse;
 import org.apache.cloudstack.api.response.VolumeResponse;
 import org.apache.cloudstack.api.response.ZoneResponse;
 import org.apache.cloudstack.context.CallContext;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.query.QueryService;
 
@@ -1645,6 +1642,24 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
 
         List<VolumeResponse> volumeResponses = ViewResponseHelper.createVolumeResponse(result.first().toArray(
                 new VolumeJoinVO[result.first().size()]));
+        for(VolumeResponse vr : volumeResponses) {
+            String poolId = vr.getStoragePoolId();
+            DataStore store = dataStoreManager.getPrimaryDataStore(poolId);
+            if (store == null) {
+                continue;
+            }
+
+            DataStoreDriver driver = store.getDriver();
+            if (driver == null) {
+                continue;
+            }
+
+            Map<String, String> caps = driver.getCapabilities();
+            if (caps != null) {
+                boolean quiescevm = Boolean.parseBoolean(caps.get(DataStoreCapabilities.VOLUME_SNAPSHOT_QUIESCEVM.toString()));
+                vr.setNeedQuiescevm(quiescevm);
+            }
+        }
         response.setResponses(volumeResponses, result.second());
         return response;
     }


Mime
View raw message