Examples of DedicatedResourceVO


Examples of com.cloud.dc.DedicatedResourceVO

    @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();
        return result;
View Full Code Here

Examples of com.cloud.dc.DedicatedResourceVO

        if (!(_podDao.remove(podId))) {
            throw new CloudRuntimeException("Failed to delete pod " + podId);
        }

        // remove from dedicated resources
        DedicatedResourceVO dr = _dedicatedDao.findByPodId(podId);
        if (dr != null) {
            _dedicatedDao.remove(dr.getId());
        }
        txn.commit();

        return true;
    }
View Full Code Here

Examples of com.cloud.dc.DedicatedResourceVO

        if (success) {
            // delete all capacity records for the zone
            _capacityDao.removeBy(null, zoneId, null, null, null);
            // remove from dedicated resources
            DedicatedResourceVO dr = _dedicatedDao.findByZoneId(zoneId);
            if (dr != null) {
                _dedicatedDao.remove(dr.getId());
                // find the group associated and check if there are any more
                // resources under that group
                List<DedicatedResourceVO> resourcesInGroup = _dedicatedDao.listByAffinityGroupId(dr
                        .getAffinityGroupId());
                if (resourcesInGroup.isEmpty()) {
                    // delete the group
                    _affinityGroupService.deleteAffinityGroup(dr.getAffinityGroupId(), null, null, null);
                }
            }
        }

        txn.commit();
View Full Code Here

Examples of com.cloud.dc.DedicatedResourceVO

        if (isPublic != null && isPublic) {
            zone.setDomainId(null);
            zone.setDomain(null);

            // release the dedication for this zone
            DedicatedResourceVO resource = _dedicatedDao.findByZoneId(zoneId);
            Long resourceId = null;
            if (resource != null) {
                resourceId = resource.getId();
                if (!_dedicatedDao.remove(resourceId)) {
                    throw new CloudRuntimeException("Failed to delete dedicated Zone Resource " + resourceId);
                }
                // find the group associated and check if there are any more
                // resources under that group
                List<DedicatedResourceVO> resourcesInGroup = _dedicatedDao.listByAffinityGroupId(resource.getAffinityGroupId());
                if (resourcesInGroup.isEmpty()) {
                    // delete the group
                    _affinityGroupService.deleteAffinityGroup(resource.getAffinityGroupId(), null, null, null);
                }
            }
        }

        if (!_zoneDao.update(zoneId, zone)) {
View Full Code Here

Examples of com.cloud.dc.DedicatedResourceVO

            zone = _zoneDao.persist(zone);
            if (domainId != null) {
                // zone is explicitly dedicated to this domain
                // create affinity group associated and dedicate the zone.
                AffinityGroup group = createDedicatedAffinityGroup(null, domainId, null);
                DedicatedResourceVO dedicatedResource = new DedicatedResourceVO(zone.getId(), null, null, null,
                        domainId, null, group.getId());
                _dedicatedDao.persist(dedicatedResource);
            }

            // Create default system networks
View Full Code Here

Examples of com.cloud.dc.DedicatedResourceVO

      //if account is normal user
      //check if account's domain is a child of zone's domain
            else if (account.getType() == Account.ACCOUNT_TYPE_NORMAL || account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
                // if zone is dedicated to an account check that the accountId
                // matches.
                DedicatedResourceVO dedicatedZone = _dedicatedDao.findByZoneId(zone.getId());
                if (dedicatedZone != null) {
                    if (dedicatedZone.getAccountId() != null) {
                        if (dedicatedZone.getAccountId() == account.getId()) {
                            return true;
                        } else {
                            return false;
                        }
                    }
View Full Code Here

Examples of com.cloud.dc.DedicatedResourceVO

                    "Cannot perform this operation, Zone is currently disabled: "
                            + zone.getId());
        }

        // check if zone is dedicated
        DedicatedResourceVO dedicatedZone = _dedicatedDao.findByZoneId(zone.getId());
        if (dedicatedZone != null) {
            DomainVO domain = _domainDao.findById(dedicatedZone.getDomainId());
            if (domain == null) {
                throw new CloudRuntimeException("Unable to find the domain "
                        + zone.getDomainId() + " for the zone: " + zone);
            }
            // check that caller can operate with domain
View Full Code Here

Examples of com.cloud.dc.DedicatedResourceVO

        return migratedVm;
    }

    private boolean checkIfHostIsDedicated(HostVO host) {
        long hostId = host.getId();
        DedicatedResourceVO dedicatedHost = _dedicatedDao.findByHostId(hostId);
        DedicatedResourceVO dedicatedClusterOfHost = _dedicatedDao.findByClusterId(host.getClusterId());
        DedicatedResourceVO dedicatedPodOfHost = _dedicatedDao.findByPodId(host.getPodId());
        if(dedicatedHost != null || dedicatedClusterOfHost != null || dedicatedPodOfHost != null) {
            return true;
        } else {
            return false;
        }
View Full Code Here

Examples of com.cloud.dc.DedicatedResourceVO

        }
    }

    private Long accountOfDedicatedHost(HostVO host) {
        long hostId = host.getId();
        DedicatedResourceVO dedicatedHost = _dedicatedDao.findByHostId(hostId);
        DedicatedResourceVO dedicatedClusterOfHost = _dedicatedDao.findByClusterId(host.getClusterId());
        DedicatedResourceVO dedicatedPodOfHost = _dedicatedDao.findByPodId(host.getPodId());
        if(dedicatedHost != null) {
            return dedicatedHost.getAccountId();
        }
        if(dedicatedClusterOfHost != null) {
            return dedicatedClusterOfHost.getAccountId();
        }
        if(dedicatedPodOfHost != null) {
            return dedicatedPodOfHost.getAccountId();
        }
        return null;
    }
View Full Code Here

Examples of com.cloud.dc.DedicatedResourceVO

        return null;
    }

    private Long domainOfDedicatedHost(HostVO host) {
        long hostId = host.getId();
        DedicatedResourceVO dedicatedHost = _dedicatedDao.findByHostId(hostId);
        DedicatedResourceVO dedicatedClusterOfHost = _dedicatedDao.findByClusterId(host.getClusterId());
        DedicatedResourceVO dedicatedPodOfHost = _dedicatedDao.findByPodId(host.getPodId());
        if(dedicatedHost != null) {
            return dedicatedHost.getDomainId();
        }
        if(dedicatedClusterOfHost != null) {
            return dedicatedClusterOfHost.getDomainId();
        }
        if(dedicatedPodOfHost != null) {
            return dedicatedPodOfHost.getDomainId();
        }
        return null;
    }
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.