ovs managers: handle execption along with Alex's convention

This commit is contained in:
Frank 2011-01-24 10:04:24 -08:00
parent 6304a92c23
commit 639ddbb45c
6 changed files with 30 additions and 28 deletions

View File

@ -68,7 +68,7 @@ public class OvsListener implements Listener {
// TODO: handle delete failure
}
} catch (Exception e) {
e.printStackTrace();
s_logger.warn("process answer failed", e);
}
if (failedFlowVms.size() > 0) {
_ovsNetworkMgr.scheduleFlowUpdateToHosts(failedFlowVms, false, new Long(10*1000l));
@ -141,7 +141,7 @@ public class OvsListener implements Listener {
}
}
} catch (Exception e) {
e.printStackTrace();
s_logger.warn("process connect failed", e);
}
}

View File

@ -17,7 +17,7 @@ public interface OvsNetworkManager extends Manager {
public boolean isOvsNetworkEnabled();
public void UserVmCheckAndCreateTunnel(Commands cmds,
VirtualMachineProfile<UserVmVO> profile, DeployDestination dest) throws GreTunnelException;
VirtualMachineProfile<UserVmVO> profile, DeployDestination dest);
public void applyDefaultFlowToUserVm(Commands cmds,
VirtualMachineProfile<UserVmVO> profile, DeployDestination dest);
@ -30,7 +30,7 @@ public interface OvsNetworkManager extends Manager {
public void RouterCheckAndCreateTunnel(Commands cmds,
VirtualMachineProfile<DomainRouterVO> profile,
DeployDestination dest) throws GreTunnelException;
DeployDestination dest);
public void fullSync(List<Pair<String, Long>> states);

View File

@ -399,7 +399,7 @@ public class OvsNetworkManagerImpl implements OvsNetworkManager {
handleCreateTunnelAnswer(answers);
}
} catch (Exception e) {
e.printStackTrace();
s_logger.warn("Ovs vlan remap network creates tunnel failed", e);
}
}
@ -448,7 +448,7 @@ public class OvsNetworkManagerImpl implements OvsNetworkManager {
tag, vlans, Long.toString(log.getLogsequence()), instance
.getId()));
} catch (OvsVlanExhaustedException e) {
e.printStackTrace();
s_logger.warn("vlan exhaused on host " + instance.getHostId(), e);
}
}
@ -484,7 +484,7 @@ public class OvsNetworkManagerImpl implements OvsNetworkManager {
router.getName(), tag, vlans, Long.toString(log.getLogsequence()), instance.getId()));
_agentMgr.send(router.getHostId(), cmds, _ovsListener);
} catch (Exception e) {
e.printStackTrace();
s_logger.warn("apply flow to router failed", e);
}
}
@ -608,7 +608,7 @@ public class OvsNetworkManagerImpl implements OvsNetworkManager {
Commands cmds = new Commands(new OvsDeleteFlowCommand(instance.getName()));
_agentMgr.send(hostId, cmds, _ovsListener);
} catch (Exception e) {
e.printStackTrace();
s_logger.warn("remove flow failed", e);
}
}
@ -640,15 +640,23 @@ public class OvsNetworkManagerImpl implements OvsNetworkManager {
@Override
public void UserVmCheckAndCreateTunnel(Commands cmds,
VirtualMachineProfile<UserVmVO> profile, DeployDestination dest) throws GreTunnelException {
CheckAndCreateTunnel(profile.getVirtualMachine(), dest);
VirtualMachineProfile<UserVmVO> profile, DeployDestination dest) {
try {
CheckAndCreateTunnel(profile.getVirtualMachine(), dest);
} catch (Exception e) {
s_logger.warn("create gre tunnel failed", e);
}
}
@Override
public void RouterCheckAndCreateTunnel(Commands cmds,
VirtualMachineProfile<DomainRouterVO> profile,
DeployDestination dest) throws GreTunnelException {
CheckAndCreateTunnel(profile.getVirtualMachine(), dest);
DeployDestination dest) {
try {
CheckAndCreateTunnel(profile.getVirtualMachine(), dest);
} catch (Exception e) {
s_logger.warn("create gre tunnel failed", e);
}
}
@Override

View File

@ -196,7 +196,7 @@ public class OvsTunnelManagerImpl implements OvsTunnelManager {
handleCreateTunnelAnswer(answers);
}
} catch (Exception e) {
e.printStackTrace();
s_logger.debug("Ovs Tunnel network created tunnel failed", e);
}
}

View File

@ -1099,14 +1099,10 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
@Override
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException{
NicProfile controlNic = (NicProfile) profile.getParameter("control.nic");
try {
_ovsNetworkMgr.RouterCheckAndCreateTunnel(cmds, profile, dest);
_ovsNetworkMgr.applyDefaultFlowToRouter(cmds, profile, dest);
_ovsTunnelMgr.RouterCheckAndCreateTunnel(cmds, profile, dest);
} catch (GreTunnelException e) {
e.printStackTrace();
}
_ovsNetworkMgr.RouterCheckAndCreateTunnel(cmds, profile, dest);
_ovsNetworkMgr.applyDefaultFlowToRouter(cmds, profile, dest);
_ovsTunnelMgr.RouterCheckAndCreateTunnel(cmds, profile, dest);
cmds.addCommand("checkSsh", new CheckSshCommand(profile.getInstanceName(), controlNic.getIp4Address(), 3922, 5, 20));

View File

@ -2211,13 +2211,11 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
_vmDao.update(userVm.getId(), userVm);
try {
_ovsNetworkMgr.UserVmCheckAndCreateTunnel(cmds, profile, dest);
_ovsNetworkMgr.applyDefaultFlowToUserVm(cmds, profile, dest);
_ovsTunnelMgr.UserVmCheckAndCreateTunnel(cmds, profile, dest);
} catch (GreTunnelException e) {
e.printStackTrace();
}
_ovsNetworkMgr.UserVmCheckAndCreateTunnel(cmds, profile, dest);
_ovsNetworkMgr.applyDefaultFlowToUserVm(cmds, profile, dest);
_ovsTunnelMgr.UserVmCheckAndCreateTunnel(cmds, profile, dest);
return true;
}