HDDS-1302. Fix SCM CLI does not list container with id 1.

This commit is contained in:
Vivek Ratnavel Subramanian 2019-03-22 15:15:01 -07:00 committed by Bharat Viswanadham
parent dea6f2a065
commit 73f7b04e2b
2 changed files with 7 additions and 2 deletions

View File

@ -200,7 +200,7 @@ public List<ContainerInfo> listContainer(ContainerID startContainerID,
Collections.sort(containersIds);
return containersIds.stream()
.filter(id -> id.getId() >= startId)
.filter(id -> id.getId() > startId)
.limit(count)
.map(id -> {
try {

View File

@ -294,8 +294,13 @@ public List<ContainerInfo> listContainer(long startContainerID,
auditMap.put("startContainerID", String.valueOf(startContainerID));
auditMap.put("count", String.valueOf(count));
try {
// To allow startcontainerId to take the value "0",
// "null" is assigned, so that its handled in the
// scm.getContainerManager().listContainer method
final ContainerID containerId = startContainerID != 0 ? ContainerID
.valueof(startContainerID) : null;
return scm.getContainerManager().
listContainer(ContainerID.valueof(startContainerID), count);
listContainer(containerId, count);
} catch (Exception ex) {
auditSuccess = false;
AUDIT.logReadFailure(