cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [10/12] git commit: updated refs/heads/4.5 to 4e01d61
Date Tue, 20 Jan 2015 06:20:34 GMT
CLOUDSTACK-7920: NPE in the payload was causing the ssvm agent to not connect, fix it and also
make sure that template/volume sync are robust that exceptions do not cause ssvm agent disconnect
issues.

(cherry picked from commit 5213401ace08f4a5247a325e9d99a4a66bd7df11)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java


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

Branch: refs/heads/4.5
Commit: 1aeaf4dcc9b0c34f6ed98f90dc7d059bf9cf05e2
Parents: 8790b84
Author: Nitin Mehta <nitin.mehta@citrix.com>
Authored: Fri Nov 14 16:19:10 2014 -0800
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Tue Jan 20 11:39:34 2015 +0530

----------------------------------------------------------------------
 .../storage/datastore/db/VolumeDataStoreDao.java    |  2 ++
 .../storage/image/db/VolumeDataStoreDaoImpl.java    | 16 ++++++++++++++++
 .../storage/volume/VolumeServiceImpl.java           |  3 ++-
 .../cloud/storage/download/DownloadListener.java    | 12 ++++++++----
 4 files changed, 28 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1aeaf4dc/engine/schema/src/org/apache/cloudstack/storage/datastore/db/VolumeDataStoreDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/VolumeDataStoreDao.java
b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/VolumeDataStoreDao.java
index 625cc29..a056152 100644
--- a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/VolumeDataStoreDao.java
+++ b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/VolumeDataStoreDao.java
@@ -46,4 +46,6 @@ public interface VolumeDataStoreDao extends GenericDao<VolumeDataStoreVO,
Long>,
     List<VolumeDataStoreVO> listVolumeDownloadUrls();
 
     void expireDnldUrlsForZone(Long dcId);
+
+    List<VolumeDataStoreVO> listUploadedVolumesByStoreId(long id);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1aeaf4dc/engine/storage/src/org/apache/cloudstack/storage/image/db/VolumeDataStoreDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/VolumeDataStoreDaoImpl.java
b/engine/storage/src/org/apache/cloudstack/storage/image/db/VolumeDataStoreDaoImpl.java
index 2e29ad7..b71eb2c 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/db/VolumeDataStoreDaoImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/VolumeDataStoreDaoImpl.java
@@ -52,6 +52,7 @@ public class VolumeDataStoreDaoImpl extends GenericDaoBase<VolumeDataStoreVO,
Lo
     private SearchBuilder<VolumeDataStoreVO> cacheSearch;
     private SearchBuilder<VolumeDataStoreVO> storeVolumeSearch;
     private SearchBuilder<VolumeDataStoreVO> downloadVolumeSearch;
+    private SearchBuilder<VolumeDataStoreVO> uploadVolumeSearch;
     private static final String EXPIRE_DOWNLOAD_URLS_FOR_ZONE = "update volume_store_ref
set download_url_created=? where store_id in (select id from image_store where data_center_id=?)";
 
 
@@ -95,6 +96,12 @@ public class VolumeDataStoreDaoImpl extends GenericDaoBase<VolumeDataStoreVO,
Lo
         downloadVolumeSearch.and("destroyed", downloadVolumeSearch.entity().getDestroyed(),
SearchCriteria.Op.EQ);
         downloadVolumeSearch.done();
 
+        uploadVolumeSearch = createSearchBuilder();
+        uploadVolumeSearch.and("store_id", uploadVolumeSearch.entity().getDataStoreId(),
SearchCriteria.Op.EQ);
+        uploadVolumeSearch.and("url", uploadVolumeSearch.entity().getDownloadUrl(), Op.NNULL);
+        uploadVolumeSearch.and("destroyed", uploadVolumeSearch.entity().getDestroyed(), SearchCriteria.Op.EQ);
+        uploadVolumeSearch.done();
+
         return true;
     }
 
@@ -272,6 +279,15 @@ public class VolumeDataStoreDaoImpl extends GenericDaoBase<VolumeDataStoreVO,
Lo
     }
 
     @Override
+    public List<VolumeDataStoreVO> listUploadedVolumesByStoreId(long id) {
+        SearchCriteria<VolumeDataStoreVO> sc = uploadVolumeSearch.create();
+        sc.setParameters("store_id", id);
+        sc.setParameters("destroyed", false);
+        return listIncludingRemovedBy(sc);
+    }
+
+
+    @Override
     public void expireDnldUrlsForZone(Long dcId){
         TransactionLegacy txn = TransactionLegacy.currentTxn();
         PreparedStatement pstmt = null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1aeaf4dc/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index 6a66ea3..88f098c 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -26,6 +26,7 @@ import java.util.Map;
 
 import javax.inject.Inject;
 
+import com.cloud.storage.RegisterVolumePayload;
 import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity;
 import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
@@ -1382,7 +1383,7 @@ public class VolumeServiceImpl implements VolumeService {
                         return;
                     }
 
-                    List<VolumeDataStoreVO> dbVolumes = _volumeStoreDao.listByStoreId(storeId);
+                    List<VolumeDataStoreVO> dbVolumes = _volumeStoreDao.listUploadedVolumesByStoreId(storeId);
                     List<VolumeDataStoreVO> toBeDownloaded = new ArrayList<VolumeDataStoreVO>(dbVolumes);
                     for (VolumeDataStoreVO volumeStore : dbVolumes) {
                         VolumeVO volume = volDao.findById(volumeStore.getVolumeId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1aeaf4dc/server/src/com/cloud/storage/download/DownloadListener.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/download/DownloadListener.java b/server/src/com/cloud/storage/download/DownloadListener.java
index 4f9a560..814ce3c 100755
--- a/server/src/com/cloud/storage/download/DownloadListener.java
+++ b/server/src/com/cloud/storage/download/DownloadListener.java
@@ -298,10 +298,14 @@ public class DownloadListener implements Listener {
             }
         }*/
         else if (cmd instanceof StartupSecondaryStorageCommand) {
-            List<DataStore> imageStores = _storeMgr.getImageStoresByScope(new ZoneScope(agent.getDataCenterId()));
-            for (DataStore store : imageStores) {
-                _volumeSrv.handleVolumeSync(store);
-                _imageSrv.handleTemplateSync(store);
+            try{
+                List<DataStore> imageStores = _storeMgr.getImageStoresByScope(new ZoneScope(agent.getDataCenterId()));
+                for (DataStore store : imageStores) {
+                    _volumeSrv.handleVolumeSync(store);
+                    _imageSrv.handleTemplateSync(store);
+                }
+            }catch (Exception e){
+                s_logger.error("Caught exception while doing template/volume sync ", e);
             }
         }
     }


Mime
View raw message