CLOUDSTACK-8578: implement state=present for listing only non-destroyed VMs

So the behavior before this fix can be used in a proper way.

Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #513
This commit is contained in:
Rene Moser 2015-06-23 15:47:06 +02:00 committed by Daan Hoogland
parent 55c1d9f3fa
commit af902fd9d9
2 changed files with 7 additions and 3 deletions

View File

@ -78,7 +78,7 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
@Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "the pod ID")
private Long podId;
@Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "state of the virtual machine")
@Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "state of the virtual machine. Possible values are: Running, Stopped, Present, Destroyed, Expunged. Present is used for the state equal not destroyed.")
private String state;
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the availability zone ID")

View File

@ -814,7 +814,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
String hypervisor = cmd.getHypervisor();
Object name = cmd.getName();
Object state = cmd.getState();
String state = cmd.getState();
Object zoneId = cmd.getZoneId();
Object keyword = cmd.getKeyword();
boolean isAdmin = false;
@ -968,7 +968,11 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
}
if (state != null) {
sc.setParameters("stateEQ", state);
if (state.equalsIgnoreCase("present")) {
sc.setParameters("stateNIN", "Destroyed", "Expunging");
} else {
sc.setParameters("stateEQ", state);
}
}
if (hypervisor != null) {