Package com.cloud.utils.db

Examples of com.cloud.utils.db.Transaction.start()


        netscalerServiceProviders.put(Service.Lb, Provider.Netscaler);

        // The only one diff between 1 and 2 network offerings is that the first one has SG enabled. In Basic zone only
        // first network offering has to be enabled, in Advance zone - the second one
        Transaction txn = Transaction.currentTxn();
        txn.start();

        // Offering #1
        NetworkOfferingVO defaultSharedSGNetworkOffering = new NetworkOfferingVO(
                NetworkOffering.DefaultSharedNetworkOfferingWithSGService,
                "Offering for Shared Security group enabled networks",
View Full Code Here


        if ((domainResourceCount.size() < domainExpectedCount * domains.size())) {
            s_logger.debug("resource_count table has records missing for some domains...going to insert them");
            for (DomainVO domain : domains) {
                // Lock domain
                Transaction txn = Transaction.currentTxn();
                txn.start();
                _domainDao.lockRow(domain.getId(), true);
                List<ResourceCountVO> domainCounts = _resourceCountDao.listByOwnerId(domain.getId(), ResourceOwnerType.Domain);
                List<String> domainCountStr = new ArrayList<String>();
                for (ResourceCountVO domainCount : domainCounts) {
                    domainCountStr.add(domainCount.getType().toString());
View Full Code Here

        if ((accountResourceCount.size() < accountExpectedCount * accounts.size())) {
            s_logger.debug("resource_count table has records missing for some accounts...going to insert them");
            for (AccountVO account : accounts) {
                // lock account
                Transaction txn = Transaction.currentTxn();
                txn.start();
                _accountDao.lockRow(account.getId(), true);
                List<ResourceCountVO> accountCounts = _resourceCountDao.listByOwnerId(account.getId(), ResourceOwnerType.Account);
                List<String> accountCountStr = new ArrayList<String>();
                for (ResourceCountVO accountCount : accountCounts) {
                    accountCountStr.add(accountCount.getType().toString());
View Full Code Here

        if (!region.checkIfServiceEnabled(Region.Service.Gslb) || (providerDnsName == null)) {
            throw new CloudRuntimeException("GSLB service is not enabled in region : " + region.getName());
        }

        Transaction txn = Transaction.currentTxn();
        txn.start();
        GlobalLoadBalancerRuleVO newGslbRule = new GlobalLoadBalancerRuleVO(name, description, domainName, algorithm,
                stickyMethod, serviceType, regionId, gslbOwner.getId(), gslbOwner.getDomainId(),
                GlobalLoadBalancerRule.State.Staged);
        _gslbRuleDao.persist(newGslbRule);
View Full Code Here

        }

        Map<Long, Long> lbRuleWeightMap = assignToGslbCmd.getLoadBalancerRuleWeightMap();

        Transaction txn = Transaction.currentTxn();
        txn.start();

        // persist the mapping for the new Lb rule that needs to assigned to a gslb rule
        for (Long lbRuleId : newLbRuleIds) {
            GlobalLoadBalancerLbRuleMapVO newGslbLbMap = new GlobalLoadBalancerLbRuleMapVO();
            newGslbLbMap.setGslbLoadBalancerId(gslbRuleId);
View Full Code Here

                        + " to global load balancer rule: " + gslbRule.getUuid());
            }
        }

        Transaction txn = Transaction.currentTxn();
        txn.start();

        // update the mapping of gslb rule to Lb rule, to revoke state
        for (Long lbRuleId : lbRuleIdsToremove) {
            GlobalLoadBalancerLbRuleMapVO removeGslbLbMap = _gslbLbMapDao.findByGslbRuleIdAndLbRuleId(gslbRuleId, lbRuleId);
            removeGslbLbMap.setRevoke(true);
View Full Code Here

    }

    @Override
    public boolean remove(Long id) {
        Transaction txn = Transaction.currentTxn();
        txn.start();
        DedicatedResourceVO resource = createForUpdate();
        update(id, resource);

        boolean result = super.remove(id);
        txn.commit();
View Full Code Here

                CloudRuntimeException ex = new CloudRuntimeException(
                        "Failed to remove load balancer rule ids from GSLB rule ");
                throw ex;
            }

            txn.start();

            // remove the mappings of gslb rule to Lb rule that are in revoked state
            for (Long lbRuleId : lbRuleIdsToremove) {
                GlobalLoadBalancerLbRuleMapVO removeGslbLbMap = _gslbLbMapDao.findByGslbRuleIdAndLbRuleId(gslbRuleId, lbRuleId);
                _gslbLbMapDao.remove(removeGslbLbMap.getId());
View Full Code Here

            gslbRule.setState(GlobalLoadBalancerRule.State.Revoke);
            _gslbRuleDao.update(gslbRuleId, gslbRule);
        }

        Transaction txn = Transaction.currentTxn();
        txn.start();

        List<GlobalLoadBalancerLbRuleMapVO> gslbLbMapVos = _gslbLbMapDao.listByGslbRuleId(gslbRuleId);
        if (gslbLbMapVos != null) {
            //mark all the GSLB-LB mapping to be in revoke state
            for (GlobalLoadBalancerLbRuleMapVO gslbLbMap : gslbLbMapVos) {
View Full Code Here

            success = true;
        } catch (ResourceUnavailableException e) {
            throw new CloudRuntimeException("Failed to update the gloabal load balancer");
        }

        txn.start();
        //remove all mappings between GSLB rule and load balancer rules
        if (gslbLbMapVos != null) {
            for (GlobalLoadBalancerLbRuleMapVO gslbLbMap : gslbLbMapVos) {
                _gslbLbMapDao.remove(gslbLbMap.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.