Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@ protected void init() {
IdsPowerStateSelectSearch.entity().getPowerHostId(),
IdsPowerStateSelectSearch.entity().getPowerState(),
IdsPowerStateSelectSearch.entity().getPowerStateUpdateCount(),
IdsPowerStateSelectSearch.entity().getPowerStateUpdateTime());
IdsPowerStateSelectSearch.entity().getPowerStateUpdateTime(),
IdsPowerStateSelectSearch.entity().getState());
IdsPowerStateSelectSearch.done();

CountByOfferingId = createSearchBuilder(Integer.class);
Expand Down Expand Up @@ -1105,6 +1106,10 @@ public Map<Long, VirtualMachine.PowerState> updatePowerState(

private boolean isPowerStateInSyncWithInstanceState(final VirtualMachine.PowerState powerState, final long powerHostId, final VMInstanceVO instance) {
State instanceState = instance.getState();
if (instanceState == null) {
logger.warn("VM {} has null instance state during power state sync check, treating as out of sync", instance);
return false;
}
if ((powerState == VirtualMachine.PowerState.PowerOff && instanceState == State.Running)
|| (powerState == VirtualMachine.PowerState.PowerOn && instanceState == State.Stopped)) {
HostVO instanceHost = hostDao.findById(instance.getHostId());
Expand Down
Loading