Repository: cloudstack Updated Branches: refs/heads/master 2482da8cb -> f4d4e3ffe
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. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f4d4e3ff Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f4d4e3ff Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f4d4e3ff Branch: refs/heads/master Commit: f4d4e3ffe4575ab0421a33685083fbfaf8a5527e Parents: 2482da8 Author: Murali Reddy <muralimmre...@gmail.com> Authored: Thu Jun 12 13:50:01 2014 +0530 Committer: Murali Reddy <muralimmre...@gmail.com> Committed: Thu Jun 12 14:22:56 2014 +0530 ---------------------------------------------------------------------- .../xenserver/resource/CitrixResourceBase.java | 21 ++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4d4e3ff/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java index 97915fa..9979802 100644 --- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java @@ -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) {