Skip to content

Commit e901ccf

Browse files
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
1 parent 0db879d commit e901ccf

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎api/src/com/cloud/api/commands/RegisterIsoCmd.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class RegisterIsoCmd extends BaseCmd {
5454
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the ISO")
5555
private String isoName;
5656

57-
@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")
57+
@Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.LONG, description="the ID of the OS Type that best represents the OS of this ISO")
5858
private Long osTypeId;
5959

6060
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=true, description="the URL to where the ISO is currently being hosted")

‎server/src/com/cloud/template/TemplateManagerImpl.java‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,17 @@ public VirtualMachineTemplate registerIso(RegisterIsoCmd cmd) throws ResourceAll
242242
if (userId == null) {
243243
userId = Long.valueOf(1);
244244
}
245-
245+
246246
if (bootable == null) {
247247
bootable = Boolean.TRUE;
248248
}
249+
250+
if ((guestOSId == null || guestOSId == 138L) && bootable == true){
251+
throw new InvalidParameterValueException("Please pass a valid GuestOS Id");
252+
}
253+
if (bootable == false){
254+
guestOSId = 138L; //Guest os id of None.
255+
}
249256

250257
//removing support for file:// type urls (bug: 4239)
251258
if(url.toLowerCase().contains("file://")){

‎setup/db/templates.sql‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (134, 3, '
163163
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (135, 3, 'Oracle Enterprise Linux 5.5 (64-bit)');
164164
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (136, 4, 'Red Hat Enterprise Linux 6.0 (32-bit)');
165165
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (137, 4, 'Red Hat Enterprise Linux 6.0 (64-bit)');
166+
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (138, 7, 'None');
166167

167168

168169
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 4.5 (32-bit)', 1);

0 commit comments

Comments
 (0)