You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ja...@apache.org on 2015/06/29 09:00:58 UTC

[37/50] [abbrv] git commit: updated refs/heads/dhcpoffload to 45721ae

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 <da...@onecht.net>

This closes #513


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/af902fd9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/af902fd9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/af902fd9

Branch: refs/heads/dhcpoffload
Commit: af902fd9d911b5e46b1fa085be6badeb9780892c
Parents: 55c1d9f
Author: Rene Moser <re...@apache.org>
Authored: Tue Jun 23 15:47:06 2015 +0200
Committer: Daan Hoogland <da...@onecht.net>
Committed: Wed Jun 24 20:21:33 2015 +0200

----------------------------------------------------------------------
 .../apache/cloudstack/api/command/user/vm/ListVMsCmd.java    | 2 +-
 server/src/com/cloud/api/query/QueryManagerImpl.java         | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af902fd9/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
index 32a8b7b..ff6acde 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
@@ -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")

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af902fd9/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index 9840958..8c304b9 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -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) {