cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [6/6] git commit: updated refs/heads/object_store to 8a514ea
Date Wed, 08 May 2013 00:45:28 GMT
Fix a bug in updating template_store_ref entry.


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

Branch: refs/heads/object_store
Commit: 70f866156ffda99d5e769219bfaa46734842fcd7
Parents: e8c6963
Author: Min Chen <min.chen@citrix.com>
Authored: Tue May 7 16:45:37 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Tue May 7 17:45:06 2013 -0700

----------------------------------------------------------------------
 .../driver/CloudStackImageStoreDriverImpl.java     |   25 ++++++++------
 .../datastore/driver/S3ImageStoreDriverImpl.java   |   25 ++++++++------
 .../driver/SwiftImageStoreDriverImpl.java          |   25 ++++++++------
 3 files changed, 42 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/70f86615/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
index c30d8a6..45c6b8b 100644
--- a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
+++ b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
@@ -175,17 +175,20 @@ public class CloudStackImageStoreDriverImpl implements ImageStoreDriver
{
     	DataObject obj = context.data;
     	DataStore store = obj.getDataStore();
 
-    	TemplateDataStoreVO updateBuilder = _templateStoreDao.createForUpdate();
-    	updateBuilder.setDownloadPercent(answer.getDownloadPct());
-    	updateBuilder.setDownloadState(answer.getDownloadStatus());
-    	updateBuilder.setLastUpdated(new Date());
-    	updateBuilder.setErrorString(answer.getErrorString());
-    	updateBuilder.setJobId(answer.getJobId());
-    	updateBuilder.setLocalDownloadPath(answer.getDownloadPath());
-    	updateBuilder.setInstallPath(answer.getInstallPath());
-    	updateBuilder.setSize(answer.getTemplateSize());
-    	updateBuilder.setPhysicalSize(answer.getTemplatePhySicalSize());
-    	_templateStoreDao.update(store.getId(), updateBuilder);
+    	TemplateDataStoreVO tmpltStoreVO = _templateStoreDao.findByStoreTemplate(store.getId(),obj.getId());
+        if (tmpltStoreVO != null) {
+            TemplateDataStoreVO updateBuilder = _templateStoreDao.createForUpdate();
+            updateBuilder.setDownloadPercent(answer.getDownloadPct());
+            updateBuilder.setDownloadState(answer.getDownloadStatus());
+            updateBuilder.setLastUpdated(new Date());
+            updateBuilder.setErrorString(answer.getErrorString());
+            updateBuilder.setJobId(answer.getJobId());
+            updateBuilder.setLocalDownloadPath(answer.getDownloadPath());
+            updateBuilder.setInstallPath(answer.getInstallPath());
+            updateBuilder.setSize(answer.getTemplateSize());
+            updateBuilder.setPhysicalSize(answer.getTemplatePhySicalSize());
+            _templateStoreDao.update(tmpltStoreVO.getId(), updateBuilder);
+        }
 
     	AsyncCompletionCallback<CreateCmdResult> caller = context.getParentCallback();
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/70f86615/plugins/storage/image/s3/src/org/apache/cloudstack/storage/datastore/driver/S3ImageStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/s3/src/org/apache/cloudstack/storage/datastore/driver/S3ImageStoreDriverImpl.java
b/plugins/storage/image/s3/src/org/apache/cloudstack/storage/datastore/driver/S3ImageStoreDriverImpl.java
index b64f934..acff2be 100644
--- a/plugins/storage/image/s3/src/org/apache/cloudstack/storage/datastore/driver/S3ImageStoreDriverImpl.java
+++ b/plugins/storage/image/s3/src/org/apache/cloudstack/storage/datastore/driver/S3ImageStoreDriverImpl.java
@@ -225,17 +225,20 @@ public class S3ImageStoreDriverImpl implements ImageStoreDriver {
         DataObject obj = context.data;
         DataStore store = obj.getDataStore();
 
-        TemplateDataStoreVO updateBuilder = _templateStoreDao.createForUpdate();
-        updateBuilder.setDownloadPercent(answer.getDownloadPct());
-        updateBuilder.setDownloadState(answer.getDownloadStatus());
-        updateBuilder.setLastUpdated(new Date());
-        updateBuilder.setErrorString(answer.getErrorString());
-        updateBuilder.setJobId(answer.getJobId());
-        updateBuilder.setLocalDownloadPath(answer.getDownloadPath());
-        updateBuilder.setInstallPath(answer.getInstallPath());
-        updateBuilder.setSize(answer.getTemplateSize());
-        updateBuilder.setPhysicalSize(answer.getTemplatePhySicalSize());
-        _templateStoreDao.update(store.getId(), updateBuilder);
+        TemplateDataStoreVO tmpltStoreVO = _templateStoreDao.findByStoreTemplate(store.getId(),obj.getId());
+        if (tmpltStoreVO != null) {
+            TemplateDataStoreVO updateBuilder = _templateStoreDao.createForUpdate();
+            updateBuilder.setDownloadPercent(answer.getDownloadPct());
+            updateBuilder.setDownloadState(answer.getDownloadStatus());
+            updateBuilder.setLastUpdated(new Date());
+            updateBuilder.setErrorString(answer.getErrorString());
+            updateBuilder.setJobId(answer.getJobId());
+            updateBuilder.setLocalDownloadPath(answer.getDownloadPath());
+            updateBuilder.setInstallPath(answer.getInstallPath());
+            updateBuilder.setSize(answer.getTemplateSize());
+            updateBuilder.setPhysicalSize(answer.getTemplatePhySicalSize());
+            _templateStoreDao.update(tmpltStoreVO.getId(), updateBuilder);
+        }
 
         AsyncCompletionCallback<CreateCmdResult> caller = context.getParentCallback();
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/70f86615/plugins/storage/image/swift/src/org/apache/cloudstack/storage/datastore/driver/SwiftImageStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/swift/src/org/apache/cloudstack/storage/datastore/driver/SwiftImageStoreDriverImpl.java
b/plugins/storage/image/swift/src/org/apache/cloudstack/storage/datastore/driver/SwiftImageStoreDriverImpl.java
index 8446eeb..a8fb3b2 100644
--- a/plugins/storage/image/swift/src/org/apache/cloudstack/storage/datastore/driver/SwiftImageStoreDriverImpl.java
+++ b/plugins/storage/image/swift/src/org/apache/cloudstack/storage/datastore/driver/SwiftImageStoreDriverImpl.java
@@ -178,17 +178,20 @@ public class SwiftImageStoreDriverImpl implements ImageStoreDriver {
         DataObject obj = context.data;
         DataStore store = obj.getDataStore();
 
-        TemplateDataStoreVO updateBuilder = _templateStoreDao.createForUpdate();
-        updateBuilder.setDownloadPercent(answer.getDownloadPct());
-        updateBuilder.setDownloadState(answer.getDownloadStatus());
-        updateBuilder.setLastUpdated(new Date());
-        updateBuilder.setErrorString(answer.getErrorString());
-        updateBuilder.setJobId(answer.getJobId());
-        updateBuilder.setLocalDownloadPath(answer.getDownloadPath());
-        updateBuilder.setInstallPath(answer.getInstallPath());
-        updateBuilder.setSize(answer.getTemplateSize());
-        updateBuilder.setPhysicalSize(answer.getTemplatePhySicalSize());
-        _templateStoreDao.update(store.getId(), updateBuilder);
+        TemplateDataStoreVO tmpltStoreVO = _templateStoreDao.findByStoreTemplate(store.getId(),obj.getId());
+        if (tmpltStoreVO != null) {
+            TemplateDataStoreVO updateBuilder = _templateStoreDao.createForUpdate();
+            updateBuilder.setDownloadPercent(answer.getDownloadPct());
+            updateBuilder.setDownloadState(answer.getDownloadStatus());
+            updateBuilder.setLastUpdated(new Date());
+            updateBuilder.setErrorString(answer.getErrorString());
+            updateBuilder.setJobId(answer.getJobId());
+            updateBuilder.setLocalDownloadPath(answer.getDownloadPath());
+            updateBuilder.setInstallPath(answer.getInstallPath());
+            updateBuilder.setSize(answer.getTemplateSize());
+            updateBuilder.setPhysicalSize(answer.getTemplatePhySicalSize());
+            _templateStoreDao.update(tmpltStoreVO.getId(), updateBuilder);
+        }
 
         AsyncCompletionCallback<CreateCmdResult> caller = context.getParentCallback();
 


Mime
View raw message