mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-4190: Add endpoint selector implementation for ImageCache
data store and also delete object from staging area for volume copy from primary to secondary or vice versa.
This commit is contained in:
parent
bf6961255a
commit
99c3e4f3f5
@ -182,7 +182,6 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
|
||||
int _primaryStorageDownloadWait = NumbersUtil.parseInt(value,
|
||||
Integer.parseInt(Config.PrimaryStorageDownloadWait.getDefaultValue()));
|
||||
Answer answer = null;
|
||||
boolean usingCache = false;
|
||||
DataObject cacheData = null;
|
||||
DataObject srcForCopy = srcData;
|
||||
try {
|
||||
@ -196,10 +195,16 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
|
||||
answer = ep.sendMessage(cmd);
|
||||
|
||||
if (cacheData != null) {
|
||||
if (answer == null || !answer.getResult()) {
|
||||
if (srcData.getType() == DataObjectType.VOLUME && destData.getType() == DataObjectType.VOLUME) {
|
||||
// volume transfer from primary to secondary or vice versa. Volume transfer between primary pools are already handled by copyVolumeBetweenPools
|
||||
cacheMgr.deleteCacheObject(srcForCopy);
|
||||
} else {
|
||||
cacheMgr.releaseCacheObject(srcForCopy);
|
||||
// for template, we want to leave it on cache for performance reason
|
||||
if (answer == null || !answer.getResult()) {
|
||||
cacheMgr.deleteCacheObject(srcForCopy);
|
||||
} else {
|
||||
cacheMgr.releaseCacheObject(srcForCopy);
|
||||
}
|
||||
}
|
||||
}
|
||||
return answer;
|
||||
|
||||
@ -221,7 +221,7 @@ public class DefaultEndPointSelector implements EndPointSelector {
|
||||
public EndPoint select(DataStore store) {
|
||||
if (store.getRole() == DataStoreRole.Primary) {
|
||||
return findEndpointForPrimaryStorage(store);
|
||||
} else if (store.getRole() == DataStoreRole.Image) {
|
||||
} else if (store.getRole() == DataStoreRole.Image || store.getRole() == DataStoreRole.ImageCache) {
|
||||
// in case there is no ssvm, directly send down command hypervisor
|
||||
// host
|
||||
// otherwise, send to localhost for bootstrap system vm template
|
||||
|
||||
@ -2780,12 +2780,8 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
|
||||
|
||||
// Clean up code to remove all those previous uploadVO and uploadMonitor code. Previous code is trying to fake an async operation purely in
|
||||
// db table with uploadVO and async_job entry, but internal implementation is actually synchronous.
|
||||
StoragePool srcPool = (StoragePool) dataStoreMgr.getPrimaryDataStore(volume.getPoolId());
|
||||
ImageStoreEntity secStore = (ImageStoreEntity) dataStoreMgr.getImageStore(zoneId);
|
||||
String secondaryStorageURL = secStore.getUri();
|
||||
|
||||
String value = _configDao.getValue(Config.CopyVolumeWait.toString());
|
||||
int copyvolumewait = NumbersUtil.parseInt(value, Integer.parseInt(Config.CopyVolumeWait.getDefaultValue()));
|
||||
// Copy volume from primary to secondary storage
|
||||
VolumeInfo srcVol = volFactory.getVolume(volume.getId());
|
||||
AsyncCallFuture<VolumeApiResult> cvAnswer = volService.copyVolume(srcVol, secStore);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user