cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raf...@apache.org
Subject [03/11] git commit: updated refs/heads/master to d705d85
Date Wed, 24 Feb 2016 20:24:34 GMT
CLOUDSTACK-9252: Add nfs version to commands


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

Branch: refs/heads/master
Commit: 0bc1b2727ae80f60518d091410f7538a67161233
Parents: 476e9f0
Author: nvazquez <nicolas.m.vazquez@gmail.com>
Authored: Fri Jan 22 16:39:47 2016 -0200
Committer: nvazquez <nicolas.m.vazquez@gmail.com>
Committed: Mon Feb 1 12:50:58 2016 -0800

----------------------------------------------------------------------
 .../com/cloud/agent/api/GetStorageStatsCommand.java | 14 ++++++++++++++
 .../com/cloud/agent/api/SecStorageSetupCommand.java |  9 +++++++++
 .../agent/api/storage/ListTemplateCommand.java      | 10 ++++++++++
 .../storage/image/TemplateServiceImpl.java          | 16 +++++++++++++++-
 .../SecondaryStorageManagerImpl.java                | 16 ++++++++++++++++
 5 files changed, 64 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0bc1b272/core/src/com/cloud/agent/api/GetStorageStatsCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/GetStorageStatsCommand.java b/core/src/com/cloud/agent/api/GetStorageStatsCommand.java
index 23e8f9e..84b5426 100644
--- a/core/src/com/cloud/agent/api/GetStorageStatsCommand.java
+++ b/core/src/com/cloud/agent/api/GetStorageStatsCommand.java
@@ -30,6 +30,7 @@ public class GetStorageStatsCommand extends Command {
     private StoragePoolType pooltype;
     private String secUrl;
     private DataStoreTO store;
+    private String nfsVersion;
 
     public String getSecUrl() {
         return secUrl;
@@ -54,6 +55,11 @@ public class GetStorageStatsCommand extends Command {
         this.store = store;
     }
 
+    public GetStorageStatsCommand(DataStoreTO store, String nfsVersion) {
+        this.store = store;
+        this.nfsVersion = nfsVersion;
+    }
+
     public GetStorageStatsCommand(String secUrl) {
         this.secUrl = secUrl;
     }
@@ -81,6 +87,14 @@ public class GetStorageStatsCommand extends Command {
         return this.store;
     }
 
+    public String getNfsVersion() {
+        return nfsVersion;
+    }
+
+    public void setNfsVersion(String nfsVersion) {
+        this.nfsVersion = nfsVersion;
+    }
+
     @Override
     public boolean executeInSequence() {
         return false;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0bc1b272/core/src/com/cloud/agent/api/SecStorageSetupCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SecStorageSetupCommand.java b/core/src/com/cloud/agent/api/SecStorageSetupCommand.java
index 28e55c2..316e469 100644
--- a/core/src/com/cloud/agent/api/SecStorageSetupCommand.java
+++ b/core/src/com/cloud/agent/api/SecStorageSetupCommand.java
@@ -28,6 +28,7 @@ public class SecStorageSetupCommand extends Command {
     private String secUrl;
     private KeystoreManager.Certificates certs;
     private String postUploadKey;
+    private String nfsVersion;
 
 
     public SecStorageSetupCommand() {
@@ -74,4 +75,12 @@ public class SecStorageSetupCommand extends Command {
     public void setPostUploadKey(String postUploadKey) {
         this.postUploadKey = postUploadKey;
     }
+
+    public String getNfsVersion() {
+        return nfsVersion;
+    }
+
+    public void setNfsVersion(String nfsVersion) {
+        this.nfsVersion = nfsVersion;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0bc1b272/core/src/com/cloud/agent/api/storage/ListTemplateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ListTemplateCommand.java b/core/src/com/cloud/agent/api/storage/ListTemplateCommand.java
index 8550952..bacc83a 100644
--- a/core/src/com/cloud/agent/api/storage/ListTemplateCommand.java
+++ b/core/src/com/cloud/agent/api/storage/ListTemplateCommand.java
@@ -23,6 +23,7 @@ import com.cloud.agent.api.to.DataStoreTO;
 
 public class ListTemplateCommand extends StorageCommand {
     private DataStoreTO store;
+    private String nfsVersion;
 
     //private String secUrl;
 
@@ -34,6 +35,11 @@ public class ListTemplateCommand extends StorageCommand {
 //        this.secUrl = url;
     }
 
+    public ListTemplateCommand(DataStoreTO store, String nfsVersion) {
+        this.store = store;
+        this.nfsVersion = nfsVersion;
+    }
+
     @Override
     public boolean executeInSequence() {
         return true;
@@ -43,6 +49,10 @@ public class ListTemplateCommand extends StorageCommand {
         return store;
     }
 
+    public String getNfsVersion() {
+        return nfsVersion;
+    }
+
     //   public String getSecUrl() {
     //       return secUrl;
     //   }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0bc1b272/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
index 9ab3595..cbfcb42 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
@@ -56,6 +56,7 @@ import org.apache.cloudstack.storage.command.CommandResult;
 import org.apache.cloudstack.storage.command.DeleteCommand;
 import org.apache.cloudstack.storage.datastore.DataObjectManager;
 import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager;
+import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao;
 import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
 import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity;
@@ -135,6 +136,8 @@ public class TemplateServiceImpl implements TemplateService {
     ConfigurationDao _configDao;
     @Inject
     StorageCacheManager _cacheMgr;
+    @Inject
+    ImageStoreDetailsDao _imageStoreDetailsDao;
 
     class TemplateOpContext<T> extends AsyncRpcContext<T> {
         final TemplateObject template;
@@ -564,7 +567,7 @@ public class TemplateServiceImpl implements TemplateService {
     }
 
     private Map<String, TemplateProp> listTemplate(DataStore ssStore) {
-        ListTemplateCommand cmd = new ListTemplateCommand(ssStore.getTO());
+        ListTemplateCommand cmd = new ListTemplateCommand(ssStore.getTO(), getNfsVersion(ssStore.getId()));
         EndPoint ep = _epSelector.select(ssStore);
         Answer answer = null;
         if (ep == null) {
@@ -586,6 +589,17 @@ public class TemplateServiceImpl implements TemplateService {
         return null;
     }
 
+    private String getNfsVersion(long storeId) {
+        String nfsVersion = null;
+        if (_imageStoreDetailsDao.getDetails(storeId) != null){
+            Map<String, String> storeDetails = _imageStoreDetailsDao.getDetails(storeId);
+            if (storeDetails != null && storeDetails.containsKey("nfs.version")){
+                nfsVersion = storeDetails.get("nfs.version");
+            }
+        }
+        return nfsVersion;
+    }
+
     protected Void createTemplateCallback(AsyncCallbackDispatcher<TemplateServiceImpl,
CreateCmdResult> callback, TemplateOpContext<TemplateApiResult> context) {
         TemplateObject template = context.getTemplate();
         AsyncCompletionCallback<TemplateApiResult> parentCallback = context.getParentCallback();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0bc1b272/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
index 4891b71..1ae5d5b 100644
--- a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
+++ b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
@@ -39,6 +39,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.framework.security.keystore.KeystoreManager;
 import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
+import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao;
 import org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
 import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
@@ -236,6 +237,8 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements
Secondar
     @Inject
     ImageStoreDao _imageStoreDao;
     @Inject
+    ImageStoreDetailsDao _imageStoreDetailsDao;
+    @Inject
     TemplateDataStoreDao _tmplStoreDao;
     @Inject
     VolumeDataStoreDao _volumeStoreDao;
@@ -310,6 +313,8 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements
Secondar
                     setupCmd = new SecStorageSetupCommand(ssStore.getTO(), secUrl, certs);
                 }
 
+                setupCmd.setNfsVersion(getNfsVersion(ssStore.getId()));
+
                 //template/volume file upload key
                 String postUploadKey = _configDao.getValue(Config.SSVMPSK.key());
                 setupCmd.setPostUploadKey(postUploadKey);
@@ -358,6 +363,17 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements
Secondar
         return true;
     }
 
+    private String getNfsVersion(long storeId) {
+        String nfsVersion = null;
+        if (_imageStoreDetailsDao.getDetails(storeId) != null){
+            Map<String, String> storeDetails = _imageStoreDetailsDao.getDetails(storeId);
+            if (storeDetails != null && storeDetails.containsKey("nfs.version")){
+                nfsVersion = storeDetails.get("nfs.version");
+            }
+        }
+        return nfsVersion;
+    }
+
     @Override
     public boolean generateVMSetupCommand(Long ssAHostId) {
         HostVO ssAHost = _hostDao.findById(ssAHostId);


Mime
View raw message