Package com.cloud.vm

Examples of com.cloud.vm.VirtualMachineProfile$Param


    @Override
    public boolean saveSSHPublicKeyToRouter(Network network, final NicProfile nic, VirtualMachineProfile profile, 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(Network network, VirtualRouter router) throws ResourceUnavailableException {
                // for basic zone, send vm data/password information only to the router in the same pod
                Commands cmds = new Commands(Command.OnError.Stop);
                NicVO nicVo = _nicDao.findById(nic.getId());
                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


            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

    public boolean applyUserData(Network network, final NicProfile nic, VirtualMachineProfile profile, DeployDestination dest, 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

            storage.setStorageProviderName(provider.getName());
            StoragePoolVO newStorage = storagePoolDao.persist(storage);
            newStorageId = newStorage.getId();

            DiskProfile profile = new DiskProfile(volume, diskOffering, HypervisorType.XenServer);
            VirtualMachineProfile vmProfile = Mockito.mock(VirtualMachineProfile.class);
            Mockito.when(
                    storageMgr.storagePoolHasEnoughSpace(Matchers.anyListOf(Volume.class),
                            Matchers.any(StoragePool.class))).thenReturn(true);
            DeploymentPlan plan = new DataCenterDeployment(dcId, podId, clusterId, null, null, null);
            int foundAcct = 0;
View Full Code Here

    @Test
    public void testClusterAllocator() {
        try {
            createDb();
            DiskProfile profile = new DiskProfile(volume, diskOffering, HypervisorType.XenServer);
            VirtualMachineProfile vmProfile = Mockito.mock(VirtualMachineProfile.class);
            Mockito.when(
                    storageMgr.storagePoolHasEnoughSpace(Matchers.anyListOf(Volume.class),
                            Matchers.any(StoragePool.class))).thenReturn(true);
            DeploymentPlan plan = new DataCenterDeployment(dcId, podId, clusterId, null, null, null);
            int foundAcct = 0;
View Full Code Here

            tags.add("high");
            diskOff.setTagsArray(tags);
            diskOfferingDao.update(diskOff.getId(), diskOff);

            DiskProfile profile = new DiskProfile(volume, diskOff, HypervisorType.XenServer);
            VirtualMachineProfile vmProfile = Mockito.mock(VirtualMachineProfile.class);
            Mockito.when(
                    storageMgr.storagePoolHasEnoughSpace(Matchers.anyListOf(Volume.class),
                            Matchers.any(StoragePool.class))).thenReturn(true);
            DeploymentPlan plan = new DataCenterDeployment(dcId, podId, clusterId, null, null, null);
            int foundAcct = 0;
View Full Code Here

            tags.add("low");
            diskOff.setTagsArray(tags);
            diskOfferingDao.update(diskOff.getId(), diskOff);

            DiskProfile profile = new DiskProfile(volume, diskOff, HypervisorType.XenServer);
            VirtualMachineProfile vmProfile = Mockito.mock(VirtualMachineProfile.class);
            Mockito.when(
                    storageMgr.storagePoolHasEnoughSpace(Matchers.anyListOf(Volume.class),
                            Matchers.any(StoragePool.class))).thenReturn(true);
            DeploymentPlan plan = new DataCenterDeployment(dcId, podId, clusterId, null, null, null);
            int foundAcct = 0;
View Full Code Here

            pool.setClusterId(null);
            pool.setPodId(null);
            storagePoolDao.update(pool.getId(), pool);

            DiskProfile profile = new DiskProfile(volume, diskOffering, HypervisorType.KVM);
            VirtualMachineProfile vmProfile = Mockito.mock(VirtualMachineProfile.class);
            Mockito.when(vmProfile.getHypervisorType()).thenReturn(HypervisorType.KVM);
            Mockito.when(
                    storageMgr.storagePoolHasEnoughSpace(Matchers.anyListOf(Volume.class),
                            Matchers.any(StoragePool.class))).thenReturn(true);
            Mockito.when(storageMgr.storagePoolHasEnoughIops(Matchers.anyListOf(Volume.class),
                    Matchers.any(StoragePool.class))).thenReturn(true);
View Full Code Here

            pool.setPodId(null);
            storagePoolDao.update(pool.getId(), pool);


            DiskProfile profile = new DiskProfile(volume, diskOffering, HypervisorType.KVM);
            VirtualMachineProfile vmProfile = Mockito.mock(VirtualMachineProfile.class);
            Account account = Mockito.mock(Account.class);
            Mockito.when(account.getAccountId()).thenReturn(1L);
            Mockito.when(vmProfile.getHypervisorType()).thenReturn(HypervisorType.KVM);
            Mockito.when(vmProfile.getOwner()).thenReturn(account);
            Mockito.when(
                    storageMgr.storagePoolHasEnoughSpace(Matchers.anyListOf(Volume.class),
                            Matchers.any(StoragePool.class))).thenReturn(true);
            Mockito.when(storageMgr.storagePoolHasEnoughIops(Matchers.anyListOf(Volume.class),
                    Matchers.any(StoragePool.class))).thenReturn(true);
View Full Code Here

            pool.setScope(ScopeType.ZONE);
            pool.setStatus(StoragePoolStatus.Maintenance);
            storagePoolDao.update(pool.getId(), pool);

            DiskProfile profile = new DiskProfile(volume, diskOffering, HypervisorType.XenServer);
            VirtualMachineProfile vmProfile = Mockito.mock(VirtualMachineProfile.class);
            Mockito.when(
                    storageMgr.storagePoolHasEnoughSpace(Matchers.anyListOf(Volume.class),
                            Matchers.any(StoragePool.class))).thenReturn(true);
            DeploymentPlan plan = new DataCenterDeployment(dcId, podId, clusterId, null, null, null);
            int foundAcct = 0;
View Full Code Here

TOP

Related Classes of com.cloud.vm.VirtualMachineProfile$Param

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.