cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mike-tutkowski <...@git.apache.org>
Subject [GitHub] cloudstack pull request: Taking fast and efficient volume snapshot...
Date Fri, 13 May 2016 06:47:46 GMT
Github user mike-tutkowski commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1403#discussion_r63139458
  
    --- Diff: engine/schema/src/com/cloud/dc/dao/ClusterDaoImpl.java ---
    @@ -260,4 +268,41 @@ public boolean remove(Long id) {
             sc.setParameters("dataCenterId", zoneId);
             return customSearch(sc, null);
         }
    +
    +    @Override
    +    public boolean computeWhetherClusterSupportsResigning(long clusterId) {
    +        ClusterVO cluster = findById(clusterId);
    +
    +        if (cluster == null || cluster.getAllocationState() != Grouping.AllocationState.Enabled)
{
    +            return false;
    +        }
    +
    +        List<HostVO> hosts = hostDao.findByClusterId(clusterId);
    +
    +        if (hosts == null) {
    +            return false;
    +        }
    +
    +        for (HostVO host : hosts) {
    +            if (host == null) {
    +                return false;
    +            }
    +
    +            DetailVO hostDetail = hostDetailsDao.findDetail(host.getId(), "supportsResign");
    +
    +            if (hostDetail == null) {
    +                return false;
    +            }
    +
    +            String value = hostDetail.getValue();
    +
    +            Boolean booleanValue = Boolean.valueOf(value);
    +
    +            if (booleanValue == false) {
    +                return false;
    +            }
    +        }
    +
    +        return true;
    +    }
    --- End diff --
    
    Actually, I think we just need to join the host and the host_details tables (because cluster
ID should be in the host table).
    
    We'd want all of the hosts with a particular cluster ID selected from the host table and
then we'd want to join on host ID in the host_details table and further refine the returned
hosts by those that have a "supportsResign" value in the name field.
    
    Do you happen to know of any code of ours that allows you to SQL filter the returned values
based on values that exist in not just one, but two tables? From what I've seen, we seem to
be pretty heavily filtering only on data present in one table (even when we join with another
table).
    
    If this were just raw SQL, it would be pretty easy, but we've got that Java DB layer that
this needs to fit within.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message