public GuestOSHypervisor updateGuestOsMapping(UpdateGuestOsMappingCmd cmd) {
Long id = cmd.getId();
String osNameForHypervisor = cmd.getOsNameForHypervisor();
//check if mapping exists
GuestOSHypervisor guestOsHypervisorHandle = _guestOSHypervisorDao.findById(id);
if (guestOsHypervisorHandle == null) {
throw new InvalidParameterValueException("Guest OS Mapping not found. Please specify a valid ID for the Guest OS Mapping");
}
if (!guestOsHypervisorHandle.getIsUserDefined()) {
throw new InvalidParameterValueException("Unable to modify system defined Guest OS mapping");
}
GuestOSHypervisorVO guestOsHypervisor = _guestOSHypervisorDao.createForUpdate(id);
guestOsHypervisor.setGuestOsName(osNameForHypervisor);