Package com.cloud.api.response

Examples of com.cloud.api.response.UserVmResponse


        } else {
          result = _userVmService.destroyVm(this);
        }
       
        if (result != null) {
            UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
            response.setResponseName("virtualmachine");
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to destroy vm");
        }
    }
View Full Code Here


      UserContext.current().setEventDetails("Vm Id: " +getVirtualMachineId()+ " ISO Id: "+getId());
        boolean result = _templateService.attachIso(id, virtualMachineId);
        if (result) {
            UserVm userVm = _responseGenerator.findUserVmById(virtualMachineId);
            if (userVm != null) {
                UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", userVm).get(0);           
                response.setResponseName(DeployVMCmd.getResultObjectName());          
                this.setResponseObject(response);
            } else {
                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach iso");
            }
        } else {
View Full Code Here

          ResourceAllocationException {
    UserVm result;
    UserContext.current().setEventDetails("Vm Id: " + getVmId());
    result = _userVmService.restoreVM(this);
    if (result != null) {
            UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
    } else {
      throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to restore vm " + getVmId());
    }
  }
View Full Code Here

    public void execute() throws ResourceUnavailableException, InsufficientCapacityException{
        password = _mgr.generateRandomPassword();
        UserContext.current().setEventDetails("Vm Id: "+getId());
        UserVm result = _userVmService.resetVMPassword(this, password);
        if (result != null){
            UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reset vm password");
        }
    }
View Full Code Here

    @Override
    public void execute(){
        boolean result = _templateService.detachIso(virtualMachineId);
        if (result) {
            UserVm userVm = _entityMgr.findById(UserVm.class, virtualMachineId);        
            UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", userVm).get(0);           
            response.setResponseName(DeployVMCmd.getResultObjectName());          
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to detach iso");
        }
    }
View Full Code Here

        } else {
            result = _userVmService.getUserVm(getEntityId());
        }
       
        if (result != null) {
            UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to deploy vm");
        }
    }
View Full Code Here

   
    @Override
    public void execute() throws ResourceAllocationException{
        UserVm result = _userVmService.recoverVirtualMachine(this);
        if (result != null){
            UserVmResponse recoverVmResponse = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
            recoverVmResponse.setResponseName(getCommandName());
            this.setResponseObject(recoverVmResponse);
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to recover vm");
        }
      
View Full Code Here

        } else {
          result = _userVmService.rebootVirtualMachine(this);
        }
       
        if (result !=null){
            UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reboot vm instance");
        }
    }
View Full Code Here

    @Override
    public void execute(){
        UserContext.current().setEventDetails("Vm Id: "+getId());
        UserVm result = _userVmService.updateVirtualMachine(this);
        if (result != null){
            UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update vm");
        }
    }
View Full Code Here

            migratedVm = _userVmService.migrateVirtualMachine(getVirtualMachineId(), destinationHost);
          } else if (getStoragePoolId() != null) {
            migratedVm = _userVmService.vmStorageMigration(getVirtualMachineId(), destStoragePool);
          }
          if (migratedVm != null) {
                UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", (UserVm)migratedVm).get(0);
                response.setResponseName(getCommandName());
                this.setResponseObject(response);
          } else {
              throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate vm");
          }
        } catch (ResourceUnavailableException ex) {
View Full Code Here

TOP

Related Classes of com.cloud.api.response.UserVmResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.