Skip to content

Commit 30bb558

Browse files
Priyank PariharRohit Yadav
authored andcommitted
CLOUDSTACK-9610: Disabled Host Keeps Being up status after unmanging cluster.
(cherry picked from commit 4b165f1) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 6977cb3 commit 30bb558

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

engine/components-api/src/com/cloud/resource/ResourceManager.java

100644100755
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ public interface ResourceManager extends ResourceService {
9797

9898
public List<HostVO> listAllUpAndEnabledHosts(Host.Type type, Long clusterId, Long podId, long dcId);
9999

100+
public List<HostVO> listAllHosts(final Host.Type type, final Long clusterId, final Long podId, final long dcId);
101+
100102
public List<HostVO> listAllHostsInCluster(long clusterId);
101103

102104
public List<HostVO> listHostsInClusterByStatus(long clusterId, Status status);

server/src/com/cloud/resource/ResourceManagerImpl.java

100644100755
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ public Cluster updateCluster(final Cluster clusterToUpdate, final String cluster
10861086
try {
10871087
cluster.setManagedState(Managed.ManagedState.PrepareUnmanaged);
10881088
_clusterDao.update(cluster.getId(), cluster);
1089-
List<HostVO> hosts = listAllUpAndEnabledHosts(Host.Type.Routing, cluster.getId(), cluster.getPodId(), cluster.getDataCenterId());
1089+
List<HostVO> hosts = listAllHosts(Host.Type.Routing, cluster.getId(), cluster.getPodId(), cluster.getDataCenterId());
10901090
for (final HostVO host : hosts) {
10911091
if (host.getType().equals(Host.Type.Routing) && !host.getStatus().equals(Status.Down) && !host.getStatus().equals(Status.Disconnected) &&
10921092
!host.getStatus().equals(Status.Up) && !host.getStatus().equals(Status.Alert)) {
@@ -2494,6 +2494,22 @@ public List<HostVO> listAllUpAndEnabledHosts(final Type type, final Long cluster
24942494
return sc.list();
24952495
}
24962496

2497+
@Override
2498+
public List<HostVO> listAllHosts(final Type type, final Long clusterId, final Long podId, final long dcId) {
2499+
final QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class);
2500+
if (type != null) {
2501+
sc.and(sc.entity().getType(), Op.EQ, type);
2502+
}
2503+
if (clusterId != null) {
2504+
sc.and(sc.entity().getClusterId(), Op.EQ, clusterId);
2505+
}
2506+
if (podId != null) {
2507+
sc.and(sc.entity().getPodId(), Op.EQ, podId);
2508+
}
2509+
sc.and(sc.entity().getDataCenterId(), Op.EQ, dcId);
2510+
return sc.list();
2511+
}
2512+
24972513
@Override
24982514
public List<HostVO> listAllUpAndEnabledNonHAHosts(final Type type, final Long clusterId, final Long podId, final long dcId) {
24992515
final String haTag = _haMgr.getHaTag();

server/test/com/cloud/resource/MockResourceManagerImpl.java

100644100755
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,11 @@ public List<HostVO> listAllUpAndEnabledHosts(final Type type, final Long cluster
359359
return null;
360360
}
361361

362+
@Override
363+
public List<HostVO> listAllHosts(final Type type, final Long clusterId, final Long podId, final long dcId) {
364+
return null;
365+
}
366+
362367
/* (non-Javadoc)
363368
* @see com.cloud.resource.ResourceManager#listAllHostsInCluster(long)
364369
*/

0 commit comments

Comments
 (0)