cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject git commit: updated refs/heads/4.2 to 1694e53
Date Fri, 19 Jul 2013 22:39:25 GMT
Updated Branches:
  refs/heads/4.2 e2f14167f -> 1694e53b1


CLOUDSTACK-3472: [Object_Store_Refactor] System VMs are not coming up in
initial attempt, but they are coming up after multiple attempts.


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

Branch: refs/heads/4.2
Commit: 1694e53b1d357031a5eb15a35396f105e4a5fcbf
Parents: e2f1416
Author: Min Chen <min.chen@citrix.com>
Authored: Fri Jul 19 15:38:37 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Fri Jul 19 15:39:15 2013 -0700

----------------------------------------------------------------------
 .../cloud/storage/VMTemplateStoragePoolVO.java  |  2 +-
 .../storage/image/TemplateDataFactoryImpl.java  |  8 ++++--
 .../storage/datastore/PrimaryDataStoreImpl.java | 13 ++++++++++
 .../storage/volume/VolumeServiceImpl.java       | 27 +++++++++++++++-----
 4 files changed, 40 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1694e53b/engine/schema/src/com/cloud/storage/VMTemplateStoragePoolVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/VMTemplateStoragePoolVO.java b/engine/schema/src/com/cloud/storage/VMTemplateStoragePoolVO.java
index 10ced67..9331b03 100644
--- a/engine/schema/src/com/cloud/storage/VMTemplateStoragePoolVO.java
+++ b/engine/schema/src/com/cloud/storage/VMTemplateStoragePoolVO.java
@@ -257,7 +257,7 @@ public class VMTemplateStoragePoolVO implements VMTemplateStorageResourceAssoc,
 
     @Override
     public String toString() {
-        return new StringBuilder("TmplPool[").append(id).append("-").append(templateId).append("-").append("poolId")
+        return new StringBuilder("TmplPool[").append(id).append("-").append(templateId).append("-").append(poolId)
                 .append("-").append(installPath).append("]").toString();
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1694e53b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateDataFactoryImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateDataFactoryImpl.java
b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateDataFactoryImpl.java
index e369c1c..1db49ae 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateDataFactoryImpl.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateDataFactoryImpl.java
@@ -70,8 +70,12 @@ public class TemplateDataFactoryImpl implements TemplateDataFactory {
             }
         }
 
-        if (!found) {
-            s_logger.debug("template " + templateId + " is not in store:" + store.getId()
+ ", type:" + store.getRole());
+        if (s_logger.isDebugEnabled()) {
+            if (!found) {
+                s_logger.debug("template " + templateId + " is not in store:" + store.getId()
+ ", type:" + store.getRole());
+            } else {
+                s_logger.debug("template " + templateId + " is already in store:" + store.getId()
+ ", type:" + store.getRole());
+            }
         }
 
         TemplateObject tmpl = TemplateObject.getTemplate(templ, store);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1694e53b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreImpl.java
b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreImpl.java
index 420fd29..55057d0 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreImpl.java
@@ -228,13 +228,26 @@ public class PrimaryDataStoreImpl implements PrimaryDataStore {
             VMTemplateStoragePoolVO templateStoragePoolRef = templatePoolDao.findByPoolTemplate(this.getId(),
                     obj.getId());
             if (templateStoragePoolRef == null) {
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("Not found (templateId: " + obj.getId() + ", poolId: "
+ this.getId() + ") in template_spool_ref");
+                }
                 try {
+                    if (s_logger.isDebugEnabled()) {
+                        s_logger.debug("Persisting (templateId: " + obj.getId() + ", poolId:
" + this.getId() + ") to template_spool_ref");
+                    }
                     templateStoragePoolRef = new VMTemplateStoragePoolVO(this.getId(), obj.getId());
                     templateStoragePoolRef = templatePoolDao.persist(templateStoragePoolRef);
                 } catch (Throwable t) {
+                    if (s_logger.isDebugEnabled()) {
+                        s_logger.debug("Failed to insert (templateId: " + obj.getId() + ",
poolId: " + this.getId() + ") to template_spool_ref", t);
+                    }
                     templateStoragePoolRef = templatePoolDao.findByPoolTemplate(this.getId(),
obj.getId());
                     if (templateStoragePoolRef == null) {
                         throw new CloudRuntimeException("Failed to create template storage
pool entry");
+                    } else {
+                        if (s_logger.isDebugEnabled()) {
+                            s_logger.debug("Another thread already inserts " + templateStoragePoolRef.getId()
+ " to template_spool_ref", t);
+                        }
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1694e53b/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 89313e4..7aa9bd5 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
@@ -146,6 +146,7 @@ public class VolumeServiceImpl implements VolumeService {
 
     }
 
+    @Override
     public ChapInfo getChapInfo(VolumeInfo volumeInfo, DataStore dataStore) {
         DataStoreDriver dataStoreDriver = dataStore.getDriver();
 
@@ -353,8 +354,12 @@ public class VolumeServiceImpl implements VolumeService {
 
         VMTemplateStoragePoolVO templatePoolRef = _tmpltPoolDao.findByPoolTemplate(dataStore.getId(),
template.getId());
         if (templatePoolRef == null) {
-            throw new CloudRuntimeException("Failed to find template " + template.getUniqueName()
-                    + " in VMTemplateStoragePool");
+            throw new CloudRuntimeException("Failed to find template " + template.getUniqueName()
+ " in storage pool " + dataStore.getId());
+        } else {
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug("Found template " + template.getUniqueName() + " in storage
pool " + dataStore.getId() + " with VMTemplateStoragePool id: "
+                        + templatePoolRef.getId());
+            }
         }
         long templatePoolRefId = templatePoolRef.getId();
         CreateBaseImageContext<CreateCmdResult> context = new CreateBaseImageContext<CreateCmdResult>(null,
volume,
@@ -364,8 +369,14 @@ public class VolumeServiceImpl implements VolumeService {
 
         int storagePoolMaxWaitSeconds = NumbersUtil.parseInt(
                 configDao.getValue(Config.StoragePoolMaxWaitSeconds.key()), 3600);
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Acquire lock on VMTemplateStoragePool " + templatePoolRefId +
" with timeout " + storagePoolMaxWaitSeconds + " seconds");
+        }
         templatePoolRef = _tmpltPoolDao.acquireInLockTable(templatePoolRefId, storagePoolMaxWaitSeconds);
         if (templatePoolRef == null) {
+            if (s_logger.isDebugEnabled()) {
+                s_logger.info("Unable to acquire lock on VMTemplateStoragePool " + templatePoolRefId);
+            }
             templatePoolRef = _tmpltPoolDao.findByPoolTemplate(dataStore.getId(), template.getId());
             if (templatePoolRef.getState() == ObjectInDataStoreStateMachine.State.Ready )
{
                 s_logger.info("Unable to acquire lock on VMTemplateStoragePool " + templatePoolRefId
+ ", But Template " + template.getUniqueName() + " is already copied to primary storage, skip
copying");
@@ -375,17 +386,15 @@ public class VolumeServiceImpl implements VolumeService {
             throw new CloudRuntimeException("Unable to acquire lock on VMTemplateStoragePool:
" + templatePoolRefId);
         }
 
+        if (s_logger.isDebugEnabled()) {
+            s_logger.info("lock is acquired for VMTemplateStoragePool " + templatePoolRefId);
+        }
         try {
-            // lock acquired
             if (templatePoolRef.getState() == ObjectInDataStoreStateMachine.State.Ready )
{
                 s_logger.info("Template " + template.getUniqueName() + " is already copied
to primary storage, skip copying");
                 createVolumeFromBaseImageAsync(volume, templateOnPrimaryStoreObj, dataStore,
future);
                 return;
             }
-            // remove the leftover hanging entry
-            dataStore.delete(templateOnPrimaryStoreObj);
-            // create a new entry to restart copying process
-            templateOnPrimaryStoreObj = dataStore.create(template);
             templateOnPrimaryStoreObj.processEvent(Event.CreateOnlyRequested);
             motionSrv.copyAsync(template, templateOnPrimaryStoreObj, caller);
         } catch (Throwable e) {
@@ -394,6 +403,10 @@ public class VolumeServiceImpl implements VolumeService {
             VolumeApiResult result = new VolumeApiResult(volume);
             result.setResult(e.toString());
             future.complete(result);
+        } finally {
+            if (s_logger.isDebugEnabled()) {
+                s_logger.info("releasing lock for VMTemplateStoragePool " + templatePoolRefId);
+            }
             _tmpltPoolDao.releaseFromLockTable(templatePoolRefId);
         }
         return;


Mime
View raw message