fix migration

This commit is contained in:
Edison Su 2011-02-25 21:48:17 -05:00
parent b20808d223
commit 8240ae7e8c
2 changed files with 19 additions and 10 deletions

View File

@ -202,6 +202,7 @@ public class NicProfile {
this.broadcastUri = broadcastUri;
this.isolationUri = isolationUri;
this.netmask = nic.getNetmask();
this.isSecurityGroupEnabled = network.isSecurityGroupEnabled();
if (networkRate != null) {
this.networkRate = networkRate;

View File

@ -427,17 +427,25 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager, SecurityG
}
protected void handleVmMigrated(VMInstanceVO vm) {
if (vm.getType() == VirtualMachine.Type.User || !isVmSecurityGroupEnabled(vm.getId()))
if (!isVmSecurityGroupEnabled(vm.getId()))
return;
NetworkRulesSystemVmCommand nrc = new NetworkRulesSystemVmCommand(vm.getInstanceName(), vm.getType());
Commands cmds = new Commands(nrc);
try {
_agentMgr.send(vm.getHostId(), cmds);
} catch (AgentUnavailableException e) {
s_logger.debug(e.toString());
} catch (OperationTimedoutException e) {
s_logger.debug(e.toString());
}
if (vm.getType() != VirtualMachine.Type.User) {
Commands cmds = null;
NetworkRulesSystemVmCommand nrc = new NetworkRulesSystemVmCommand(vm.getInstanceName(), vm.getType());
cmds = new Commands(nrc);
try {
_agentMgr.send(vm.getHostId(), cmds);
} catch (AgentUnavailableException e) {
s_logger.debug(e.toString());
} catch (OperationTimedoutException e) {
s_logger.debug(e.toString());
}
} else {
Set<Long> affectedVms = new HashSet<Long>();
affectedVms.add(vm.getId());
scheduleRulesetUpdateToHosts(affectedVms, true, null);
}
}
@Override @DB @SuppressWarnings("rawtypes")