Examples of VirtualMachineProfile


Examples of com.cloud.vm.VirtualMachineProfile

    @InjectMocks
    private ElasticLoadBalancerManagerImpl elasticLoadBalancerManagerImpl;

    @Test
    public void testFinalizeStartWhenCmdsAnswerIsNull() throws Exception {
        VirtualMachineProfile profileMock = mock(VirtualMachineProfile.class);
        long hostId = 1L;
        Commands cmds = mock(Commands.class);
        when(cmds.getAnswer("checkSsh")).thenReturn(null);
        ReservationContext context = mock(ReservationContext.class);
View Full Code Here

Examples of com.cloud.vm.VirtualMachineProfile

    @Test
    public void testFinalizeStartWhenCmdsAnswerIsNotNullButAnswerResultIsFalse() throws Exception {
        CheckSshAnswer answerMock = mock(CheckSshAnswer.class);
        when(answerMock.getResult()).thenReturn(false);
        VirtualMachineProfile profileMock = mock(VirtualMachineProfile.class);
        long hostId = 1L;
        Commands cmds = mock(Commands.class);
        when(cmds.getAnswer("checkSsh")).thenReturn(answerMock);
        ReservationContext context = mock(ReservationContext.class);
View Full Code Here

Examples of com.cloud.vm.VirtualMachineProfile

    @Test
    public void testFinalizeStartWhenCmdsAnswerIsNotNullAndAnswerResultIsTrue() throws Exception {
        CheckSshAnswer answerMock = mock(CheckSshAnswer.class);
        when(answerMock.getResult()).thenReturn(true);
        VirtualMachineProfile profileMock = mock(VirtualMachineProfile.class);
        long hostId = 1L;
        Commands cmds = mock(Commands.class);
        when(cmds.getAnswer("checkSsh")).thenReturn(answerMock);
        ReservationContext context = mock(ReservationContext.class);
View Full Code Here

Examples of com.cloud.vm.VirtualMachineProfile

    @Override
    public boolean savePasswordToRouter(final Network network, final NicProfile nic, final VirtualMachineProfile profile, final List<? extends VirtualRouter> routers)
            throws ResourceUnavailableException {
        _userVmDao.loadDetails((UserVmVO)profile.getVirtualMachine());

        final VirtualMachineProfile updatedProfile = profile;

        return applyRules(network, routers, "save password entry", false, null, false, new RuleApplier() {
            @Override
            public boolean execute(final Network network, final VirtualRouter router) throws ResourceUnavailableException {
                // for basic zone, send vm data/password information only to the router in the same pod
View Full Code Here

Examples of com.cloud.vm.VirtualMachineProfile

                canMigrateWithStorage = capabilities.isStorageMotionSupported();
            }
        }

        // Check if the vm is using any disks on local storage.
        VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(vm);
        List<VolumeVO> volumes = _volumeDao.findCreatedByInstance(vmProfile.getId());
        boolean usesLocal = false;
        for (VolumeVO volume : volumes) {
            DiskOfferingVO diskOffering = _diskOfferingDao.findById(volume.getDiskOfferingId());
            DiskProfile diskProfile = new DiskProfile(volume, diskOffering, vmProfile.getHypervisorType());
            if (diskProfile.useLocalStorage()) {
                usesLocal = true;
                break;
            }
        }
View Full Code Here

Examples of com.cloud.vm.VirtualMachineProfile

        ExcludeList avoid = new ExcludeList();
        avoid.addPool(srcVolumePool.getId());

        // Volume stays in the same cluster after migration.
        DataCenterDeployment plan = new DataCenterDeployment(volume.getDataCenterId(), srcVolumePool.getPodId(), srcVolumePool.getClusterId(), null, null, null);
        VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);

        DiskOfferingVO diskOffering = _diskOfferingDao.findById(volume.getDiskOfferingId());
        DiskProfile diskProfile = new DiskProfile(volume, diskOffering, profile.getHypervisorType());

        // Call the storage pool allocator to find the list of storage pools.
        for (StoragePoolAllocator allocator : _storagePoolAllocators) {
            List<StoragePool> pools = allocator.allocateToPool(diskProfile, profile, plan, avoid, StoragePoolAllocator.RETURN_UPTO_ALL);
            if (pools != null && !pools.isEmpty()) {
View Full Code Here

Examples of com.cloud.vm.VirtualMachineProfile

    public boolean saveSSHPublicKeyToRouter(final Network network, final NicProfile nic, final VirtualMachineProfile profile, final List<? extends VirtualRouter> routers,
            final String sshPublicKey) throws ResourceUnavailableException {
        final UserVmVO vm = _userVmDao.findById(profile.getVirtualMachine().getId());
        _userVmDao.loadDetails(vm);

        final VirtualMachineProfile updatedProfile = profile;

        return applyRules(network, routers, "save SSHkey entry", false, null, false, new RuleApplier() {
            @Override
            public boolean execute(final Network network, final VirtualRouter router) throws ResourceUnavailableException {
                // for basic zone, send vm data/password information only to the router in the same pod
                final Commands cmds = new Commands(Command.OnError.Stop);
                final NicVO nicVo = _nicDao.findById(nic.getId());
                final VMTemplateVO template = _templateDao.findByIdIncludingRemoved(updatedProfile.getTemplateId());
                if (template != null && template.getEnablePassword()) {
                    createPasswordCommand(router, updatedProfile, nicVo, cmds);
                }
                createVmDataCommand(router, vm, nicVo, sshPublicKey, cmds);
                return sendCommandsToRouter(router, cmds);
View Full Code Here

Examples of com.cloud.vm.VirtualMachineProfile

            s_logger.trace("applyDhcpEntry(" + network.getCidr() + ", " + nic.getMacAddress() + ", " + profile.getUuid() + ", " + dest.getHost() + ", " + routers + ")");
        }
        final UserVmVO vm = _userVmDao.findById(profile.getId());
        _userVmDao.loadDetails(vm);

        final VirtualMachineProfile updatedProfile = profile;
        final boolean isZoneBasic = (dest.getDataCenter().getNetworkType() == NetworkType.Basic);
        final Long podId = isZoneBasic ? dest.getPod().getId() : null;

        boolean podLevelException = false;
        //for user vm in Basic zone we should try to re-deploy vm in a diff pod if it fails to deploy in original pod; so throwing exception with Pod scope
        if (isZoneBasic && podId != null && updatedProfile.getVirtualMachine().getType() == VirtualMachine.Type.User && network.getTrafficType() == TrafficType.Guest &&
                network.getGuestType() == Network.GuestType.Shared) {
            podLevelException = true;
        }

        return applyRules(network, routers, "dhcp entry", podLevelException, podId, true, new RuleApplier() {
View Full Code Here

Examples of com.cloud.vm.VirtualMachineProfile

    public boolean applyUserData(final Network network, final NicProfile nic, final VirtualMachineProfile profile, final DeployDestination dest, final List<DomainRouterVO> routers)
            throws ResourceUnavailableException {
        final UserVmVO vm = _userVmDao.findById(profile.getId());
        _userVmDao.loadDetails(vm);

        final VirtualMachineProfile updatedProfile = profile;
        final boolean isZoneBasic = (dest.getDataCenter().getNetworkType() == NetworkType.Basic);
        final Long podId = isZoneBasic ? dest.getPod().getId() : null;

        boolean podLevelException = false;
        //for user vm in Basic zone we should try to re-deploy vm in a diff pod if it fails to deploy in original pod; so throwing exception with Pod scope
        if (isZoneBasic && podId != null && updatedProfile.getVirtualMachine().getType() == VirtualMachine.Type.User && network.getTrafficType() == TrafficType.Guest &&
                network.getGuestType() == Network.GuestType.Shared) {
            podLevelException = true;
        }

        return applyRules(network, routers, "userdata and password entry", podLevelException, podId, false, new RuleApplier() {
View Full Code Here

Examples of com.cloud.vm.VirtualMachineProfile

            if (cluster != null) {
                podId = cluster.getPodId();
            }
        }

        VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
        for (StoragePoolAllocator allocator : _storagePoolAllocators) {

            ExcludeList avoidList = new ExcludeList();
            for (StoragePool pool : avoid) {
                avoidList.addPool(pool.getId());
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.