mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 9909: upload manager support multiple secondary storage
This commit is contained in:
parent
024bd039da
commit
b5aeb6fa0e
@ -22,8 +22,16 @@ import com.cloud.agent.api.Command;
|
||||
|
||||
public class CreateEntityDownloadURLCommand extends AbstractDownloadCommand {
|
||||
|
||||
public CreateEntityDownloadURLCommand(String parent, String installPath, String uuid) { // this constructor is for creating template download url
|
||||
super();
|
||||
this.parent = parent; // parent is required as not the template can be child of one of many parents
|
||||
this.installPath = installPath;
|
||||
this.extractLinkUUID = uuid;
|
||||
}
|
||||
|
||||
public CreateEntityDownloadURLCommand(String installPath, String uuid) {
|
||||
super();
|
||||
this.parent = parent;
|
||||
this.installPath = installPath;
|
||||
this.extractLinkUUID = uuid;
|
||||
}
|
||||
@ -32,6 +40,7 @@ public class CreateEntityDownloadURLCommand extends AbstractDownloadCommand {
|
||||
}
|
||||
|
||||
private String installPath;
|
||||
private String parent;
|
||||
private String extractLinkUUID;
|
||||
|
||||
@Override
|
||||
@ -46,6 +55,14 @@ public class CreateEntityDownloadURLCommand extends AbstractDownloadCommand {
|
||||
public void setInstallPath(String installPath) {
|
||||
this.installPath = installPath;
|
||||
}
|
||||
|
||||
public String getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(String parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String getExtractLinkUUID() {
|
||||
return extractLinkUUID;
|
||||
|
||||
@ -373,11 +373,10 @@ public class UploadManagerImpl implements UploadManager {
|
||||
}
|
||||
|
||||
|
||||
// Create a symbolic link from the actual directory to the template location. The entity would be directly visible under /var/www/html/userdata
|
||||
cmd.getInstallPath();
|
||||
// Create a symbolic link from the actual directory to the template location. The entity would be directly visible under /var/www/html/userdata/cmd.getInstallPath();
|
||||
command = new Script("/bin/bash", s_logger);
|
||||
command.add("-c");
|
||||
command.add("ln -sf " + extractMountPoint + File.separator + cmd.getInstallPath() + " " + extractDir + uuid);
|
||||
command.add("ln -sf /mnt/SecStorage/" + cmd.getParent() + File.separator + cmd.getInstallPath() + " " + extractDir + uuid);
|
||||
result = command.execute();
|
||||
if (result != null) {
|
||||
String errorString = "Error in linking err=" + result;
|
||||
|
||||
@ -194,7 +194,7 @@ public class UploadMonitorImpl implements UploadMonitor {
|
||||
String errorString = "";
|
||||
boolean success = false;
|
||||
List<HostVO> storageServers = _serverDao.listByTypeDataCenter(Host.Type.SecondaryStorage, dataCenterId);
|
||||
if(storageServers == null ) {
|
||||
if(storageServers == null || storageServers.size() == 0) {
|
||||
throw new CloudRuntimeException("No Storage Server found at the datacenter - " +dataCenterId);
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ public class UploadMonitorImpl implements UploadMonitor {
|
||||
try{
|
||||
// Create Symlink at ssvm
|
||||
String uuid = UUID.randomUUID().toString() + ".vhd";
|
||||
CreateEntityDownloadURLCommand cmd = new CreateEntityDownloadURLCommand(vmTemplateHost.getInstallPath(), uuid);
|
||||
CreateEntityDownloadURLCommand cmd = new CreateEntityDownloadURLCommand(storageServers.get(0).getParent(), vmTemplateHost.getInstallPath(), uuid);
|
||||
long result = send(use_ssvm.getId(), cmd, null);
|
||||
if (result == -1){
|
||||
errorString = "Unable to create a link for " +type+ " id:"+template.getId();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user