Removing superfluous log statements

This commit is contained in:
Salvatore Orlando 2012-03-20 12:57:18 +00:00
parent 2340ebced3
commit 02cd1484b7
4 changed files with 14 additions and 56 deletions

View File

@ -561,7 +561,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
vif.getRecord(conn);
if (vif.getNetwork(conn).getUuid(conn) == nw.getUuid(conn)) {
dom0vif = vif;
s_logger.debug("### A dom0 VIF has already been found - No need to create one");
s_logger.debug("A VIF for dom0 has already been found - No need to create one");
}
}
if (dom0vif == null) {
@ -640,7 +640,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
s_logger.debug("### Xen Server network for tunnels created:" + nwName);
} else {
nw = networks.iterator().next();
s_logger.debug("### Xen Server network for tunnels found:" + nwName);
s_logger.debug("Xen Server network for tunnels found:" + nwName);
}
return nw;
} catch (Exception e) {
@ -655,7 +655,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
private synchronized Network configureTunnelNetwork(Connection conn, long networkId, long hostId, int key) {
try {
Network nw = findOrCreateTunnelNetwork(conn, networkId);
>>>>>>> fb7dcaa... Now using vnets instead of network id for creating networks
//Invoke plugin to setup the bridge which will be used by this network
String bridge = nw.getBridge(conn);
Map<String,String> nwOtherConfig = nw.getOtherConfig(conn);
@ -4793,35 +4792,30 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
private Answer execute(OvsSetupBridgeCommand cmd) {
Connection conn = getConnection();
s_logger.debug("### About to configure OVS bridge");
Network nw=findOrCreateTunnelNetwork(conn, cmd.getKey());
this.configureTunnelNetwork(conn, cmd.getNetworkId(), cmd.getHostId(), cmd.getKey());
s_logger.debug("### Bridge configured");
findOrCreateTunnelNetwork(conn, cmd.getKey());
configureTunnelNetwork(conn, cmd.getNetworkId(), cmd.getHostId(), cmd.getKey());
s_logger.debug("OVS Bridge configured");
return new Answer(cmd, true, null);
}
private Answer execute(OvsDestroyBridgeCommand cmd) {
Connection conn = getConnection();
s_logger.debug("### About to destroy OVS bridge");
destroyTunnelNetwork(conn, cmd.getKey());
s_logger.debug("### Bridge destroyed");
s_logger.debug("OVS Bridge destroyed");
return new Answer(cmd, true, null);
}
private Answer execute(OvsDestroyTunnelCommand cmd) {
Connection conn = getConnection();
s_logger.debug("### About to destroy tunnel network");
try {
Network nw = findOrCreateTunnelNetwork(conn, cmd.getNetworkId());
if (nw == null) {
s_logger.warn("### Unable to find tunnel network");
s_logger.warn("Unable to find tunnel network for GRE key:" + cmd.getKey());
return new Answer(cmd, false, "No network found");
}
String bridge = nw.getBridge(conn);
s_logger.debug("### About to remove tunnel named:" + cmd.getInPortName());
String result = callHostPlugin(conn, "ovstunnel", "destroy_tunnel", "bridge", bridge, "in_port", cmd.getInPortName());
s_logger.debug("### Tunnel removed");
if (result.equalsIgnoreCase("SUCCESS")) {
return new Answer(cmd, true, result);
} else {
@ -4843,19 +4837,16 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
Connection conn = getConnection();
String bridge = "unknown";
try {
s_logger.debug("### About to create tunnel network");
Network nw = findOrCreateTunnelNetwork(conn, cmd.getKey());
if (nw == null) {
s_logger.debug("### SOMETHING WENT WRONG DURING NETWORK SETUP");
s_logger.debug("Error during bridge setup");
return new OvsCreateTunnelAnswer(cmd, false, "Cannot create network", bridge);
}
configureTunnelNetwork(conn, cmd.getNetworkId(), cmd.getFrom(), cmd.getKey());
bridge = nw.getBridge(conn);
s_logger.debug("### The bridge is:" + bridge);
String result = callHostPlugin(conn, "ovstunnel", "create_tunnel", "bridge", bridge, "remote_ip", cmd.getRemoteIp(),
"key", cmd.getKey().toString(), "from", cmd.getFrom().toString(), "to", cmd.getTo().toString());
s_logger.debug("### Result from create tunnel operation:" + result);
String[] res = result.split(":");
if (res.length == 2 && res[0].equalsIgnoreCase("SUCCESS")) {
return new OvsCreateTunnelAnswer(cmd, true, result, res[1], bridge);
@ -4863,8 +4854,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
return new OvsCreateTunnelAnswer(cmd, false, result, bridge);
}
} catch (Exception e) {
s_logger.debug("### SOMETHING WENT WRONG DURING TUNNEL SETUP");
s_logger.warn("caught execption when creating ovs tunnel", e);
s_logger.debug("Error during tunnel setup");
s_logger.warn("Caught execption when creating ovs tunnel", e);
return new OvsCreateTunnelAnswer(cmd, false, e.getMessage(), bridge);
}
}
@ -5247,14 +5238,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
VDI vdi = null;
try {
SR poolSr = getStorageRepository(conn, pool);
s_logger.debug("### STORAGE CREATE - Template URL:" + cmd.getTemplateUrl());
if (cmd.getTemplateUrl() != null) {
VDI tmpltvdi = null;
tmpltvdi = getVDIbyUuid(conn, cmd.getTemplateUrl());
s_logger.debug("### STORAGE CREATE - ABOUT TO CLONE VDI:" + tmpltvdi.getUuid(conn));
vdi = tmpltvdi.createClone(conn, new HashMap<String, String>());
s_logger.debug("### STORAGE CREATE - CLoned VDI:" + vdi.getUuid(conn));
vdi.setNameLabel(conn, dskch.getName());
} else {
VDI.Record vdir = new VDI.Record();
@ -5263,9 +5251,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
vdir.type = Types.VdiType.USER;
vdir.virtualSize = dskch.getSize();
s_logger.debug("### STORAGE CREATE - Creating VDI with size:" + dskch.getSize());
vdi = VDI.create(conn, vdir);
s_logger.debug("### STORAGE CREATE - VDI created:" + vdi.getUuid(conn));
}
VDI.Record vdir;

View File

@ -80,7 +80,6 @@ public class OvsGuestNetworkGuru extends GuestNetworkGuru {
vnetUri = vnet;
}
implemented.setBroadcastUri(BroadcastDomainType.Vswitch.toUri(vnetUri));
s_logger.debug("### URI value:" + vnetUri);
EventUtils.saveEvent(UserContext.current().getCallerUserId(), network.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_ZONE_VLAN_ASSIGN, "Assigned Zone Vlan: "+vnet+ " Network Id: "+network.getId(), 0);
} else {
implemented.setBroadcastUri(network.getBroadcastUri());
@ -93,8 +92,6 @@ public class OvsGuestNetworkGuru extends GuestNetworkGuru {
if (!_ovsNetworkMgr.isOvsNetworkEnabled()&& !_ovsTunnelMgr.isOvsTunnelEnabled()) {
return null;
}
s_logger.debug("### Implementing network:" + config.getId() + " in OVS Guest Network Guru");
// The above call will NOT reserve a Vnet
NetworkVO implemented = (NetworkVO)super.implement(config, offering, dest, context);
return implemented;
}

View File

@ -19,11 +19,11 @@ import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface OvsTunnelManager extends Manager {
boolean isOvsTunnelEnabled();
public void VmCheckAndCreateTunnel(VirtualMachineProfile<? extends VirtualMachine> vm, Network nw, DeployDestination dest);
public void CheckAndDestroyTunnel(VirtualMachine vm, Network nw);
public void applyDefaultFlow(VirtualMachine instance, DeployDestination dest);
}

View File

@ -34,17 +34,13 @@ import com.cloud.deploy.DeployDestination;
import com.cloud.host.HostVO;
import com.cloud.host.dao.HostDao;
import com.cloud.network.Network;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.ovs.dao.OvsTunnelNetworkDao;
import com.cloud.network.ovs.dao.OvsTunnelNetworkVO;
import com.cloud.network.ovs.dao.OvsTunnelDao;
import com.cloud.utils.Pair;
import com.cloud.utils.component.Inject;
import com.cloud.utils.concurrency.NamedThreadFactory;
import com.cloud.utils.db.DB;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.DomainRouterVO;
import com.cloud.vm.NicVO;
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
@ -318,13 +314,11 @@ public class OvsTunnelManagerImpl implements OvsTunnelManager {
@Override
public void CheckAndDestroyTunnel(VirtualMachine vm, Network nw) {
s_logger.debug("### DESTROYING YOUR TUNNELS!");
if (!_isEnabled) {
return;
}
List<UserVmVO> userVms = _userVmDao.listByAccountIdAndHostId(vm.getAccountId(), vm.getHostId());
s_logger.debug("### User Vms:" + userVms.size());
if (vm.getType() == VirtualMachine.Type.User) {
if (userVms.size() > 1) {
return;
@ -333,20 +327,18 @@ public class OvsTunnelManagerImpl implements OvsTunnelManager {
List<DomainRouterVO> routers = _routerDao.findByNetwork(nw.getId());
for (DomainRouterVO router : routers) {
if (router.getHostId() == vm.getHostId()) {
s_logger.debug("### Not destroying because on same host as router");
return;
}
}
} else if (vm.getType() == VirtualMachine.Type.DomainRouter && userVms.size() != 0) {
return;
}
s_logger.debug("### I WILL DESTROYYY");
try {
/* Now we are last one on host, destroy the bridge with all
* the tunnels for this network */
int key = getGreKey(nw);
Command cmd = new OvsDestroyBridgeCommand(nw.getId(), key);
s_logger.debug("### Destroying bridge for network " + nw.getId() + " on host:" + vm.getHostId());
s_logger.debug("Destroying bridge for network " + nw.getId() + " on host:" + vm.getHostId());
Answer ans = _agentMgr.send(vm.getHostId(), cmd);
handleDestroyBridgeAnswer(ans, vm.getHostId(), nw.getId());
@ -356,7 +348,7 @@ public class OvsTunnelManagerImpl implements OvsTunnelManager {
// If the tunnel was not successfully created don't bother to remove it
if (p.getState().equals("SUCCESS")) {
cmd = new OvsDestroyTunnelCommand(p.getNetworkId(), key, p.getPortName());
s_logger.debug("### Destroying tunnel to " + vm.getHostId() +
s_logger.debug("Destroying tunnel to " + vm.getHostId() +
" from " + p.getFrom());
ans = _agentMgr.send(p.getFrom(), cmd);
handleDestroyTunnelAnswer(ans, p.getFrom(), p.getTo(), p.getNetworkId());
@ -368,21 +360,4 @@ public class OvsTunnelManagerImpl implements OvsTunnelManager {
}
@Override
public void applyDefaultFlow(VirtualMachine instance,
DeployDestination dest) {
if (!_isEnabled) {
return;
}
VirtualMachine.Type vmType = instance.getType();
if (vmType != VirtualMachine.Type.User
&& vmType != VirtualMachine.Type.DomainRouter) {
return;
}
s_logger.debug("### Applying rules for allowing broadcast traffic");
}
}