cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ni...@apache.org
Subject git commit: updated refs/heads/master to 5213401
Date Sat, 15 Nov 2014 00:19:27 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 39a671dfd -> 5213401ac


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.


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

Branch: refs/heads/master
Commit: 5213401ace08f4a5247a325e9d99a4a66bd7df11
Parents: 39a671d
Author: Nitin Mehta <nitin.mehta@citrix.com>
Authored: Fri Nov 14 16:19:10 2014 -0800
Committer: Nitin Mehta <nitin.mehta@citrix.com>
Committed: Fri Nov 14 16:19:10 2014 -0800

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5213401a/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/5213401a/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/5213401a/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 174874a..edb50b2 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;
@@ -1370,7 +1371,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 = _volumeDao.findById(volumeStore.getVolumeId());
@@ -1467,6 +1468,8 @@ public class VolumeServiceImpl implements VolumeService {
                             s_logger.debug("Volume " + volumeHost.getVolumeId() + " needs
to be downloaded to " + store.getName());
                             // TODO: pass a callback later
                             VolumeInfo vol = volFactory.getVolume(volumeHost.getVolumeId());
+                            RegisterVolumePayload payload = new RegisterVolumePayload(volumeHost.getDownloadUrl(),
volumeHost.getChecksum(), vol.getFormat().toString());
+                            vol.addPayload(payload);
                             createVolumeAsync(vol, store);
                         }
                     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5213401a/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