Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

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;
Expand Down Expand Up @@ -68,4 +70,8 @@ public void setDiskId(String diskId) {
this.diskId = diskId;
}

public String stringRepresentation() {
return ReflectionToStringBuilder.toString(this, ToStringStyle.SIMPLE_STYLE);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ public List<GuestOSHypervisorVO> listByOsNameAndHypervisorMinimumVersion(String
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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ private Long retrieveTemplateGuestOsIdFromGuestOsInfo(long templateId, String gu
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);
Expand All @@ -190,7 +194,7 @@ private Long retrieveTemplateGuestOsIdFromGuestOsInfo(long templateId, String gu
}
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));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static com.cloud.network.NetworkModel.USERDATA_FILE;
import static com.cloud.utils.StringUtils.join;
import static com.cloud.utils.storage.S3.S3Utils.putFile;
import static java.lang.String.format;
import static java.util.Arrays.asList;
import static org.apache.commons.lang.StringUtils.substringAfterLast;

Expand Down Expand Up @@ -475,6 +474,9 @@ public Answer execute(CreateDatadiskTemplateCommand cmd) {

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);
Expand Down Expand Up @@ -804,7 +806,7 @@ protected Answer copyFromS3ToNfs(CopyCommand cmd, DataTO srcData, S3TO s3, DataT
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);
}
Expand Down