bug 11800: checking for null value

This commit is contained in:
Abhinandan Prateek 2011-11-04 17:50:15 +05:30 committed by root
parent 5f4e74bbc4
commit 7144ebcaef
1 changed files with 5 additions and 1 deletions

View File

@ -3050,6 +3050,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
while ( iter.hasNext() ) {
VM vm = iter.next();
VM.Record vmr = vm.getRecord(conn);
s_logger.warn("----------------------" + vmr.nameLabel + ", " + vmr.powerState + " , " +
isRefNull(vmr.residentOn) + ", " + vmr.residentOn.getUuid(conn).equals(_host.uuid) + ", " + _host.uuid);
if (vmr.powerState != VmPowerState.RUNNING) {
continue;
}
@ -3059,6 +3061,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
if (vmr.residentOn.getUuid(conn).equals(_host.uuid)) {
continue;
}
s_logger.warn("----------------------Removing --" + vmr.nameLabel);
iter.remove();
}
@ -6541,10 +6544,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
String host_uuid = entry.getValue().first();
final Pair<String, State> oldState = oldStates.remove(vm);
//check if host is changed
if (host_uuid != null){
if (host_uuid != null && oldState != null){
if (!host_uuid.equals(oldState.first())){
changes.put(vm, new Pair<String, State>(host_uuid, newState));
s_vms.put(_cluster, host_uuid, vm, newState);
continue;
}
}