mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-3806: OS Preference can not be set.
This commit is contained in:
parent
013f100078
commit
a782d17caa
@ -1274,23 +1274,29 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
|
||||
|
||||
if (guestOSCategoryId != null) {
|
||||
// Verify that the guest OS Category exists
|
||||
if (guestOSCategoryId > 0) {
|
||||
if (_guestOSCategoryDao.findById(guestOSCategoryId) == null) {
|
||||
throw new InvalidParameterValueException("Please specify a valid guest OS category.");
|
||||
}
|
||||
if (!(guestOSCategoryId > 0) || _guestOSCategoryDao.findById(guestOSCategoryId) == null) {
|
||||
throw new InvalidParameterValueException("Please specify a valid guest OS category.");
|
||||
}
|
||||
|
||||
GuestOSCategoryVO guestOSCategory = _guestOSCategoryDao.findById(guestOSCategoryId);
|
||||
Map<String, String> hostDetails = _hostDetailsDao.findDetails(hostId);
|
||||
DetailVO guestOSDetail = _hostDetailsDao.findDetail(hostId, "guest.os.category.id");
|
||||
|
||||
if (guestOSCategory != null) {
|
||||
// Save a new entry for guest.os.category.id
|
||||
hostDetails.put("guest.os.category.id", String.valueOf(guestOSCategory.getId()));
|
||||
if (guestOSCategory != null && !GuestOSCategoryVO.CATEGORY_NONE.equalsIgnoreCase(guestOSCategory.getName())) {
|
||||
// Create/Update an entry for guest.os.category.id
|
||||
if (guestOSDetail != null) {
|
||||
guestOSDetail.setValue(String.valueOf(guestOSCategory.getId()));
|
||||
_hostDetailsDao.update(guestOSDetail.getId(), guestOSDetail);
|
||||
} else {
|
||||
Map<String, String> detail = new HashMap<String, String>();
|
||||
detail.put("guest.os.category.id", String.valueOf(guestOSCategory.getId()));
|
||||
_hostDetailsDao.persist(hostId, detail);
|
||||
}
|
||||
} else {
|
||||
// Delete any existing entry for guest.os.category.id
|
||||
hostDetails.remove("guest.os.category.id");
|
||||
if (guestOSDetail != null) {
|
||||
_hostDetailsDao.remove(guestOSDetail.getId());
|
||||
}
|
||||
}
|
||||
_hostDetailsDao.persist(hostId, hostDetails);
|
||||
}
|
||||
|
||||
List<String> hostTags = cmd.getHostTags();
|
||||
|
||||
@ -14252,7 +14252,7 @@
|
||||
var oscategoryObjs = json.listoscategoriesresponse.oscategory;
|
||||
var items = [{
|
||||
id: '',
|
||||
description: _l('label.none')
|
||||
description: _l('')
|
||||
}];
|
||||
$(oscategoryObjs).each(function() {
|
||||
items.push({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user