use of com.cloud.storage.GuestOSHypervisor in project cloudstack by apache.
the class AddGuestOsMappingCmd method create.
@Override
public void create() {
GuestOSHypervisor guestOsMapping = _mgr.addGuestOsMapping(this);
if (guestOsMapping != null) {
setEntityId(guestOsMapping.getId());
setEntityUuid(guestOsMapping.getUuid());
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add guest OS mapping entity");
}
}
use of com.cloud.storage.GuestOSHypervisor in project cloudstack by apache.
the class ManagementServerImpl method removeGuestOsMapping.
@Override
@DB
@ActionEvent(eventType = EventTypes.EVENT_GUEST_OS_MAPPING_REMOVE, eventDescription = "removing guest OS mapping", async = true)
public boolean removeGuestOsMapping(final RemoveGuestOsMappingCmd cmd) {
final Long id = cmd.getId();
//check if mapping exists
final 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 remove system defined Guest OS mapping");
}
return _guestOSHypervisorDao.removeGuestOsMapping(id);
}
use of com.cloud.storage.GuestOSHypervisor in project cloudstack by apache.
the class UpdateGuestOsMappingCmd method execute.
@Override
public void execute() {
GuestOSHypervisor guestOsMapping = _mgr.updateGuestOsMapping(this);
if (guestOsMapping != null) {
GuestOsMappingResponse response = _responseGenerator.createGuestOSMappingResponse(guestOsMapping);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update guest OS mapping");
}
}
use of com.cloud.storage.GuestOSHypervisor in project cloudstack by apache.
the class AddGuestOsMappingCmd method execute.
@Override
public void execute() {
GuestOSHypervisor guestOsMapping = _mgr.getAddedGuestOsMapping(getEntityId());
if (guestOsMapping != null) {
GuestOsMappingResponse response = _responseGenerator.createGuestOSMappingResponse(guestOsMapping);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add guest OS mapping");
}
}
use of com.cloud.storage.GuestOSHypervisor in project cloudstack by apache.
the class ListGuestOsMappingCmd method execute.
@Override
public void execute() {
Pair<List<? extends GuestOSHypervisor>, Integer> result = _mgr.listGuestOSMappingByCriteria(this);
ListResponse<GuestOsMappingResponse> response = new ListResponse<GuestOsMappingResponse>();
List<GuestOsMappingResponse> osMappingResponses = new ArrayList<GuestOsMappingResponse>();
for (GuestOSHypervisor guestOSHypervisor : result.first()) {
GuestOsMappingResponse guestOsMappingResponse = _responseGenerator.createGuestOSMappingResponse(guestOSHypervisor);
osMappingResponses.add(guestOsMappingResponse);
}
response.setResponses(osMappingResponses, result.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
Aggregations