(just adding this so I don't forget it for 1.4) It would be nice to have an API to be able to ask "how many RHQ Servers are currently running in the cloud"? The Server.java POJO needs this query: // gets all other servers running in the cloud other than the named server @NamedQuery(name = Server.QUERY_FIND_ALL_NORMAL_BUT_ONE, query = "" // + "SELECT s " // + " FROM Server s " // + " WHERE s.name <> :name " // + " AND s.operationMode = 'NORMAL'"), CloudManagerLocal defines this: /** * Counts all of the servers currently running in the cloud, except for the given server name. * This lets you know, for example, if there are other servers running in the cloud, other then the server * making this request. Use this to ask the question, "am I the only server currently running". * Note this will not count servers in maintenance mode nor will it count recently installed but not yet fully started * servers. * * @param serverName the server to ignore in the count * * @return the number of servers running, not including the named server */ int getCountOfAllOtherNormalServers(String serverName); CloudManagerBean has this impl: public int getCountOfAllOtherNormalServers(String serverName) { // note the use of count query to just get the number Query query = PersistenceUtility.createCountQuery(entityManager, Server.QUERY_FIND_ALL_NORMAL_BUT_ONE); query.setParameter("name", serverName); try { long serverCount = (Long) query.getSingleResult(); return (int) serverCount; } catch (NoResultException nre) { log.debug("Could not get count of other normal instances, returning 0..."); return 0; } } Its kinda hokey having to pass in a server name, perhaps we use under the covers this: org.rhq.enterprise.server.cloud.instance.ServerManagerBean.getServer() which really just boils down to the following (if you don't want an extra DB hit to get the server name): org.rhq.enterprise.server.cloud.instance.ServerManagerBean.getIdentity()
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-2401
Temporarily adding the keyword "SubBug" so we can be sure we have accounted for all the bugs. keyword: new = Tracking + FutureFeature + SubBug
making sure we're not missing any bugs in rhq_triage
this is already implemented. see Server.QUERY_FIND_ALL_NORMAL_CLOUD_MEMBERS. if you want to get a count, use PersistenceUtility.createCountQuery. in the future, we should probably write ServerCriteria so that we don't have to maintain these manual queries anymore.
Closing per triage