mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-4109: fix upload volume to s3 for vmware
This commit is contained in:
parent
82c35e52ea
commit
e851f4a930
@ -204,7 +204,7 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
|
||||
}
|
||||
return answer;
|
||||
} catch (Exception e) {
|
||||
s_logger.debug("copy object failed: " + e.toString());
|
||||
s_logger.debug("copy object failed: ", e);
|
||||
if (cacheData != null) {
|
||||
cacheMgr.deleteCacheObject(cacheData);
|
||||
}
|
||||
|
||||
@ -502,7 +502,9 @@ public class VolumeObject implements VolumeInfo {
|
||||
this.getId());
|
||||
VolumeObjectTO newVol = (VolumeObjectTO) cpyAnswer.getNewData();
|
||||
volStore.setInstallPath(newVol.getPath());
|
||||
volStore.setSize(newVol.getSize());
|
||||
if (newVol.getSize() != null) {
|
||||
volStore.setSize(newVol.getSize());
|
||||
}
|
||||
this.volumeStoreDao.update(volStore.getId(), volStore);
|
||||
}
|
||||
}
|
||||
@ -595,7 +597,9 @@ public class VolumeObject implements VolumeInfo {
|
||||
this.getId());
|
||||
VolumeObjectTO newVol = (VolumeObjectTO) cpyAnswer.getNewData();
|
||||
volStore.setInstallPath(newVol.getPath());
|
||||
volStore.setSize(newVol.getSize());
|
||||
if (newVol.getSize() != null) {
|
||||
volStore.setSize(newVol.getSize());
|
||||
}
|
||||
this.volumeStoreDao.update(volStore.getId(), volStore);
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ import com.cloud.storage.DataStoreRole;
|
||||
import org.apache.cloudstack.storage.command.CopyCmdAnswer;
|
||||
import org.apache.cloudstack.storage.command.CopyCommand;
|
||||
import org.apache.cloudstack.storage.to.SnapshotObjectTO;
|
||||
import org.apache.cloudstack.storage.to.VolumeObjectTO;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@ -76,6 +77,17 @@ public class VmwareStorageSubsystemCommandHandler extends StorageSubsystemComman
|
||||
}
|
||||
|
||||
if (srcDataStore.getRole() == DataStoreRole.ImageCache && destDataStore.getRole() == DataStoreRole.Image) {
|
||||
//need to take extra processing for vmware, such as packing to ova, before sending to S3
|
||||
if (srcData.getObjectType() == DataObjectType.VOLUME) {
|
||||
NfsTO cacheStore = (NfsTO)srcDataStore;
|
||||
String parentPath = storageResource.getRootDir(cacheStore.getUrl());
|
||||
VolumeObjectTO vol = (VolumeObjectTO)srcData;
|
||||
String path = vol.getPath();
|
||||
int index = path.lastIndexOf(File.separator);
|
||||
String name = path.substring(index + 1);
|
||||
storageManager.createOva(parentPath + File.separator + path, name);
|
||||
vol.setPath(path + File.separator + name + ".ova");
|
||||
}
|
||||
needDelegation = true;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user