mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-4204:[Object_store_refactor] Snapshot created from volume in
zone2 is copying to secondary staging storages in zone1
This commit is contained in:
parent
e018936dc4
commit
fc7743773a
@ -177,6 +177,21 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
|
|||||||
return zoneScope;
|
return zoneScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Scope pickCacheScopeForCopy(DataObject srcData, DataObject destData) {
|
||||||
|
Scope srcScope = srcData.getDataStore().getScope();
|
||||||
|
Scope destScope = destData.getDataStore().getScope();
|
||||||
|
|
||||||
|
Scope selectedScope = null;
|
||||||
|
if (srcScope.getScopeId() != null) {
|
||||||
|
selectedScope = srcScope;
|
||||||
|
} else if (destScope.getScopeId() != null) {
|
||||||
|
selectedScope = destScope;
|
||||||
|
} else {
|
||||||
|
s_logger.warn("Cannot find a zone-wide scope for move between cache store and image store");
|
||||||
|
}
|
||||||
|
return selectedScope;
|
||||||
|
}
|
||||||
|
|
||||||
protected Answer copyObject(DataObject srcData, DataObject destData) {
|
protected Answer copyObject(DataObject srcData, DataObject destData) {
|
||||||
String value = configDao.getValue(Config.PrimaryStorageDownloadWait.toString());
|
String value = configDao.getValue(Config.PrimaryStorageDownloadWait.toString());
|
||||||
int _primaryStorageDownloadWait = NumbersUtil.parseInt(value,
|
int _primaryStorageDownloadWait = NumbersUtil.parseInt(value,
|
||||||
@ -186,7 +201,7 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
|
|||||||
DataObject srcForCopy = srcData;
|
DataObject srcForCopy = srcData;
|
||||||
try {
|
try {
|
||||||
if (needCacheStorage(srcData, destData)) {
|
if (needCacheStorage(srcData, destData)) {
|
||||||
Scope destScope = getZoneScope(destData.getDataStore().getScope());
|
Scope destScope = pickCacheScopeForCopy(srcData, destData);
|
||||||
srcForCopy = cacheData = cacheMgr.createCacheObject(srcData, destScope);
|
srcForCopy = cacheData = cacheMgr.createCacheObject(srcData, destScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,7 +451,8 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
|
|||||||
Answer answer = null;
|
Answer answer = null;
|
||||||
try {
|
try {
|
||||||
if (needCacheStorage(srcData, destData)) {
|
if (needCacheStorage(srcData, destData)) {
|
||||||
cacheData = cacheMgr.getCacheObject(srcData, destData.getDataStore().getScope());
|
Scope selectedScope = pickCacheScopeForCopy(srcData, destData);
|
||||||
|
cacheData = cacheMgr.getCacheObject(srcData, selectedScope);
|
||||||
|
|
||||||
CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _backupsnapshotwait, _mgmtServer.getExecuteInSequence());
|
CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _backupsnapshotwait, _mgmtServer.getExecuteInSequence());
|
||||||
cmd.setCacheTO(cacheData.getTO());
|
cmd.setCacheTO(cacheData.getTO());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user