bug 9596 : Make the iso extractable by default.

status 9596: resolved fixed
This commit is contained in:
nit 2011-05-27 16:19:26 +05:30
parent 77de414c81
commit 714ab83fa1
3 changed files with 13 additions and 4 deletions

View File

@ -24,6 +24,7 @@ import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation; import com.cloud.api.Implementation;
import com.cloud.api.Parameter; import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException; import com.cloud.api.ServerApiException;
import com.cloud.api.BaseCmd.CommandType;
import com.cloud.api.response.ListResponse; import com.cloud.api.response.ListResponse;
import com.cloud.api.response.TemplateResponse; import com.cloud.api.response.TemplateResponse;
import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.InvalidParameterValueException;
@ -54,6 +55,9 @@ public class RegisterIsoCmd extends BaseCmd {
@Parameter(name=ApiConstants.IS_PUBLIC, type=CommandType.BOOLEAN, description="true if you want to register the ISO to be publicly available to all users, false otherwise.") @Parameter(name=ApiConstants.IS_PUBLIC, type=CommandType.BOOLEAN, description="true if you want to register the ISO to be publicly available to all users, false otherwise.")
private Boolean publicIso; private Boolean publicIso;
@Parameter(name=ApiConstants.IS_EXTRACTABLE, type=CommandType.BOOLEAN, description="true if the iso or its derivatives are extractable; default is true")
private Boolean extractable;
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the ISO") @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the ISO")
private String isoName; private String isoName;
@ -92,6 +96,10 @@ public class RegisterIsoCmd extends BaseCmd {
return publicIso; return publicIso;
} }
public Boolean isExtractable() {
return extractable;
}
public String getIsoName() { public String getIsoName() {
return isoName; return isoName;
} }

View File

@ -1612,6 +1612,7 @@ public class ApiResponseHelper implements ResponseGenerator {
} }
templateResponse.setFeatured(template.isFeatured()); templateResponse.setFeatured(template.isFeatured());
templateResponse.setExtractable(template.isExtractable());
templateResponse.setBootable(template.isBootable()); templateResponse.setBootable(template.isBootable());
templateResponse.setOsTypeId(template.getGuestOSId()); templateResponse.setOsTypeId(template.getGuestOSId());
templateResponse.setOsTypeName(ApiDBUtils.findGuestOSById(template.getGuestOSId()).getDisplayName()); templateResponse.setOsTypeName(ApiDBUtils.findGuestOSById(template.getGuestOSId()).getDisplayName());

View File

@ -113,9 +113,6 @@ public abstract class TemplateAdapterBase implements TemplateAdapter {
guestOSId = 138L; //Guest os id of None. guestOSId = 138L; //Guest os id of None.
} }
} else { } else {
if (isExtractable == null) {
isExtractable = Boolean.TRUE;
}
if (bits == null) { if (bits == null) {
bits = Integer.valueOf(64); bits = Integer.valueOf(64);
} }
@ -127,6 +124,9 @@ public abstract class TemplateAdapterBase implements TemplateAdapter {
} }
} }
if (isExtractable == null) {
isExtractable = Boolean.TRUE;
}
if ((accountName == null) ^ (domainId == null)) {// XOR - Both have to be passed or don't pass any of them if ((accountName == null) ^ (domainId == null)) {// XOR - Both have to be passed or don't pass any of them
throw new InvalidParameterValueException("Please specify both account and domainId or dont specify any of them"); throw new InvalidParameterValueException("Please specify both account and domainId or dont specify any of them");
} }
@ -241,7 +241,7 @@ public abstract class TemplateAdapterBase implements TemplateAdapter {
public TemplateProfile prepare(RegisterIsoCmd cmd) throws ResourceAllocationException { public TemplateProfile prepare(RegisterIsoCmd cmd) throws ResourceAllocationException {
return prepare(true, UserContext.current().getCallerUserId(), cmd.getIsoName(), cmd.getDisplayText(), 64, false, return prepare(true, UserContext.current().getCallerUserId(), cmd.getIsoName(), cmd.getDisplayText(), 64, false,
true, cmd.getUrl(), cmd.isPublic(), cmd.isFeatured(), true, ImageFormat.ISO.toString(), cmd.getOsTypeId(), true, cmd.getUrl(), cmd.isPublic(), cmd.isFeatured(), cmd.isExtractable(), ImageFormat.ISO.toString(), cmd.getOsTypeId(),
cmd.getZoneId(), HypervisorType.None, cmd.getAccountName(), cmd.getDomainId(), null, cmd.isBootable()); cmd.getZoneId(), HypervisorType.None, cmd.getAccountName(), cmd.getDomainId(), null, cmd.isBootable());
} }