protected void releaseSnapshotCacheChain(SnapshotInfo snapshot) { while (snapshot != null) { cacheMgr.releaseCacheObject(snapshot); snapshot = snapshot.getParent(); } }
private void syncSnapshotToRegionStore(long snapshotId, DataStore store){ // if snapshot is already on region wide object store, check if it is really downloaded there (by checking install_path). Sync snapshot to region // wide store if it is not there physically. SnapshotInfo snapOnStore = _snapshotFactory.getSnapshot(snapshotId, store); if (snapOnStore == null) { throw new CloudRuntimeException("Cannot find an entry in snapshot_store_ref for snapshot " + snapshotId + " on region store: " + store.getName()); } if (snapOnStore.getPath() == null || snapOnStore.getPath().length() == 0) { if (s_logger.isDebugEnabled()) { s_logger.debug("sync snapshot " + snapshotId + " from cache to object store..."); } // snapshot is not on region store yet, sync to region store SnapshotInfo srcSnapshot = _snapshotFactory.getReadySnapshotOnCache(snapshotId); if (srcSnapshot == null) { throw new CloudRuntimeException("Cannot find snapshot " + snapshotId + " on cache store"); } AsyncCallFuture<SnapshotResult> future = syncToRegionStoreAsync(srcSnapshot, store); try { SnapshotResult result = future.get(); if (result.isFailed()) { throw new CloudRuntimeException("sync snapshot from cache to region wide store failed for image store " + store.getName() + ":" + result.getResult()); } _cacheMgr.releaseCacheObject(srcSnapshot); // reduce reference count for template on cache, so it can recycled by schedule } catch (Exception ex) { throw new CloudRuntimeException("sync snapshot from cache to region wide store failed for image store " + store.getName()); } } }
result.getResult()); _cacheMgr.releaseCacheObject(srcTemplate); // reduce reference count for template on cache, so it can recycled by schedule } catch (Exception ex) { throw new CloudRuntimeException("sync template from cache to region wide store failed for image store " + store.getName());
s_logger.debug("Decrease reference count of " + cacheType + " cache(id: " + cacheId + ", uuid: " + cacheUuid + ")"); cacheMgr.releaseCacheObject(srcForCopy);
cacheMgr.releaseCacheObject(srcData); // reduce ref count, but keep it there on cache which is converted from previous secondary storage