make sure XS report VM state even if there is no running VM on the host.

This commit is contained in:
Kelven Yang 2014-02-24 16:51:58 -08:00
parent 7ce5e5b1fb
commit b21662f890
5 changed files with 13 additions and 6 deletions

View File

@ -252,6 +252,8 @@ public class CallContext {
if (!stack.isEmpty()) {
s_currentContext.set(stack.peek());
} else {
s_currentContext.set(null);
}
return context;

View File

@ -3048,7 +3048,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
}
if(VmJobEnabled.value()) {
if (ping.getHostVmStateReport() != null && ping.getHostVmStateReport().size() > 0) {
if (ping.getHostVmStateReport() != null) {
_syncMgr.processHostVmStatePingReport(agentId, ping.getHostVmStateReport());
}
}

View File

@ -66,6 +66,9 @@ public class VirtualMachinePowerStateSyncImpl implements VirtualMachinePowerStat
private void processReport(long hostId, Map<Long, VirtualMachine.PowerState> translatedInfo) {
if (s_logger.isDebugEnabled())
s_logger.debug("Process VM state report. host: " + hostId + ", number of records in report: " + translatedInfo.size());
for (Map.Entry<Long, VirtualMachine.PowerState> entry : translatedInfo.entrySet()) {
if (s_logger.isDebugEnabled())
@ -105,6 +108,9 @@ public class VirtualMachinePowerStateSyncImpl implements VirtualMachinePowerStat
}
}
}
if (s_logger.isDebugEnabled())
s_logger.debug("Done with process of VM state report. host: " + hostId);
}
@Override

View File

@ -207,7 +207,7 @@ public class AsyncJobExecutionContext {
public static String getOriginJobId() {
AsyncJobExecutionContext context = AsyncJobExecutionContext.getCurrentExecutionContext();
if (context != null && context.getJob() != null)
return "Job-" + context.getJob().getId();
return "" + context.getJob().getId();
return "";
}

View File

@ -324,9 +324,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
static {
s_powerStatesTable = new HashMap<Types.VmPowerState, PowerState>();
s_powerStatesTable.put(Types.VmPowerState.HALTED, PowerState.PowerOff);
s_powerStatesTable.put(Types.VmPowerState.PAUSED, PowerState.PowerOn);
s_powerStatesTable.put(Types.VmPowerState.PAUSED, PowerState.PowerOff);
s_powerStatesTable.put(Types.VmPowerState.RUNNING, PowerState.PowerOn);
s_powerStatesTable.put(Types.VmPowerState.SUSPENDED, PowerState.PowerOn);
s_powerStatesTable.put(Types.VmPowerState.SUSPENDED, PowerState.PowerOff);
s_powerStatesTable.put(Types.VmPowerState.UNRECOGNIZED, PowerState.PowerUnknown);
}
@ -2524,7 +2524,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
}
if (vm_map == null) {
return null;
return vmStates;
}
for (VM.Record record : vm_map.values()) {
if (record.isControlDomain || record.isASnapshot || record.isATemplate) {
@ -4927,7 +4927,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
}
if (srr.shared) {
Host host = Host.getByUuid(conn, _host.uuid);
boolean found = false;
for (PBD pbd : pbds) {
PBD.Record pbdr = pbd.getRecord(conn);