CLOUDSTACK-6755: [OVS] Can't create more than 7 GRE tunnel networks in

xen cluster

XenServer does not create a bridge automatically when VIF from domU is connected
to internal network. So there is logic to force bridge creation by
creating VIF in dom0 connected to GRE tunnel network. But there is no
logic to delete the VIF after bridge gets created. So this fix ensure
VIF is delted when atleast there is one domU VIF connected to the
network.
This commit is contained in:
Murali Reddy 2014-06-12 13:50:01 +05:30
parent 2482da8cbf
commit f4d4e3ffe4
1 changed files with 19 additions and 2 deletions

View File

@ -898,7 +898,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
* if you create a network then create bridge by brctl or openvswitch yourself,
* then you will get an expection that is "REQUIRED_NETWROK" when you start a
* vm with this network. The soultion is, create a vif of dom0 and plug it in
* network, xenserver will create the bridge on behalf of you
* network, xenserver will create the bridge on behalf of you. But we can not keep the dom0 vif for the entire
* existence of network, as we will seen reach max VIF (8) that can be conencted to a domain. So as soon as we have
* one more VIF for any of the VM, delete dom0 VIF so that we can scale beyond 8 networks on a host.
* @throws XmlRpcException
* @throws XenAPIException
*/
@ -917,7 +919,17 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
}
}
if (dom0vif == null) {
int domuVifCount=0;
Set<VIF> domUVifs = nw.getVIFs(conn);
Host host = Host.getByUuid(conn, _host.uuid);
for (VIF vif : domUVifs) {
vif.getRecord(conn);
if (vif.getVM(conn).getResidentOn(conn).equals(host)) {
domuVifCount++;
}
}
if (dom0vif == null && domuVifCount == 0) {
s_logger.debug("Create a vif on dom0 for " + networkDesc);
VIF.Record vifr = new VIF.Record();
vifr.VM = dom0;
@ -944,6 +956,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
}
dom0vif.unplug(conn);
}
if (dom0vif != null && domuVifCount > 1) {
// now that there is at least one more VIF (other than dom0 vif) destroy dom0 VIF
dom0vif.destroy(conn);
}
}
private synchronized Network setupvSwitchNetwork(Connection conn) {