mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Ova download fix (#6758)
This commit is contained in:
parent
48ffa5dc0b
commit
4a06363749
@ -18,6 +18,8 @@ package com.cloud.agent.api.storage;
|
||||
|
||||
import com.cloud.agent.api.Command;
|
||||
import com.cloud.agent.api.to.DataTO;
|
||||
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
public final class CreateDatadiskTemplateCommand extends Command {
|
||||
private DataTO dataDiskTemplate;
|
||||
@ -68,4 +70,8 @@ public final class CreateDatadiskTemplateCommand extends Command {
|
||||
this.diskId = diskId;
|
||||
}
|
||||
|
||||
public String stringRepresentation() {
|
||||
return ReflectionToStringBuilder.toString(this, ToStringStyle.SIMPLE_STYLE);
|
||||
}
|
||||
|
||||
}
|
||||
@ -156,8 +156,9 @@ public class GuestOSHypervisorDaoImpl extends GenericDaoBase<GuestOSHypervisorVO
|
||||
final QueryBuilder<GuestOSHypervisorVO> sc = QueryBuilder.create(GuestOSHypervisorVO.class);
|
||||
sc.and(sc.entity().getGuestOsName(), SearchCriteria.Op.EQ, guestOsName);
|
||||
sc.and(sc.entity().getHypervisorType(), SearchCriteria.Op.EQ, hypervisorType);
|
||||
sc.and(sc.entity().getHypervisorVersion(), SearchCriteria.Op.GTEQ, minHypervisorVersion);
|
||||
sc.and(sc.entity().getHypervisorVersion(), SearchCriteria.Op.NEQ, "default");
|
||||
sc.and().op(sc.entity().getHypervisorVersion(), SearchCriteria.Op.GTEQ, minHypervisorVersion);
|
||||
sc.or(sc.entity().getHypervisorVersion(), SearchCriteria.Op.NEQ, "default");
|
||||
sc.cp();
|
||||
return sc.list();
|
||||
}
|
||||
|
||||
|
||||
@ -169,6 +169,10 @@ public class DeployAsIsHelperImpl implements DeployAsIsHelper {
|
||||
hypervisor.toString(), minimumHypervisorVersion);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(guestOsMappings)) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
String msg = String.format("number of hypervisor mappings for guest os \"%s\" is: %d", guestOsType, guestOsMappings.size());
|
||||
LOGGER.debug(msg);
|
||||
}
|
||||
Long guestOsId = null;
|
||||
if (guestOsMappings.size() == 1) {
|
||||
GuestOSHypervisorVO mapping = guestOsMappings.get(0);
|
||||
@ -190,7 +194,7 @@ public class DeployAsIsHelperImpl implements DeployAsIsHelper {
|
||||
}
|
||||
return guestOsId;
|
||||
} else {
|
||||
throw new CloudRuntimeException("Did not find a guest OS with type " + guestOsType);
|
||||
throw new CloudRuntimeException(String.format("Did not find a guest OS (%s) with type \"%s\" and minimal hypervisor hardware version %s.", guestOsDescription, guestOsType, minimumHardwareVersion));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,6 @@ import static com.cloud.network.NetworkModel.PUBLIC_KEYS_FILE;
|
||||
import static com.cloud.network.NetworkModel.USERDATA_DIR;
|
||||
import static com.cloud.network.NetworkModel.USERDATA_FILE;
|
||||
import static com.cloud.utils.storage.S3.S3Utils.putFile;
|
||||
import static java.lang.String.format;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@ -473,6 +472,9 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
|
||||
long templateId = dataDiskTemplate.getId();
|
||||
String templateUniqueName = dataDiskTemplate.getUniqueName();
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug(String.format("no cmd? %s", cmd.stringRepresentation()));
|
||||
}
|
||||
String origDisk = cmd.getPath();
|
||||
long virtualSize = dataDiskTemplate.getSize();
|
||||
String diskName = origDisk.substring((origDisk.lastIndexOf(File.separator)) + 1);
|
||||
@ -802,7 +804,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
return postProcessing(destFile, downloadPath, destPath, srcData, destData);
|
||||
} catch (Exception e) {
|
||||
|
||||
final String errMsg = format("Failed to download" + "due to $1%s", e.getMessage());
|
||||
final String errMsg = String.format("Failed to download" + "due to $1%s", e.getMessage());
|
||||
s_logger.error(errMsg, e);
|
||||
return new CopyCmdAnswer(errMsg);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user