private static CreateImageFromVmResponse checkCreateImageResponse(CreateImageFromVmResponse createImageFromVmResponse) throws RpcException {
  logger.info("Checking {}",createImageFromVmResponse);
switch (createImageFromVmResponse.getResult()) {
case OK:
    break;
case INVALID_VM_POWER_STATE:
  throw new InvalidVmPowerStateException(createImageFromVmResponse.getError());
case IMAGE_ALREADY_EXIST:
throw new ImageAlreadyExistException(createImageFromVmResponse.getError());
case VM_NOT_FOUND:
throw new VmNotFoundException(createImageFromVmResponse.getError());
case SYSTEM_ERROR:
throw new SystemErrorException(createImageFromVmResponse.getError());
default :
throw new RpcException(String.format("Unknown result: %s",createImageFromVmResponse.getResult()));
}
return createImageFromVmResponse;
}

private static CreateImageFromVmResponse checkCreateImageResponse ( CreateImageFromVmResponse createImageFromVmResponse ) throws RpcException { logger . info ( "Checking {}" , createImageFromVmResponse ) ; switch ( createImageFromVmResponse . getResult ( ) ) { case OK : break ; case INVALID_VM_POWER_STATE : throw new InvalidVmPowerStateException ( createImageFromVmResponse . getError ( ) ) ; case IMAGE_ALREADY_EXIST : throw new ImageAlreadyExistException ( createImageFromVmResponse . getError ( ) ) ; case VM_NOT_FOUND : throw new VmNotFoundException ( createImageFromVmResponse . getError ( ) ) ; case SYSTEM_ERROR : throw new SystemErrorException ( createImageFromVmResponse . getError ( ) ) ; default : throw new RpcException ( String . format ( "Unknown result: %s" , createImageFromVmResponse . getResult ( ) ) ) ; } return createImageFromVmResponse ; }
this method validates a createimagefromvmresponse object , raising an exception if the response reflects an operation failure .
