Examples of UserVmResponse


Examples of org.apache.cloudstack.api.response.UserVmResponse

    @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(ApiErrorCode.INTERNAL_ERROR, "Failed to detach iso");
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.api.response.UserVmResponse

            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(ApiErrorCode.INTERNAL_ERROR, "Failed to restore vm " + getVmId());
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.api.response.UserVmResponse

        UserContext.current().setEventDetails("Vm Id: " + getId());
        UserVm result = _userVmService.resetVMSSHKey(this);

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

Examples of org.apache.cloudstack.api.response.UserVmResponse

            throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
        }

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

Examples of org.apache.cloudstack.api.response.UserVmResponse

        } 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(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm");
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.api.response.UserVmResponse

        UserContext.current().setEventDetails("Vm Id: "+getId());
        UserVm result;
        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(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot vm instance");
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.api.response.UserVmResponse

    public void execute() throws ResourceUnavailableException,
            InsufficientCapacityException, ServerApiException {
        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(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm");
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.api.response.UserVmResponse

        UserVm result = _userVmService.removeNicFromVirtualMachine(this);
        ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
        dc.add(VMDetails.valueOf("nics"));
        EnumSet<VMDetails> details = EnumSet.copyOf(dc);
        if (result != null){
            UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", details, result).get(0);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove NIC from vm, see error log for details");
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.api.response.UserVmResponse

            UserVm result ;
            result = _userVmService.startVirtualMachine(this);

            if (result != null) {
                UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
                response.setResponseName(getCommandName());
                this.setResponseObject(response);
            } else {
                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start a vm");
            }
        } catch (ConcurrentOperationException ex) {
View Full Code Here

Examples of org.apache.cloudstack.api.response.UserVmResponse

        UserVm result;

        result = _userVmService.stopVirtualMachine(getId(), isForced());

        if (result != null) {
            UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop vm");
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.