mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	make sure XS report VM state even if there is no running VM on the host.
This commit is contained in:
		
							parent
							
								
									7ce5e5b1fb
								
							
						
					
					
						commit
						b21662f890
					
				@ -252,6 +252,8 @@ public class CallContext {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (!stack.isEmpty()) {
 | 
					        if (!stack.isEmpty()) {
 | 
				
			||||||
            s_currentContext.set(stack.peek());
 | 
					            s_currentContext.set(stack.peek());
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            s_currentContext.set(null);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return context;
 | 
					        return context;
 | 
				
			||||||
 | 
				
			|||||||
@ -3048,7 +3048,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if(VmJobEnabled.value()) {
 | 
					                if(VmJobEnabled.value()) {
 | 
				
			||||||
                    if (ping.getHostVmStateReport() != null && ping.getHostVmStateReport().size() > 0) {
 | 
					                    if (ping.getHostVmStateReport() != null) {
 | 
				
			||||||
                        _syncMgr.processHostVmStatePingReport(agentId, ping.getHostVmStateReport());
 | 
					                        _syncMgr.processHostVmStatePingReport(agentId, ping.getHostVmStateReport());
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
				
			|||||||
@ -66,6 +66,9 @@ public class VirtualMachinePowerStateSyncImpl implements VirtualMachinePowerStat
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private void processReport(long hostId, Map<Long, VirtualMachine.PowerState> translatedInfo) {
 | 
					    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()) {
 | 
					        for (Map.Entry<Long, VirtualMachine.PowerState> entry : translatedInfo.entrySet()) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (s_logger.isDebugEnabled())
 | 
					            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
 | 
					    @Override
 | 
				
			||||||
 | 
				
			|||||||
@ -207,7 +207,7 @@ public class AsyncJobExecutionContext  {
 | 
				
			|||||||
    public static String getOriginJobId() {
 | 
					    public static String getOriginJobId() {
 | 
				
			||||||
        AsyncJobExecutionContext context = AsyncJobExecutionContext.getCurrentExecutionContext();
 | 
					        AsyncJobExecutionContext context = AsyncJobExecutionContext.getCurrentExecutionContext();
 | 
				
			||||||
        if (context != null && context.getJob() != null)
 | 
					        if (context != null && context.getJob() != null)
 | 
				
			||||||
            return "Job-" + context.getJob().getId();
 | 
					            return "" + context.getJob().getId();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return "";
 | 
					        return "";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -324,9 +324,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
 | 
				
			|||||||
    static {
 | 
					    static {
 | 
				
			||||||
        s_powerStatesTable = new HashMap<Types.VmPowerState, PowerState>();
 | 
					        s_powerStatesTable = new HashMap<Types.VmPowerState, PowerState>();
 | 
				
			||||||
        s_powerStatesTable.put(Types.VmPowerState.HALTED, PowerState.PowerOff);
 | 
					        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.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);
 | 
					        s_powerStatesTable.put(Types.VmPowerState.UNRECOGNIZED, PowerState.PowerUnknown);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2524,7 +2524,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (vm_map == null) {
 | 
					        if (vm_map == null) {
 | 
				
			||||||
            return null;
 | 
					            return vmStates;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        for (VM.Record record : vm_map.values()) {
 | 
					        for (VM.Record record : vm_map.values()) {
 | 
				
			||||||
            if (record.isControlDomain || record.isASnapshot || record.isATemplate) {
 | 
					            if (record.isControlDomain || record.isASnapshot || record.isATemplate) {
 | 
				
			||||||
@ -4927,7 +4927,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            if (srr.shared) {
 | 
					            if (srr.shared) {
 | 
				
			||||||
                Host host = Host.getByUuid(conn, _host.uuid);
 | 
					                Host host = Host.getByUuid(conn, _host.uuid);
 | 
				
			||||||
 | 
					 | 
				
			||||||
                boolean found = false;
 | 
					                boolean found = false;
 | 
				
			||||||
                for (PBD pbd : pbds) {
 | 
					                for (PBD pbd : pbds) {
 | 
				
			||||||
                    PBD.Record pbdr = pbd.getRecord(conn);
 | 
					                    PBD.Record pbdr = pbd.getRecord(conn);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user