disable cluster-scope report from XS resource

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

Branch: refs/heads/master
Commit: 90ea3249a8b731be443414b430a5a506ab02bd06
Parents: 5d73217
Author: Kelven Yang <kelv...@gmail.com>
Authored: Fri Jan 24 15:52:53 2014 -0800
Committer: Kelven Yang <kelv...@gmail.com>
Committed: Fri Feb 28 15:35:57 2014 -0800

----------------------------------------------------------------------
 api/src/com/cloud/vm/VirtualMachine.java                |  8 ++++----
 .../com/cloud/vm/VirtualMachinePowerStateSyncImpl.java  |  4 ++--
 .../hypervisor/xen/resource/CitrixResourceBase.java     | 12 ++++++++++--
 3 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/90ea3249/api/src/com/cloud/vm/VirtualMachine.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VirtualMachine.java 
b/api/src/com/cloud/vm/VirtualMachine.java
index 2d98aa9..dd11a82 100755
--- a/api/src/com/cloud/vm/VirtualMachine.java
+++ b/api/src/com/cloud/vm/VirtualMachine.java
@@ -33,10 +33,10 @@ import com.cloud.utils.fsm.StateObject;
  */
 public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, 
InternalIdentity, StateObject<VirtualMachine.State> {
 
-       public enum PowerState {
-           PowerUnknown,
-           PowerOn,
-           PowerOff,
+    public enum PowerState {
+        PowerUnknown,
+        PowerOn,
+        PowerOff,
         PowerReportMissing
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/90ea3249/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java
----------------------------------------------------------------------
diff --git 
a/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java 
b/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java
index fd0077c..2e1a552 100644
--- 
a/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java
+++ 
b/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java
@@ -79,8 +79,8 @@ public class VirtualMachinePowerStateSyncImpl implements 
VirtualMachinePowerStat
             } else {
                 if (s_logger.isDebugEnabled())
                     s_logger.debug("VM power state does not change, skip DB 
writing. vm id: " + entry.getKey());
-               }
-       }
+            }
+        }
 
         // for all running/stopping VMs, we provide monitoring of missing 
report
         List<VMInstanceVO> vmsThatAreMissingReport = 
_instanceDao.findByHostInStates(hostId, VirtualMachine.State.Running,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/90ea3249/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
 
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 96d33c7..12ba7c9 100644
--- 
a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ 
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -239,7 +239,6 @@ import com.cloud.vm.VirtualMachine.PowerState;
 import com.cloud.vm.VirtualMachine.State;
 import com.cloud.vm.snapshot.VMSnapshot;
 
-
 /**
  * CitrixResourceBase encapsulates the calls to the XenServer Xapi process
  * to perform the required functionalities for CloudStack.
@@ -2496,6 +2495,9 @@ public abstract class CitrixResourceBase implements 
ServerResource, HypervisorRe
     }
 
     protected HashMap<String, HostVmStateReportEntry> 
getHostVmStateReport(Connection conn) {
+
+        // TODO : new VM sync model does not require a cluster-scope report, 
we need to optimize
+        // the report accordingly
         final HashMap<String, HostVmStateReportEntry> vmStates = new 
HashMap<String, HostVmStateReportEntry>();
         Map<VM, VM.Record> vm_map = null;
         for (int i = 0; i < 2; i++) {
@@ -2534,7 +2536,13 @@ public abstract class CitrixResourceBase implements 
ServerResource, HypervisorRe
                 } catch (XmlRpcException e) {
                     s_logger.error("Failed to get host uuid for host " + 
host.toWireString(), e);
                 }
-                vmStates.put(record.nameLabel, new 
HostVmStateReportEntry(convertPowerState(ps), host_uuid, xstoolsversion));
+
+                if (host_uuid.equalsIgnoreCase(_host.uuid)) {
+                    vmStates.put(
+                            record.nameLabel,
+                            new HostVmStateReportEntry(convertPowerState(ps), 
host_uuid, xstoolsversion)
+                            );
+                }
             }
         }
 

Reply via email to