Package com.cloud.uservm

Examples of com.cloud.uservm.UserVm


    public void testConnectivity() {
        Network network = lookupTestNetwork("test");
        if (network == null) {
            network = createTestNetwork("test");
        }
        UserVm vm1 = _server.createVM("x01", network);
        UserVm vm2 = _server.createVM("x02", network);

        _server.deleteVM(vm1, network);
        _server.deleteVM(vm2, network);
    }
View Full Code Here


    public void floatingIpTest() {
        Network network = lookupTestNetwork("test-fip-net");
        if (network == null) {
            network = createTestNetwork("test-fip-net");
        }
        UserVm vm = _server.createVM("test-fip-vm", network);
        try {
            IPAddressVO ip = createFloatingIp(network, vm);
            deleteFloatingIp(ip);
        } catch (Exception e) {
            fail("unable to create/delete floating ip");
View Full Code Here

    public void dbSyncTest() {
        Network network = lookupTestNetwork("test-db-only-net");
        if (network == null) {
            network = createTestNetwork("test-db-only-net");
        }
        UserVm vm = _server.createVM("test-db-only-vm", network);
        try {
            createFloatingIp(network, vm);
        } catch (Exception e) {
            fail("unable to create floating ip");
        }
View Full Code Here

        return s_name;
    }

    @Override
    public long getEntityOwnerId() {
        UserVm vm = _responseGenerator.findUserVmById(getId());
        if (vm != null) {
            return vm.getAccountId();
        }

        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
    }
View Full Code Here

    }

    @Override
    public void execute() throws ResourceUnavailableException, ConcurrentOperationException{
        UserContext.current().setEventDetails("Vm Id: "+getId());
        UserVm result = _userVmService.destroyVm(this);

        UserVmResponse response = new UserVmResponse();
        if (result != null) {
            List<UserVmResponse> responses =  _responseGenerator.createUserVmResponse("virtualmachine", result);
            if (responses != null && !responses.isEmpty()) {
View Full Code Here

        Set<Long> vmIdSet = userVmDataHash.keySet();
        List<UserVmJoinVO> uvms = searchByIds(vmIdSet.toArray(new Long[vmIdSet.size()]));
        // populate transit password field from UserVm
        if ( uvms != null ){
            for (UserVmJoinVO uvm : uvms){
                UserVm v = userVmDataHash.get(uvm.getId());
                uvm.setPassword(v.getPassword());
            }
        }
        return uvms;
    }
View Full Code Here

        return AsyncJob.Type.VirtualMachine;
    }

    @Override
    public void execute(){
        UserVm result;

        if (getStartVm()) {
            try {
                UserContext.current().setEventDetails("Vm Id: "+getEntityId());
                result = _userVmService.startVirtualMachine(this);
View Full Code Here

                if (diskOffering != null && diskOffering.getUseLocalStorage()) {
                    throw new InvalidParameterValueException("Zone is not configured to use local storage but disk offering " + diskOffering.getName() + " uses it");
                }
            }

            UserVm vm = null;
          IpAddresses addrs = new IpAddresses(ipAddress, getIp6Address());
            if (zone.getNetworkType() == NetworkType.Basic) {
                if (getNetworkIds() != null) {
                    throw new InvalidParameterValueException("Can't specify network Ids in Basic zone");
                } else {
                    vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name,
                            displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
                }
            } else {
                if (zone.isSecurityGroupEnabled())  {
                    vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(),
                            owner, name, displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());

                } else {
                    if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) {
                        throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone");
                    }
                    vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName,
                            diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());

                }
            }

            if (vm != null) {
                setEntityId(vm.getId());
                setEntityUuid(vm.getUuid());
            } else {
                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm");
            }
        } catch (InsufficientCapacityException ex) {
            s_logger.info(ex);
View Full Code Here

    @Override
    public boolean volumeInactive(Volume volume) {
        Long vmId = volume.getInstanceId();
        if (vmId != null) {
            UserVm vm = _userVmDao.findById(vmId);
            if (vm == null) {
                return true;
            }
            State state = vm.getState();
            if (state.equals(State.Stopped) || state.equals(State.Destroyed)) {
                return true;
            }
        }
        return false;
View Full Code Here

        vmSnapshotResponse.setName(vmSnapshot.getName());
        vmSnapshotResponse.setState(vmSnapshot.getState());
        vmSnapshotResponse.setCreated(vmSnapshot.getCreated());
        vmSnapshotResponse.setDescription(vmSnapshot.getDescription());
        vmSnapshotResponse.setDisplayName(vmSnapshot.getDisplayName());
        UserVm vm = ApiDBUtils.findUserVmById(vmSnapshot.getVmId());
        if (vm != null) {
            vmSnapshotResponse.setVirtualMachineid(vm.getUuid());
        }
        if (vmSnapshot.getParent() != null) {
            vmSnapshotResponse.setParentName(ApiDBUtils.getVMSnapshotById(vmSnapshot.getParent()).getDisplayName());
        }
        vmSnapshotResponse.setCurrent(vmSnapshot.getCurrent());
View Full Code Here

TOP

Related Classes of com.cloud.uservm.UserVm

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.