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) {
|
if (guestOSCategoryId != null) {
|
||||||
// Verify that the guest OS Category exists
|
// Verify that the guest OS Category exists
|
||||||
if (guestOSCategoryId > 0) {
|
if (!(guestOSCategoryId > 0) || _guestOSCategoryDao.findById(guestOSCategoryId) == null) {
|
||||||
if (_guestOSCategoryDao.findById(guestOSCategoryId) == null) {
|
|
||||||
throw new InvalidParameterValueException("Please specify a valid guest OS category.");
|
throw new InvalidParameterValueException("Please specify a valid guest OS category.");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
GuestOSCategoryVO guestOSCategory = _guestOSCategoryDao.findById(guestOSCategoryId);
|
GuestOSCategoryVO guestOSCategory = _guestOSCategoryDao.findById(guestOSCategoryId);
|
||||||
Map<String, String> hostDetails = _hostDetailsDao.findDetails(hostId);
|
DetailVO guestOSDetail = _hostDetailsDao.findDetail(hostId, "guest.os.category.id");
|
||||||
|
|
||||||
if (guestOSCategory != null) {
|
if (guestOSCategory != null && !GuestOSCategoryVO.CATEGORY_NONE.equalsIgnoreCase(guestOSCategory.getName())) {
|
||||||
// Save a new entry for guest.os.category.id
|
// Create/Update an entry for guest.os.category.id
|
||||||
hostDetails.put("guest.os.category.id", String.valueOf(guestOSCategory.getId()));
|
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 {
|
} else {
|
||||||
// Delete any existing entry for guest.os.category.id
|
// 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();
|
List<String> hostTags = cmd.getHostTags();
|
||||||
|
|||||||
@ -14252,7 +14252,7 @@
|
|||||||
var oscategoryObjs = json.listoscategoriesresponse.oscategory;
|
var oscategoryObjs = json.listoscategoriesresponse.oscategory;
|
||||||
var items = [{
|
var items = [{
|
||||||
id: '',
|
id: '',
|
||||||
description: _l('label.none')
|
description: _l('')
|
||||||
}];
|
}];
|
||||||
$(oscategoryObjs).each(function() {
|
$(oscategoryObjs).each(function() {
|
||||||
items.push({
|
items.push({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user