diff --git a/api/src/com/cloud/storage/GuestOsCategory.java b/api/src/com/cloud/storage/GuestOsCategory.java index 96123e47108..42320d9eec8 100644 --- a/api/src/com/cloud/storage/GuestOsCategory.java +++ b/api/src/com/cloud/storage/GuestOsCategory.java @@ -17,6 +17,8 @@ package com.cloud.storage; public interface GuestOsCategory { + // Used by OS preference, 'None' for no OS preference + public static final String CATEGORY_NONE ="None"; long getId(); String getName(); diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index 7dbf63facfc..14143706bb2 100755 --- a/server/src/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/com/cloud/resource/ResourceManagerImpl.java @@ -1211,7 +1211,7 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma GuestOSCategoryVO guestOSCategory = _guestOSCategoryDao.findById(guestOSCategoryId); Map hostDetails = _hostDetailsDao.findDetails(hostId); - if (guestOSCategory != null) { + if (guestOSCategory != null && !GuestOSCategoryVO.CATEGORY_NONE.equalsIgnoreCase(guestOSCategory.getName())) { // Save a new entry for guest.os.category.id hostDetails.put("guest.os.category.id", String.valueOf(guestOSCategory.getId())); } else { diff --git a/setup/db/db/schema-302to40.sql b/setup/db/db/schema-302to40.sql index aaf23e6bf9a..d1a5ea95125 100644 --- a/setup/db/db/schema-302to40.sql +++ b/setup/db/db/schema-302to40.sql @@ -466,3 +466,5 @@ UPDATE `cloud`.`configuration` SET description='Comma separated list of cidrs in INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server', 'site2site.vpn.vpngateway.connection.limit', '4', 'The maximum number of VPN connection per VPN gateway'); INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server', 'site2site.vpn.customergateway.subnets.limit', '10', 'The maximum number of subnets per customer gateway'); + +INSERT IGNORE INTO `cloud`.`guest_os_category` VALUES ('11','None',NULL); diff --git a/setup/db/templates.sql b/setup/db/templates.sql index 3034c7f187b..0c85be47a5f 100755 --- a/setup/db/templates.sql +++ b/setup/db/templates.sql @@ -48,7 +48,7 @@ INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (7, 'Other'); INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (8, 'Novel'); INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (9, 'Unix'); INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (10, 'Ubuntu'); - +INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (11, 'None'); INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (1, 1, 'CentOS 4.5 (32-bit)'); INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (2, 1, 'CentOS 4.6 (32-bit)'); diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 2a4cf5f5dc5..3bf43d30f03 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -7635,7 +7635,7 @@ var array1 = []; array1.push("&hosttags=" + todb(args.data.hosttags)); - if (args.data.oscategoryid != null && args.data.oscategoryid != 'None') + if (args.data.oscategoryid != null) array1.push("&osCategoryId=" + args.data.oscategoryid); $.ajax({ @@ -7852,11 +7852,12 @@ async: true, success: function(json) { var oscategoryObjs = json.listoscategoriesresponse.oscategory; - var items = [ - { id: null, description: _l('label.none') } - ]; + var items = []; $(oscategoryObjs).each(function() { - items.push({id: this.id, description: this.name}); + if(this.name == 'None') + items.unshift({ id: this.id, description: _l('label.none') }); + else + items.push({id: this.id, description: this.name}); }); args.response.success({data: items}); }