if (cluster.getGuid() == null) { cluster.setGuid(UUID.nameUUIDFromBytes(String.valueOf(clusterId).getBytes(Charset.forName("UTF-8"))).toString()); _clusterDao.update(clusterId, cluster); details.put("username", username); details.put("password", password); details.put("cluster.guid", cluster.getGuid());
if (clu.getGuid() == null) { clu.setGuid(UUID.randomUUID().toString()); _clusterDao.update(clusterId, clu);
if (clu.getGuid() == null) { clu.setGuid(UUID.randomUUID().toString());
if (clu.getGuid() == null) { clu.setGuid(UUID.randomUUID().toString()); _clusterDao.update(clusterId, clu);
if (clu.getGuid() == null) { setClusterGuid(clu, poolUuid); } else { List<HostVO> clusterHosts = _resourceMgr.listAllHostsInCluster(clusterId); if (clusterHosts != null && clusterHosts.size() > 0) { if (!clu.getGuid().equals(poolUuid)) { String msg = "Please join the host " + hostIp + " to XS pool " + clu.getGuid() + " through XC/XS before adding it through CS UI"; s_logger.warn(msg); throw new DiscoveryException(msg); poolUuid = clu.getGuid(); _clusterDao.update(clusterId, clu);
if (cluster.getGuid() == null) { cluster.setGuid(UUID.nameUUIDFromBytes(String.valueOf(clusterId).getBytes()).toString()); _clusterDao.update(clusterId, cluster);
if (cluster.getGuid() == null) { cluster.setGuid(startup.getPool()); _clusterDao.update(cluster.getId(), cluster); } else if (!cluster.getGuid().equals(startup.getPool())) { String msg = "pool uuid for cluster " + cluster.getId() + " changed from " + cluster.getGuid() + " to " + startup.getPool(); s_logger.warn(msg); throw new CloudRuntimeException(msg);
void setClusterGuid(ClusterVO cluster, String guid) { cluster.setGuid(guid); try { _clusterDao.update(cluster.getId(), cluster); } catch (EntityExistsException e) { QueryBuilder<ClusterVO> sc = QueryBuilder.create(ClusterVO.class); sc.and(sc.entity().getGuid(), Op.EQ, guid); List<ClusterVO> clusters = sc.list(); ClusterVO clu = clusters.get(0); List<HostVO> clusterHosts = _resourceMgr.listAllHostsInCluster(clu.getId()); if (clusterHosts == null || clusterHosts.size() == 0) { clu.setGuid(null); _clusterDao.update(clu.getId(), clu); _clusterDao.update(cluster.getId(), cluster); return; } throw e; } }
if (cluster.getGuid() == null) { cluster.setGuid(startup.getPool()); _clusterDao.update(cluster.getId(), cluster);
throw ex; } else { if (cluster.getGuid() == null) { final List<HostVO> hosts = listAllHostsInCluster(clusterId); if (!hosts.isEmpty()) {
public ClusterDaoImpl() { super(); HyTypeWithoutGuidSearch = createSearchBuilder(); HyTypeWithoutGuidSearch.and("hypervisorType", HyTypeWithoutGuidSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ); HyTypeWithoutGuidSearch.and("guid", HyTypeWithoutGuidSearch.entity().getGuid(), SearchCriteria.Op.NULL); HyTypeWithoutGuidSearch.done(); ZoneHyTypeSearch = createSearchBuilder(); ZoneHyTypeSearch.and("hypervisorType", ZoneHyTypeSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ); ZoneHyTypeSearch.and("dataCenterId", ZoneHyTypeSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); ZoneHyTypeSearch.done(); PodSearch = createSearchBuilder(); PodSearch.and("pod", PodSearch.entity().getPodId(), SearchCriteria.Op.EQ); PodSearch.and("name", PodSearch.entity().getName(), SearchCriteria.Op.EQ); PodSearch.done(); ZoneSearch = createSearchBuilder(); ZoneSearch.and("dataCenterId", ZoneSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); ZoneSearch.groupBy(ZoneSearch.entity().getHypervisorType()); ZoneSearch.done(); AvailHyperSearch = createSearchBuilder(); AvailHyperSearch.and("zoneId", AvailHyperSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); AvailHyperSearch.select(null, Func.DISTINCT, AvailHyperSearch.entity().getHypervisorType()); AvailHyperSearch.done(); ZoneClusterSearch = createSearchBuilder(); ZoneClusterSearch.and("dataCenterId", ZoneClusterSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); ZoneClusterSearch.done(); ClusterIdSearch = createSearchBuilder(Long.class); ClusterIdSearch.selectFields(ClusterIdSearch.entity().getId()); ClusterIdSearch.and("dataCenterId", ClusterIdSearch.entity().getDataCenterId(), Op.EQ); ClusterIdSearch.done(); }