bug 8498: Make osTypeId optional. Introdue a new OS type None to be shown for non bootable ISOs. Add check that when the ISO is bootable a valid osTypeId gets passed

This commit is contained in:
nit 2011-02-11 18:44:26 +05:30
parent 0db879d053
commit e901ccfe07
3 changed files with 10 additions and 2 deletions

View File

@ -54,7 +54,7 @@ public class RegisterIsoCmd extends BaseCmd {
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the ISO")
private String isoName;
@Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.LONG, required=true, description="the ID of the OS Type that best represents the OS of this ISO")
@Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.LONG, description="the ID of the OS Type that best represents the OS of this ISO")
private Long osTypeId;
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=true, description="the URL to where the ISO is currently being hosted")

View File

@ -242,10 +242,17 @@ public class TemplateManagerImpl implements TemplateManager, Manager, TemplateSe
if (userId == null) {
userId = Long.valueOf(1);
}
if (bootable == null) {
bootable = Boolean.TRUE;
}
if ((guestOSId == null || guestOSId == 138L) && bootable == true){
throw new InvalidParameterValueException("Please pass a valid GuestOS Id");
}
if (bootable == false){
guestOSId = 138L; //Guest os id of None.
}
//removing support for file:// type urls (bug: 4239)
if(url.toLowerCase().contains("file://")){

View File

@ -163,6 +163,7 @@ INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (134, 3, '
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (135, 3, 'Oracle Enterprise Linux 5.5 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (136, 4, 'Red Hat Enterprise Linux 6.0 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (137, 4, 'Red Hat Enterprise Linux 6.0 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (138, 7, 'None');
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 4.5 (32-bit)', 1);