Repository: cloudstack Updated Branches: refs/heads/4.4-forward 32a7d5d38 -> 9e4e62466
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/9e4e6246 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9e4e6246 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9e4e6246 Branch: refs/heads/4.4-forward Commit: 9e4e62466a8c3d00ab5381d7ebfeb70466192a55 Parents: 32a7d5d Author: Murali Reddy <[email protected]> Authored: Thu Jun 12 13:50:01 2014 +0530 Committer: Murali Reddy <[email protected]> Committed: Thu Jun 12 14:20:49 2014 +0530 ---------------------------------------------------------------------- .../xen/resource/CitrixResourceBase.java | 21 ++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e4e6246/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index 93feb07..1a24f19 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -902,7 +902,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 */ @@ -921,7 +923,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; @@ -948,6 +960,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) {
