mirror of https://github.com/apache/cloudstack.git
bug 10624: ExtractVolume - code change for multiple secondary storage.
This commit is contained in:
parent
5b834edea2
commit
358c9eba05
|
|
@ -4369,7 +4369,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
throw new CloudRuntimeException(errorString);
|
||||
}
|
||||
|
||||
String volumeLocalPath = "volumes/" + volume.getId() + "/" + cvAnswer.getVolumePath() + ".vhd";
|
||||
String volumeLocalPath = "volumes/" + volume.getId() + "/" + cvAnswer.getVolumePath() + "." + getFormatForPool(srcPool);
|
||||
// Update the DB that volume is copied and volumePath
|
||||
uploadJob.setUploadState(UploadVO.Status.COPY_COMPLETE);
|
||||
uploadJob.setLastUpdated(new Date());
|
||||
|
|
@ -4386,6 +4386,23 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
}
|
||||
}
|
||||
|
||||
private String getFormatForPool(StoragePoolVO pool){
|
||||
ClusterVO cluster = ApiDBUtils.findClusterById(pool.getClusterId());
|
||||
|
||||
if (cluster.getHypervisorType() == HypervisorType.XenServer){
|
||||
return "vhd";
|
||||
}else if (cluster.getHypervisorType() == HypervisorType.KVM){
|
||||
return "qcow2";
|
||||
}else if (cluster.getHypervisorType() == HypervisorType.VMware){
|
||||
return "ova";
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public InstanceGroupVO updateVmGroup(UpdateVMGroupCmd cmd) {
|
||||
Account account = UserContext.current().getCaller();
|
||||
|
|
|
|||
|
|
@ -229,8 +229,9 @@ public class UploadMonitorImpl implements UploadMonitor {
|
|||
_uploadDao.persist(uploadTemplateObj);
|
||||
try{
|
||||
// Create Symlink at ssvm
|
||||
String uuid = UUID.randomUUID().toString() + "." + template.getFormat().toString().toLowerCase();
|
||||
CreateEntityDownloadURLCommand cmd = new CreateEntityDownloadURLCommand(storageServers.get(0).getParent(), vmTemplateHost.getInstallPath(), uuid);
|
||||
String path = vmTemplateHost.getInstallPath();
|
||||
String uuid = UUID.randomUUID().toString() + path.substring(path.length() - 4) ; // last 4 characters of the path specify the format like .vhd
|
||||
CreateEntityDownloadURLCommand cmd = new CreateEntityDownloadURLCommand(storageServers.get(0).getParent(), path, uuid);
|
||||
long result = send(use_ssvm.getId(), cmd, null);
|
||||
if (result == -1){
|
||||
errorString = "Unable to create a link for " +type+ " id:"+template.getId();
|
||||
|
|
@ -294,7 +295,7 @@ public class UploadMonitorImpl implements UploadMonitor {
|
|||
throw new CloudRuntimeException(errorString);
|
||||
}
|
||||
// Create Symlink at ssvm
|
||||
String uuid = UUID.randomUUID().toString() + ".vhd";
|
||||
String uuid = UUID.randomUUID().toString() + path.substring(path.length() - 4) ; // last 4 characters of the path specify the format like .vhd
|
||||
HostVO secStorage = ApiDBUtils.findHostById(ApiDBUtils.findUploadById(uploadId).getHostId());
|
||||
HostVO ssvm = _agentMgr.getSSAgent(secStorage);
|
||||
if( ssvm == null ) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue