private DataObject cacheSnapshotChain(SnapshotInfo snapshot, Scope scope) { DataObject leafData = null; DataStore store = cacheMgr.getCacheStorage(snapshot, scope); while (snapshot != null) { DataObject cacheData = cacheMgr.createCacheObject(snapshot, store); if (leafData == null) { leafData = cacheData; } snapshot = snapshot.getParent(); } return leafData; }
protected DataObject cacheSnapshotChain(SnapshotInfo snapshot, Scope scope) { DataObject leafData = null; DataStore store = cacheMgr.getCacheStorage(snapshot, scope); while (snapshot != null) { DataObject cacheData = cacheMgr.createCacheObject(snapshot, store); if (leafData == null) { leafData = cacheData; } snapshot = snapshot.getParent(); } return leafData; }
@Override public TemplateInfo prepareIso(long isoId, long dcId, Long hostId, Long poolId) { TemplateInfo tmplt; boolean bypassed = false; if (_tmplFactory.isTemplateMarkedForDirectDownload(isoId)) { tmplt = _tmplFactory.getReadyBypassedTemplateOnPrimaryStore(isoId, poolId, hostId); bypassed = true; } else { tmplt = _tmplFactory.getTemplate(isoId, DataStoreRole.Image, dcId); } if (tmplt == null || tmplt.getFormat() != ImageFormat.ISO) { s_logger.warn("ISO: " + isoId + " does not exist in vm_template table"); return null; } if (!bypassed && tmplt.getDataStore() != null && !(tmplt.getDataStore().getTO() instanceof NfsTO)) { // if it is s3, need to download into cache storage first Scope destScope = new ZoneScope(dcId); TemplateInfo cacheData = (TemplateInfo)cacheMgr.createCacheObject(tmplt, destScope); if (cacheData == null) { s_logger.error("Failed in copy iso from S3 to cache storage"); return null; } return cacheData; } else { return tmplt; } }
if (needCacheStorage(srcData, destData)) { Scope destScope = pickCacheScopeForCopy(srcData, destData); srcForCopy = cacheData = cacheMgr.createCacheObject(srcData, destScope);
return answer; } else { DataObject cacheData = cacheMgr.createCacheObject(srcData, destScope); CopyCommand cmd = new CopyCommand(cacheData.getTO(), destData.getTO(), _copyvolumewait, VirtualMachineManager.ExecuteInSequence.value()); EndPoint ep = selector.select(cacheData, destData);