From 2f804dd799a08bee5a3f5949ff7dc5c35000c424 Mon Sep 17 00:00:00 2001 From: Abhinandan Prateek Date: Tue, 2 Aug 2011 16:21:55 +0530 Subject: [PATCH] bug 10748: use external dns, configurable thru global param --- .../debian/config/etc/init.d/cloud-early-config | 17 +++++++++++++++++ server/src/com/cloud/configuration/Config.java | 1 + .../VirtualNetworkApplianceManagerImpl.java | 8 +++++++- setup/db/db/schema-228to229.sql | 4 ++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config index 50085dbbd12..c1986b55eac 100755 --- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config +++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config @@ -271,6 +271,20 @@ setup_dnsmasq() { then sed -i s/[#]*dhcp-option=119.*$/dhcp-option=119,\"$DOMAIN_SUFFIX\"/ /etc/dnsmasq.conf fi + + if [ "$USE_EXTERNAL_DNS" == "true" ] + then + sed -i -e "/^[#]*dhcp-option=6.*$/d" /etc/dnsmasq.conf + if [ -n "$NS1" ] + then + if [ -n "$NS2" ] + then + echo "dhcp-option=6,$NS1,$NS2" >> /etc/dnsmasq.conf + else + echo "dhcp-option=6,$NS1" >> /etc/dnsmasq.conf + fi + fi + fi } setup_sshd(){ @@ -539,6 +553,9 @@ for i in $CMDLINE domainsuffix) DOMAIN_SUFFIX=$VALUE ;; + useextdns) + USE_EXTERNAL_DNS=$VALUE + ;; mgmtcidr) MGMTNET=$VALUE ;; diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index c1c4eb6f6e5..ac83d562e8b 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -249,6 +249,7 @@ public enum Config { AgentLbEnable("Advanced", ClusterManager.class, Boolean.class, "agent.lb.enabled", "true", "If agent load balancing enabled in cluster setup", null), SubDomainNetworkAccess("Advanced", NetworkManager.class, Boolean.class, "allow.subdomain.network.access", "true", "Allow subdomains to use networks dedicated to their parent domain(s)", null), + UseExternalDnsServers("Advanced", NetworkManager.class, Boolean.class, "use.external.dns", "false", "Bypass internal dns, use exetrnal dns1 and dns2", null), EncodeApiResponse("Advanced", ManagementServer.class, Boolean.class, "encode.api.response", "false", "Do UTF-8 encoding for the api response, false by default", null), DnsBasicZoneUpdates("Advanced", NetworkManager.class, String.class, "network.dns.basiczone.updates", "all", "This parameter can take 2 values: all (default) and pod. It defines if DHCP/DNS requests have to be send to all dhcp servers in cloudstack, or only to the one in the same pod", "all,pod"), diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index dbc3aa5cad7..f4c6be44169 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -1226,6 +1226,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian if (domain_suffix != null) { buf.append(" domainsuffix=").append(domain_suffix); } + if (!network.isDefault() && network.getGuestType() == GuestIpType.Direct) { buf.append(" defaultroute=false"); @@ -1244,7 +1245,12 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian if (defaultDns2 != null) { buf.append(" dns2=").append(defaultDns2); } - + + String use_external_dns = _configDao.getValue("use.external.dns"); + if (use_external_dns!=null && use_external_dns.equals("true")){ + buf.append(" useextdns=").append(use_external_dns); + } + if (s_logger.isDebugEnabled()) { s_logger.debug("Boot Args for " + profile + ": " + buf.toString()); } diff --git a/setup/db/db/schema-228to229.sql b/setup/db/db/schema-228to229.sql index 6d9eb784271..8ab72afde20 100644 --- a/setup/db/db/schema-228to229.sql +++ b/setup/db/db/schema-228to229.sql @@ -19,4 +19,8 @@ INSERT IGNORE INTO configuration VALUES ('Network', 'DEFAULT', 'management-serve INSERT IGNORE INTO configuration VALUES ('Network', 'DEFAULT', 'management-server', 'network.loadbalancer.haproxy.stats.auth','admin1:AdMiN123','Load Balancer(haproxy) authetication string in the format username:password'); INSERT IGNORE INTO configuration VALUES ('Network', 'DEFAULT', 'management-server', 'network.loadbalancer.haproxy.stats.port','8081','Load Balancer(haproxy) stats port number.'); +<<<<<<< HEAD +======= +INSERT IGNORE INTO configuration VALUES ('Advanced', 'DEFAULT', 'NetworkManager', 'use.external.dns', 'false', 'Bypass internal dns, use exetrnal dns1 and dns2'); +>>>>>>> e7f32ad... bug 10748: use external dns