You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2013/05/24 23:35:24 UTC
[1/2] git commit: updated refs/heads/object_store to c609bc0
Updated Branches:
refs/heads/object_store 863b53406 -> c609bc054
Fix a bug in attachIsoToVM for S3.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9e1a9bfd
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9e1a9bfd
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9e1a9bfd
Branch: refs/heads/object_store
Commit: 9e1a9bfd4b33fada025f8776ee29001b034defda
Parents: 863b534
Author: Min Chen <mi...@citrix.com>
Authored: Fri May 24 14:24:23 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Fri May 24 14:24:23 2013 -0700
----------------------------------------------------------------------
.../com/cloud/template/TemplateManagerImpl.java | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e1a9bfd/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java
index 495e8e5..ac66312 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -1064,17 +1064,10 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
return false;
}
if (tmplt.getDataStore() != null && !(tmplt.getDataStore().getTO() instanceof NfsTO)) {
- String value = _configDao.getValue(Config.PrimaryStorageDownloadWait.toString());
- int _primaryStorageDownloadWait = NumbersUtil.parseInt(value, Integer.parseInt(Config.PrimaryStorageDownloadWait.getDefaultValue()));
// if it is s3, need to download into cache storage first
Scope destScope = new ZoneScope(vm.getDataCenterId());
TemplateInfo cacheData = (TemplateInfo) cacheMgr.createCacheObject(tmplt, destScope);
- CopyCommand cmd = new CopyCommand(tmplt.getTO(), cacheData.getTO(), _primaryStorageDownloadWait);
- EndPoint ep = selector.select(tmplt, cacheData);
- Answer answer = ep.sendMessage(cmd);
- if (answer != null && answer.getResult()) {
- tmplt = cacheData;
- } else {
+ if (cacheData == null){
s_logger.error("Failed in copy iso from S3 to cache storage");
return false;
}
[2/2] git commit: updated refs/heads/object_store to c609bc0
Posted by mc...@apache.org.
Not reuse already destroyed entries in template_store_ref to make code
cleaner.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c609bc05
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c609bc05
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c609bc05
Branch: refs/heads/object_store
Commit: c609bc0541c047a509dca0493b8c967b9ff9d3c6
Parents: 9e1a9bf
Author: Min Chen <mi...@citrix.com>
Authored: Fri May 24 14:34:56 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Fri May 24 14:34:56 2013 -0700
----------------------------------------------------------------------
.../com/cloud/template/TemplateManagerImpl.java | 38 ++------------
1 files changed, 6 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c609bc05/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java
index ac66312..ce26837 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -707,45 +707,19 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
// and copy template there, not propagate to all image stores
// for that zone
for (DataStore dstSecStore : dstSecStores) {
- TemplateDataStoreVO dstTmpltStore = null;
- try {
- dstTmpltStore = this._tmplStoreDao.findByStoreTemplate(dstSecStore.getId(), tmpltId, true);
- if (dstTmpltStore != null) {
- dstTmpltStore = _tmplStoreDao.lockRow(dstTmpltStore.getId(), true);
- if (dstTmpltStore != null && dstTmpltStore.getDownloadState() == Status.DOWNLOADED) {
- if (dstTmpltStore.getDestroyed() == false) {
- return true; // already downloaded on this image
- // store
- } else {
- dstTmpltStore.setDestroyed(false);
- _tmplStoreDao.update(dstTmpltStore.getId(), dstTmpltStore);
- return true;
- }
- } else if (dstTmpltStore != null && dstTmpltStore.getDownloadState() == Status.DOWNLOAD_ERROR) {
- if (dstTmpltStore.getDestroyed() == true) {
- dstTmpltStore.setDestroyed(false);
- dstTmpltStore.setDownloadState(Status.NOT_DOWNLOADED);
- dstTmpltStore.setDownloadPercent(0);
- dstTmpltStore.setCopy(true);
- dstTmpltStore.setErrorString("");
- dstTmpltStore.setJobId(null);
- _tmplStoreDao.update(dstTmpltStore.getId(), dstTmpltStore);
- }
- }
- }
- } finally {
- txn.commit();
+ TemplateDataStoreVO dstTmpltStore = this._tmplStoreDao.findByStoreTemplate(dstSecStore.getId(), tmpltId);
+ if (dstTmpltStore != null && dstTmpltStore.getDownloadState() == Status.DOWNLOADED) {
+ return true; // already downloaded on this image store
}
AsyncCallFuture<TemplateApiResult> future = this._tmpltSvr.copyTemplate(srcTemplate, dstSecStore);
try {
TemplateApiResult result = future.get();
if (result.isFailed()) {
- s_logger.debug("copy template failed:" + result.getResult());
- return false;
+ s_logger.debug("copy template failed for image store " + dstSecStore.getName() + ":" + result.getResult());
+ continue; // try next image store
}
- // if(_downloadMonitor.copyTemplate(template, srcSecStore,
- // dstSecStore) ) {
+
_tmpltDao.addTemplateToZone(template, dstZoneId);
if (account.getId() != Account.ACCOUNT_ID_SYSTEM) {