Package com.cloud.vm

Examples of com.cloud.vm.ReservationContext


    public void rollbackNicForMigration(VirtualMachineProfile src, VirtualMachineProfile dst) {
        for (NicProfile nicDst : dst.getNics()) {
            NetworkVO network = _networksDao.findById(nicDst.getNetworkId());
            NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, network.getGuruName());
            NicProfile nicSrc = findNicProfileById(src, nicDst.getId());
            ReservationContext src_context = new ReservationContextImpl(nicSrc.getReservationId(), null, null);
            ReservationContext dst_context = new ReservationContextImpl(nicDst.getReservationId(), null, null);

            if (guru instanceof NetworkMigrationResponder) {
                ((NetworkMigrationResponder)guru).rollbackMigration(nicDst, network, dst, src_context, dst_context);
            }
            List<Provider> providersToImplement = getNetworkProviders(network.getId());
View Full Code Here


        NetworkVO network = _networksDao.findById(networkId);

        s_logger.debug("Restarting network " + networkId + "...");

        ReservationContext context = new ReservationContextImpl(null, null, callerUser, callerAccount);

        if (cleanup) {
            // shutdown the network
            s_logger.debug("Shutting down the network id=" + networkId + " as a part of network restart");
View Full Code Here

        //delete the domain shared networks
        boolean networksDeleted = true;
        s_logger.debug("Deleting networks for domain id=" + domainId);
        List<Long> networkIds = _networkDomainDao.listNetworkIdsByDomain(domainId);
        CallContext ctx = CallContext.current();
        ReservationContext context = new ReservationContextImpl(null, null, _accountMgr.getActiveUser(ctx.getCallingUserId()), ctx.getCallingAccount());
        for (Long networkId : networkIds) {
            s_logger.debug("Deleting network id=" + networkId + " as a part of domain id=" + domainId + " cleanup");
            if (!_networkMgr.destroyNetwork(networkId, context, false)) {
                s_logger.warn("Unable to destroy network id=" + networkId + " as a part of domain id=" + domainId + " cleanup.");
                networksDeleted = false;
View Full Code Here

        Domain dom = mock(Domain.class);
        when(dom.getName()).thenReturn("d1");
        Account acc = mock(Account.class);
        when(acc.getAccountName()).thenReturn("a1");
        ReservationContext context = mock(ReservationContext.class);
        when(context.getDomain()).thenReturn(dom);
        when(context.getAccount()).thenReturn(acc);

        DataCenter dc = mock(DataCenter.class);
        when(dc.getNetworkType()).thenReturn(NetworkType.Advanced);
        when(_entityMgr.findById(DataCenter.class, network.getDataCenterId())).thenReturn(dc);
View Full Code Here

        when(network.getId()).thenReturn(1L);
        when(network.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Vlan);
        when(network.getDataCenterId()).thenReturn(1L);
        when(network.getBroadcastUri()).thenReturn(uri);

        ReservationContext context = mock(ReservationContext.class);

        when(_networkAsa1000vMapDao.findByNetworkId(network.getId())).thenReturn(mock(NetworkAsa1000vMapVO.class));

        List<CiscoVnmcControllerVO> devices = new ArrayList<CiscoVnmcControllerVO>();
        devices.add(mock(CiscoVnmcControllerVO.class));
View Full Code Here

            DataCenter zone = _dcDao.findById(zoneId);
            DeployDestination dest = new DeployDestination(zone, null, null, null);
            Account callerAccount = CallContext.current().getCallingAccount();
            UserVO callerUser = _userDao.findById(CallContext.current().getCallingUserId());
            Journal journal = new Journal.LogJournal("Implementing " + guestNetwork, s_logger);
            ReservationContext context = new ReservationContextImpl(UUID.randomUUID().toString(), journal, callerUser, callerAccount);
            s_logger.debug("Implementing network " + guestNetwork + " as a part of network provision for persistent network");
            try {
                Pair<? extends NetworkGuru, ? extends Network> implementedNetwork = _networkMgr.implementNetwork(guestNetwork.getId(), dest, context);
                if (implementedNetwork.first() == null) {
                    s_logger.warn("Failed to implement the network " + guestNetwork);
View Full Code Here

            s_logger.debug("Deleting networks for account " + account.getId());
            List<NetworkVO> networks = _networkDao.listByOwner(accountId);
            if (networks != null) {
                for (NetworkVO network : networks) {

                    ReservationContext context = new ReservationContextImpl(null, null, getActiveUser(callerUserId), caller);

                    if (!_networkMgr.destroyNetwork(network.getId(), context)) {
                        s_logger.warn("Unable to destroy network " + network + " as a part of account id=" + accountId + " cleanup.");
                        accountCleanupNeeded = true;
                        networksDeleted = false;
View Full Code Here

    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);

        boolean expected = false;
        boolean actual = elasticLoadBalancerManagerImpl.finalizeStart(profileMock, hostId, cmds, context);

        assertEquals(expected, actual);
View Full Code Here

        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);

        boolean expected = false;
        boolean actual = elasticLoadBalancerManagerImpl.finalizeStart(profileMock, hostId, cmds, context);

        assertEquals(expected, actual);
View Full Code Here

        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);

        boolean expected = true;
        boolean actual = elasticLoadBalancerManagerImpl.finalizeStart(profileMock, hostId, cmds, context);

        assertEquals(expected, actual);
View Full Code Here

TOP

Related Classes of com.cloud.vm.ReservationContext

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.