cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [2/2] git commit: updated refs/heads/object_store to b66c484
Date Thu, 16 May 2013 01:55:19 GMT
Fix size issue in copying template from S3 to cache storage to make
system vm up.

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

Branch: refs/heads/object_store
Commit: b66c4849050a109409cb9f2f6b6cb011d0e89783
Parents: d5050d3
Author: Min Chen <min.chen@citrix.com>
Authored: Wed May 15 18:54:55 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Wed May 15 18:54:55 2013 -0700

----------------------------------------------------------------------
 .../storage/datastore/db/TemplateDataStoreVO.java  |    2 +-
 .../storage/image/TemplateServiceImpl.java         |    4 ++--
 .../storage/volume/VolumeServiceImpl.java          |    1 +
 .../secondary/SecondaryStorageManagerImpl.java     |    3 +++
 .../resource/NfsSecondaryStorageResource.java      |    7 +++++--
 5 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b66c4849/engine/api/src/org/apache/cloudstack/storage/datastore/db/TemplateDataStoreVO.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/TemplateDataStoreVO.java
b/engine/api/src/org/apache/cloudstack/storage/datastore/db/TemplateDataStoreVO.java
index ea50d88..44bda70 100755
--- a/engine/api/src/org/apache/cloudstack/storage/datastore/db/TemplateDataStoreVO.java
+++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/TemplateDataStoreVO.java
@@ -263,7 +263,7 @@ public class TemplateDataStoreVO implements StateObject<ObjectInDataStoreStateMa
 		return tid.hashCode()+hid.hashCode();
 	}
 
-    public void setSize(long size) {
+    public void setSize(Long size) {
         this.size = size;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b66c4849/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 3f9e3a1..597bbbe 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
@@ -349,7 +349,7 @@ public class TemplateServiceImpl implements TemplateService {
                     tmpltStore.setPhysicalSize(tmpltInfo.getPhysicalSize());
                     tmpltStore.setDataStoreRole(store.getRole());
                     _vmTemplateStoreDao.persist(tmpltStore);
-                    
+
                     // update size in vm_template table
                     VMTemplateVO tmlpt = _templateDao.findById(tmplt.getId());
                     tmlpt.setSize(tmpltInfo.getSize());
@@ -613,7 +613,7 @@ public class TemplateServiceImpl implements TemplateService {
             TemplateDataStoreVO tmpltStore = _vmTemplateStoreDao.findByStoreTemplate(storeId,
tmplt.getId());
             if ( tmpltStore == null ) {
                 tmpltStore = new TemplateDataStoreVO(storeId, tmplt.getId(), new Date(),
100, Status.DOWNLOADED, null, null, null, TemplateConstants.DEFAULT_SYSTEM_VM_TEMPLATE_PATH
+ tmplt.getId() + File.separator, tmplt.getUrl());
-                tmpltStore.setSize(0);
+                tmpltStore.setSize(0L);
                 tmpltStore.setPhysicalSize(0); // no size information for pre-seeded system
vm templates
                 tmpltStore.setDataStoreRole(store.getRole());
                 _vmTemplateStoreDao.persist(tmpltStore);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b66c4849/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 2b7f4ed..48160f4 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
@@ -359,6 +359,7 @@ public class VolumeServiceImpl implements VolumeService {
         try {
          	templateOnPrimaryStoreObj.processEvent(Event.CreateOnlyRequested);
         } catch (Exception e) {
+            s_logger.info("Got exception in case of multi-thread");
         	try {
         	    templateOnPrimaryStoreObj = waitForTemplateDownloaded(dataStore, template);
         	} catch(Exception e1) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b66c4849/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
index dd38acf..586f770 100755
--- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
+++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
@@ -50,6 +50,7 @@ import com.cloud.agent.api.StartupSecondaryStorageCommand;
 import com.cloud.agent.api.StopAnswer;
 import com.cloud.agent.api.check.CheckSshAnswer;
 import com.cloud.agent.api.check.CheckSshCommand;
+import com.cloud.agent.api.to.NfsTO;
 import com.cloud.agent.api.to.NicTO;
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.agent.manager.Commands;
@@ -293,6 +294,8 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements
Secondar
 
             List<DataStore> ssStores = this._dataStoreMgr.getImageStoresByScope(new
ZoneScope(zoneId));
              for( DataStore ssStore : ssStores ) {
+                 if (!(ssStore.getTO() instanceof NfsTO ))
+                     continue; // only do this for Nfs
                 String secUrl = ssStore.getUri();
                 SecStorageSetupCommand setupCmd = null;
                 if (!_useSSlCopy) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b66c4849/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
index 9324176..1125d7f 100755
--- a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
+++ b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
@@ -224,7 +224,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements
S
             return Answer.createUnsupportedCommandAnswer(cmd);
         }
     }
-    
+
     protected Answer copyFromS3ToNfs(CopyCommand cmd, DataTO srcData, S3TO s3, DataTO destData,
NfsTO destImageStore) {
         final String storagePath = destImageStore.getUrl();
         final String destPath = destData.getPath();
@@ -308,6 +308,8 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements
S
 
             String finalFileName = templateFilename;
             String finalDownloadPath = destPath + File.separator + templateFilename;
+            // compute the size of
+            long size = this._storage.getSize(downloadPath + File.separator + templateFilename);
 
             DataTO newDestTO = null;
 
@@ -315,6 +317,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements
S
                 TemplateObjectTO newTemplTO = new TemplateObjectTO();
                 newTemplTO.setPath(finalDownloadPath);
                 newTemplTO.setName(finalFileName);
+                newTemplTO.setSize(size);
                 newDestTO = newTemplTO;
             } else {
                 return new CopyCmdAnswer("not implemented yet");
@@ -355,7 +358,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements
S
             command.add("-n", templateName);
             command.add("-t", destPath);
             String result = command.execute();
-            
+
             if (result != null && !result.equalsIgnoreCase("")) {
             	return new CopyCmdAnswer(result);
             }


Mime
View raw message