cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [5/50] git commit: refs/heads/ui-multiple-vlan-ranges - CLOUDSTACK-1461: Don't set dns server for non-default ipv6 network
Date Wed, 13 Mar 2013 22:22:08 GMT
CLOUDSTACK-1461: Don't set dns server for non-default ipv6 network

The non-default parameter can be used by ipv4 as well in the future.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/e35ce658
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/e35ce658
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/e35ce658

Branch: refs/heads/ui-multiple-vlan-ranges
Commit: e35ce6587a2519fdbc56e8859ad6aa7dac00dd47
Parents: e40ebcc
Author: Sheng Yang <sheng.yang@citrix.com>
Authored: Fri Mar 8 17:42:06 2013 -0800
Committer: Sheng Yang <sheng.yang@citrix.com>
Committed: Fri Mar 8 17:43:23 2013 -0800

----------------------------------------------------------------------
 .../cloud/agent/api/routing/DhcpEntryCommand.java  |   10 +++++++++
 .../virtualnetwork/VirtualRoutingResource.java     |    4 +++
 .../debian/config/etc/init.d/cloud-early-config    |    4 ++-
 patches/systemvm/debian/config/root/edithosts.sh   |   16 +++++++++++---
 .../hypervisor/vmware/resource/VmwareResource.java |    6 ++++-
 .../xen/resource/CitrixResourceBase.java           |    4 +++
 scripts/network/domr/dhcp_entry.sh                 |    6 +++-
 .../router/VirtualNetworkApplianceManagerImpl.java |    3 +-
 8 files changed, 44 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e35ce658/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java b/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
index f0ce70e..fd8d84c 100644
--- a/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
+++ b/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
@@ -31,6 +31,7 @@ public class DhcpEntryCommand extends NetworkElementCommand {
     String vmIp6Address;
     String ip6Gateway;
     String duid;
+    private boolean isDefault;
 
     protected DhcpEntryCommand() {
 
@@ -46,6 +47,7 @@ public class DhcpEntryCommand extends NetworkElementCommand {
         this.vmIpAddress = vmIpAddress;
         this.vmName = vmName;
         this.vmIp6Address = vmIp6Address;
+        this.setDefault(true);
     }
 
     public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String vmIp6Address,
String dns, String gateway, String ip6Gateway) {
@@ -129,4 +131,12 @@ public class DhcpEntryCommand extends NetworkElementCommand {
 	public void setVmIp6Address(String ip6Address) {
 		this.vmIp6Address = ip6Address;
 	}
+
+	public boolean isDefault() {
+		return isDefault;
+	}
+
+	public void setDefault(boolean isDefault) {
+		this.isDefault = isDefault;
+	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e35ce658/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
index 9dd471d..7148e07 100755
--- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
+++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
@@ -600,6 +600,10 @@ public class VirtualRoutingResource implements Manager {
         	command.add("-6", cmd.getVmIp6Address());
         	command.add("-u", cmd.getDuid());
         }
+        
+        if (!cmd.isDefault()) {
+        	command.add("-z");
+        }
 
         final String result = command.execute();
         return new Answer(cmd, result==null, result);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e35ce658/patches/systemvm/debian/config/etc/init.d/cloud-early-config
----------------------------------------------------------------------
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 4fb0a9b..877ab06 100755
--- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config
+++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
@@ -425,7 +425,6 @@ setup_dnsmasq() {
         sed -r -i s/^[#]?domain=.*$/domain=$DOMAIN/ /etc/dnsmasq.conf
         #answer all local domain queries
         sed  -i -e "s/^[#]*local=.*$/local=\/$DOMAIN\//" /etc/dnsmasq.conf
-
   fi
   
   if [ -n  "$DNS_SEARCH_ORDER" ]
@@ -447,6 +446,9 @@ setup_dnsmasq() {
   if [ $DHCP_RANGE_IP6 ]
   then
     sed -i -e "s/^dhcp-range_ip6=.*$/dhcp-range=$DHCP_RANGE_IP6,static/" /etc/dnsmasq.conf
+    # For nondefault6 tagged host, don't send dns-server information
+    sed -i /nondefault6/d /etc/dnsmasq.conf
+    echo "dhcp-option=nondefault6,option6:dns-server" >> /etc/dnsmasq.conf
   else
     sed -i -e "s/^dhcp-range_ip6=.*$//" /etc/dnsmasq.conf
   fi

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e35ce658/patches/systemvm/debian/config/root/edithosts.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/root/edithosts.sh b/patches/systemvm/debian/config/root/edithosts.sh
index 257de92..9f21f20 100755
--- a/patches/systemvm/debian/config/root/edithosts.sh
+++ b/patches/systemvm/debian/config/root/edithosts.sh
@@ -27,7 +27,7 @@
 # $6 : comma separated static routes
 
 usage() {
-  printf "Usage: %s: -m <MAC address> -4 <IPv4 address> -6 <IPv6 address>
-h <hostname> -d <default router> -n <name server address> -s <Routes>
-u <DUID>\n" $(basename $0) >&2
+  printf "Usage: %s: -m <MAC address> -4 <IPv4 address> -6 <IPv6 address>
-h <hostname> -d <default router> -n <name server address> -s <Routes>
-u <DUID> [-N]\n" $(basename $0) >&2
 }
 
 mac=
@@ -38,8 +38,9 @@ dflt=
 dns=
 routes=
 duid=
+nondefault=
 
-while getopts 'm:4:h:d:n:s:6:u:' OPTION
+while getopts 'm:4:h:d:n:s:6:u:N' OPTION
 do
   case $OPTION in
   m)    mac="$OPTARG"
@@ -58,6 +59,8 @@ do
         ;;
   s)    routes="$OPTARG"
         ;;
+  N)    nondefault=1
+        ;;
   ?)    usage
         exit 2
         ;;
@@ -120,7 +123,12 @@ then
 fi
 if [ $ipv6 ]
 then
-  echo "id:$duid,[$ipv6],$host,infinite" >>$DHCP_HOSTS
+  if [ $nondefault ]
+  then
+    echo "id:$duid,set:nondefault6,[$ipv6],$host,infinite" >>$DHCP_HOSTS
+  else
+    echo "id:$duid,[$ipv6],$host,infinite" >>$DHCP_HOSTS
+  fi
 fi
 
 #delete leases to supplied mac and ip addresses
@@ -176,8 +184,8 @@ then
   if [ "$dflt" == "0.0.0.0" ]
   then
     logger -t cloud "$0: unset default router for $ipv4"
+    logger -t cloud "$0: unset dns server for $ipv4"
     echo "$tag,3" >> $DHCP_OPTS
-    logger -t cloud "$0: setting dns server for $ipv4 to $dns"
     echo "$tag,6" >> $DHCP_OPTS
     echo "$tag,15" >> $DHCP_OPTS
   fi

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e35ce658/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 83226a4..155d6d9 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -1755,7 +1755,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         	args += " -6 " + cmd.getVmIp6Address();
         	args += " -u " + cmd.getDuid();
         }
-
+        
+        if (!cmd.isDefault()) {
+        	args += " -N";
+        }
+        
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP)
+ ", /root/edithosts.sh " + args);
         }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e35ce658/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 4a89806..886fc6f 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
@@ -1890,6 +1890,10 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
         	args += " -u " + cmd.getDuid();
         }
         
+        if (!cmd.isDefault()) {
+        	args += " -z";
+        }
+        
         String result = callHostPlugin(conn, "vmops", "saveDhcpEntry", "args", args);
         if (result == null || result.isEmpty()) {
             return new Answer(cmd, false, "DhcpEntry failed");

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e35ce658/scripts/network/domr/dhcp_entry.sh
----------------------------------------------------------------------
diff --git a/scripts/network/domr/dhcp_entry.sh b/scripts/network/domr/dhcp_entry.sh
index e417f72..fb5a166 100755
--- a/scripts/network/domr/dhcp_entry.sh
+++ b/scripts/network/domr/dhcp_entry.sh
@@ -22,7 +22,7 @@
 # @VERSION@
 
 usage() {
-  printf "Usage: %s: -r <domr-ip> -m <vm mac> -v <vm ip> -n <vm name>
-s <static route> -d <default router> -N <dns> -6 <vm IPv6> -u <duid>\n"
$(basename $0) >&2
+  printf "Usage: %s: -r <domr-ip> -m <vm mac> -v <vm ip> -n <vm name>
-s <static route> -d <default router> -N <dns> -6 <vm IPv6> -u <duid>
[-z]\n" $(basename $0) >&2
   exit 2
 }
 
@@ -40,7 +40,7 @@ duid=
 
 opts=
 
-while getopts 'r:m:v:n:d:s:N:6:u:' OPTION
+while getopts 'r:m:v:n:d:s:N:6:u:z' OPTION
 do
   case $OPTION in
   r)  domrIp="$OPTARG"
@@ -69,6 +69,8 @@ do
   u)  duid="$OPTARG"
       opts="$opts -u $duid"
       ;;
+  z)  opts="$opts -N"
+      ;;
   ?)  usage
       exit 1
       ;;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e35ce658/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index b387ab5..3cbd51d 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -3116,9 +3116,9 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase
implements V
                 if (guestOS.getDisplayName().startsWith(name)) {
                     needGateway = true;
                     break;
+                }
             }
         }
-        }
         if (!needGateway) {
             gatewayIp = "0.0.0.0";
         }
@@ -3126,6 +3126,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase
implements V
         dhcpCommand.setIp6Gateway(nic.getIp6Gateway());
         dhcpCommand.setDefaultDns(findDefaultDnsIp(vm.getId()));
         dhcpCommand.setDuid(NetUtils.getDuidLL(nic.getMacAddress()));
+        dhcpCommand.setDefault(nic.isDefaultNic());
 
         dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId()));
         dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());


Mime
View raw message