private static CreateVmResponse checkCreateVmResponse(CreateVmResponse createVmResponse) throws RpcException {
  logger.info("Checking {}",createVmResponse);
switch (createVmResponse.getResult()) {
case OK:
    break;
case DISK_NOT_FOUND:
  throw new DiskNotFoundException(createVmResponse.getError());
case IMAGE_NOT_FOUND:
throw new ImageNotFoundException(createVmResponse.getError());
case INVALID_RESERVATION:
throw new InvalidReservationException(createVmResponse.getError());
case NETWORK_NOT_FOUND:
throw new NetworkNotFoundException(createVmResponse.getError());
case SYSTEM_ERROR:
throw new SystemErrorException(createVmResponse.getError());
default :
throw new RpcException(String.format("Unknown result: %s",createVmResponse.getResult()));
}
return createVmResponse;
}

private static CreateVmResponse checkCreateVmResponse ( CreateVmResponse createVmResponse ) throws RpcException { logger . info ( "Checking {}" , createVmResponse ) ; switch ( createVmResponse . getResult ( ) ) { case OK : break ; case DISK_NOT_FOUND : throw new DiskNotFoundException ( createVmResponse . getError ( ) ) ; case IMAGE_NOT_FOUND : throw new ImageNotFoundException ( createVmResponse . getError ( ) ) ; case INVALID_RESERVATION : throw new InvalidReservationException ( createVmResponse . getError ( ) ) ; case NETWORK_NOT_FOUND : throw new NetworkNotFoundException ( createVmResponse . getError ( ) ) ; case SYSTEM_ERROR : throw new SystemErrorException ( createVmResponse . getError ( ) ) ; default : throw new RpcException ( String . format ( "Unknown result: %s" , createVmResponse . getResult ( ) ) ) ; } return createVmResponse ; }
this method validates a createvmresponse object , raising an exception if the response reflects an operation failure .
