cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject git commit: updated refs/heads/bugfix/CS-7665 to 47ac3e4
Date Thu, 02 Oct 2014 07:55:15 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/bugfix/CS-7665 [created] 47ac3e4fd


CLOUDSTACK-7665 File.separator shouldn't be used in this case, the
separator is fixed just like the rest of the path

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

Branch: refs/heads/bugfix/CS-7665
Commit: 47ac3e4fd1aa9b117b5ce72035e6d09239f1ca4f
Parents: 70efe15
Author: Hugo Trippaers <htrippaers@schubergphilis.com>
Authored: Thu Oct 2 09:54:53 2014 +0200
Committer: Hugo Trippaers <htrippaers@schubergphilis.com>
Committed: Thu Oct 2 09:54:53 2014 +0200

----------------------------------------------------------------------
 .../storage/image/TemplateServiceImpl.java      | 29 ++++++++++----------
 1 file changed, 14 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/47ac3e4f/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 4e6ab6b..c15cda0 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
@@ -18,7 +18,6 @@
  */
 package org.apache.cloudstack.storage.image;
 
-import java.io.File;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashSet;
@@ -334,7 +333,7 @@ public class TemplateServiceImpl implements TemplateService {
                                     s_logger.info("msg");
                                     if (tmplt.getUrl() == null) {
                                         msg =
-                                            "Private Template (" + tmplt + ") with install
path " + tmpltInfo.getInstallPath() +
+                                                "Private Template (" + tmplt + ") with install
path " + tmpltInfo.getInstallPath() +
                                                 "is corrupted, please check in image store:
" + tmpltStore.getDataStoreId();
                                         s_logger.warn(msg);
                                     } else {
@@ -362,22 +361,22 @@ public class TemplateServiceImpl implements TemplateService {
                                         long accountId = tmplt.getAccountId();
                                         try {
                                             _resourceLimitMgr.checkResourceLimit(_accountMgr.getAccount(accountId),
-                                                com.cloud.configuration.Resource.ResourceType.secondary_storage,
-                                                tmpltInfo.getSize() - UriUtils.getRemoteSize(tmplt.getUrl()));
+                                                    com.cloud.configuration.Resource.ResourceType.secondary_storage,
+                                                    tmpltInfo.getSize() - UriUtils.getRemoteSize(tmplt.getUrl()));
                                         } catch (ResourceAllocationException e) {
                                             s_logger.warn(e.getMessage());
                                             _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED,
zoneId, null, e.getMessage(), e.getMessage());
                                         } finally {
                                             _resourceLimitMgr.recalculateResourceCount(accountId,
_accountMgr.getAccount(accountId).getDomainId(),
-                                                com.cloud.configuration.Resource.ResourceType.secondary_storage.getOrdinal());
+                                                    com.cloud.configuration.Resource.ResourceType.secondary_storage.getOrdinal());
                                         }
                                     }
                                 }
                                 _vmTemplateStoreDao.update(tmpltStore.getId(), tmpltStore);
                             } else {
                                 tmpltStore =
-                                    new TemplateDataStoreVO(storeId, tmplt.getId(), new Date(),
100, Status.DOWNLOADED, null, null, null, tmpltInfo.getInstallPath(),
-                                        tmplt.getUrl());
+                                        new TemplateDataStoreVO(storeId, tmplt.getId(), new
Date(), 100, Status.DOWNLOADED, null, null, null, tmpltInfo.getInstallPath(),
+                                                tmplt.getUrl());
                                 tmpltStore.setSize(tmpltInfo.getSize());
                                 tmpltStore.setPhysicalSize(tmpltInfo.getPhysicalSize());
                                 tmpltStore.setDataStoreRole(store.getRole());
@@ -392,7 +391,7 @@ public class TemplateServiceImpl implements TemplateService {
                             }
                         } else {
                             s_logger.info("Template Sync did not find " + uniqueName + "
on image store " + storeId +
-                                ", may request download based on available hypervisor types");
+                                    ", may request download based on available hypervisor
types");
                             if (tmpltStore != null) {
                                 if (_storeMgr.isRegionStore(store) && tmpltStore.getDownloadState()
== VMTemplateStorageResourceAssoc.Status.DOWNLOADED
                                         && tmpltStore.getState() == State.Ready
@@ -451,7 +450,7 @@ public class TemplateServiceImpl implements TemplateService {
                                 createTemplateAsync(tmpl, store, null);
                             } else {
                                 s_logger.info("Skip downloading template " + tmplt.getUniqueName()
+ " since current data center does not have hypervisor " +
-                                    tmplt.getHypervisorType().toString());
+                                        tmplt.getHypervisorType().toString());
                             }
                         }
                     }
@@ -652,8 +651,8 @@ public class TemplateServiceImpl implements TemplateService {
         // But we need to set default install path so that sync can be done in the right
s3 path
         TemplateInfo templateOnStore = _templateFactory.getTemplate(template, store);
         String installPath =
-            TemplateConstants.DEFAULT_TMPLT_ROOT_DIR + "/" + TemplateConstants.DEFAULT_TMPLT_FIRST_LEVEL_DIR
+ template.getAccountId() + "/" + template.getId() + "/" +
-                template.getUniqueName();
+                TemplateConstants.DEFAULT_TMPLT_ROOT_DIR + "/" + TemplateConstants.DEFAULT_TMPLT_FIRST_LEVEL_DIR
+ template.getAccountId() + "/" + template.getId() + "/" +
+                        template.getUniqueName();
         ((TemplateObject)templateOnStore).setInstallPath(installPath);
         TemplateOpContext<TemplateApiResult> context = new TemplateOpContext<TemplateApiResult>(null,
(TemplateObject)templateOnStore, future);
         AsyncCallbackDispatcher<TemplateServiceImpl, CopyCommandResult> caller = AsyncCallbackDispatcher.create(this);
@@ -710,7 +709,7 @@ public class TemplateServiceImpl implements TemplateService {
                     TemplateApiResult result = future.get();
                     if (result.isFailed()) {
                         throw new CloudRuntimeException("sync template from cache to region
wide store failed for image store " + store.getName() + ":" +
-                            result.getResult());
+                                result.getResult());
                     }
                     _cacheMgr.releaseCacheObject(srcTemplate); // reduce reference count
for template on cache, so it can recycled by schedule
                 } catch (Exception ex) {
@@ -733,7 +732,7 @@ public class TemplateServiceImpl implements TemplateService {
         String url = generateCopyUrl(srcTemplate);
         if (url == null) {
             s_logger.warn("Unable to start/resume copy of template " + srcTemplate.getUniqueName()
+ " to " + destStore.getName() +
-                ", no secondary storage vm in running state in source zone");
+                    ", no secondary storage vm in running state in source zone");
             throw new CloudRuntimeException("No secondary VM in running state in source template
zone ");
         }
 
@@ -877,8 +876,8 @@ 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());
+                        new TemplateDataStoreVO(storeId, tmplt.getId(), new Date(), 100,
Status.DOWNLOADED, null, null, null,
+                                TemplateConstants.DEFAULT_SYSTEM_VM_TEMPLATE_PATH + tmplt.getId()
+ '/', tmplt.getUrl());
                 tmpltStore.setSize(0L);
                 tmpltStore.setPhysicalSize(0); // no size information for
                 // pre-seeded system vm templates


Mime
View raw message