Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward e8e0449ed -> 98df3e55b


CLOUDSTACK-6399: When there are no vms running on hyperv host, then agent was 
returning null. In
that case cloudstack was not doing anything and not updating the state of the 
vms to stopped.
Now the agent returns empty list of hostvmstatereport. Management server will 
then update the
vm state to stopped (instead of not acting upon the return state).


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

Branch: refs/heads/4.4-forward
Commit: 704f6d8279c314a165199804ee43eaac4b0d482a
Parents: e8e0449
Author: Anshul Gangwar <anshul.gang...@citrix.com>
Authored: Fri May 9 14:32:36 2014 +0530
Committer: Devdeep Singh <devd...@gmail.com>
Committed: Fri May 9 15:30:05 2014 +0530

----------------------------------------------------------------------
 .../hyperv/resource/HypervDirectConnectResource.java  | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/704f6d82/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
 
b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
index 7888e43..1816baf 100644
--- 
a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
+++ 
b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
@@ -90,10 +90,10 @@ import com.cloud.agent.api.SetupGuestNetworkCommand;
 import com.cloud.agent.api.StartCommand;
 import com.cloud.agent.api.StartupCommand;
 import com.cloud.agent.api.StartupRoutingCommand;
-import com.cloud.agent.api.UnPlugNicAnswer;
-import com.cloud.agent.api.UnPlugNicCommand;
 import com.cloud.agent.api.StartupRoutingCommand.VmState;
 import com.cloud.agent.api.StartupStorageCommand;
+import com.cloud.agent.api.UnPlugNicAnswer;
+import com.cloud.agent.api.UnPlugNicCommand;
 import com.cloud.agent.api.UnsupportedAnswer;
 import com.cloud.agent.api.check.CheckSshAnswer;
 import com.cloud.agent.api.check.CheckSshCommand;
@@ -355,8 +355,12 @@ public class HypervDirectConnectResource extends 
ServerResourceBase implements S
         }
         s_logger.debug("HostVmStateReportCommand received response "
                 + s_gson.toJson(result));
-        if (!result.isEmpty()) {
-            return result;
+        if (result != null) {
+            if (!result.isEmpty()) {
+                return result;
+            } else {
+                return new ArrayList<Map<String, String>>();
+            }
         }
         return null;
     }
@@ -364,7 +368,7 @@ public class HypervDirectConnectResource extends 
ServerResourceBase implements S
     protected HashMap<String, HostVmStateReportEntry> getHostVmStateReport() {
         final HashMap<String, HostVmStateReportEntry> vmStates = new 
HashMap<String, HostVmStateReportEntry>();
         ArrayList<Map<String, String>> vmList = requestHostVmStateReport();
-        if (vmList == null || vmList.isEmpty()) {
+        if (vmList == null) {
             return null;
         }
 

Reply via email to