fix KVM plug-in for OVS tunnel network. Fix addreses two issues.

fix  mismatch of ovs-host-setup, ovs_host_setup used Libvirt resource and
scripts

plug the nic to OVS bridges created for the tunnel network.

Conflicts:
	plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java
This commit is contained in:
Murali Reddy 2014-04-18 18:09:26 +05:30
parent 095151c98a
commit 771abe4286
3 changed files with 9 additions and 5 deletions

View File

@ -1484,7 +1484,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
otherConfig.put("ovs-host-setup", "");
Script.runSimpleBashScript("ovs-vsctl -- --may-exist add-br "
+ nwName + " -- set bridge " + nwName
+ " other_config:ovs_host_setup='-1'");
+ " other_config:ovs-host-setup='-1'");
s_logger.debug("### KVM network for tunnels created:" + nwName);
} catch (Exception e) {
s_logger.warn("createTunnelNetwork failed", e);
@ -1498,7 +1498,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
findOrCreateTunnelNetwork(nwName);
String configuredHosts = Script
.runSimpleBashScript("ovs-vsctl get bridge " + nwName
+ " other_config:ovs_host_setup");
+ " other_config:ovs-host-setup");
boolean configured = false;
if (configuredHosts != null) {
String hostIdsStr[] = configuredHosts.split(",");

View File

@ -88,6 +88,11 @@ public class OvsVifDriver extends VifDriverBase {
intf.setVirtualPortInterfaceId(nic.getUuid());
String brName = (trafficLabel != null && !trafficLabel.isEmpty()) ? _pifs.get(trafficLabel) : _pifs.get("private");
intf.defBridgeNet(brName, null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), networkRateKBps);
} else if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vswitch) {
String vnetId = Networks.BroadcastDomainType.getValue(nic.getBroadcastUri());
String brName = "OVSTunnel" + vnetId;
s_logger.debug("nic " + nic + " needs to be connected to LogicalSwitch " + brName);
intf.defBridgeNet(brName, null, nic.getMac(), getGuestNicModel(guestOsType), networkRateKBps);
} else {
intf.defBridgeNet(_bridges.get("guest"), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), networkRateKBps);
}

View File

@ -27,7 +27,7 @@ import os
import sys
import subprocess
import time
import simplejson as json
import json
from optparse import OptionParser, OptionGroup, OptParseError, BadOptionError, OptionError, OptionConflictError, OptionValueError
from time import localtime as _localtime, asctime as _asctime
@ -73,7 +73,6 @@ def setup_ovs_bridge(bridge, key, cs_host_id):
logging.debug("Setup_ovs_bridge completed with result:%s" % result)
return result
@echo
def setup_ovs_bridge_for_distributed_routing(bridge, cs_host_id):
res = lib.check_switch()
@ -281,7 +280,7 @@ if __name__ == '__main__':
parser.add_option("--src_host", dest="src_host")
parser.add_option("--dst_host", dest="dst_host")
parser.add_option("--iface_name", dest="iface_name")
parser.ad_option("--config", dest="config")
parser.add_option("--config", dest="config")
(option, args) = parser.parse_args()
if len(args) == 0:
logging.debug("No command to execute")