mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	bug 10812: adding domain suffixes to zone's router conf
This commit is contained in:
		
							parent
							
								
									40f42a784f
								
							
						
					
					
						commit
						46be774ce8
					
				@ -33,6 +33,7 @@ public class ApiConstants {
 | 
			
		||||
    public static final String CERTIFICATE = "certificate";    
 | 
			
		||||
    public static final String PRIVATE_KEY = "privatekey";    
 | 
			
		||||
    public static final String DOMAIN_SUFFIX = "domainsuffix";    
 | 
			
		||||
    public static final String DOMAIN_SUFFIX_LIST = "domainsuffixlist";    
 | 
			
		||||
    public static final String CIDR = "cidr";
 | 
			
		||||
    public static final String CIDR_LIST = "cidrlist";
 | 
			
		||||
    public static final String CLEANUP = "cleanup";
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,7 @@
 | 
			
		||||
 | 
			
		||||
package com.cloud.api.commands;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import org.apache.log4j.Logger;
 | 
			
		||||
@ -80,6 +81,9 @@ public class UpdateZoneCmd extends BaseCmd {
 | 
			
		||||
    @Parameter(name=ApiConstants.DOMAIN, type=CommandType.STRING, description="Network domain name for the networks in the zone")
 | 
			
		||||
    private String domain;
 | 
			
		||||
    
 | 
			
		||||
    @Parameter(name=ApiConstants.DOMAIN_SUFFIX_LIST, type=CommandType.LIST, collectionType = CommandType.STRING, description="the list of domain suffixes for dns")
 | 
			
		||||
    private List<String> domainSuffixList;   
 | 
			
		||||
    
 | 
			
		||||
    /////////////////////////////////////////////////////
 | 
			
		||||
    /////////////////// Accessors ///////////////////////
 | 
			
		||||
    /////////////////////////////////////////////////////
 | 
			
		||||
@ -136,6 +140,9 @@ public class UpdateZoneCmd extends BaseCmd {
 | 
			
		||||
        return domain;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public List<String> getDomainSuffixList() {
 | 
			
		||||
        return domainSuffixList;
 | 
			
		||||
    }   
 | 
			
		||||
    /////////////////////////////////////////////////////
 | 
			
		||||
    /////////////// API Implementation///////////////////
 | 
			
		||||
    /////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
@ -252,6 +252,9 @@ dhcp-hostsfile=/etc/dhcphosts.txt
 | 
			
		||||
# Set the domain
 | 
			
		||||
dhcp-option=15,"2.vmops-test.vmops.com"
 | 
			
		||||
 | 
			
		||||
# Send RFC-3397 DNS domain search DHCP option.
 | 
			
		||||
#dhcp-option=119,"vmops.com"
 | 
			
		||||
 | 
			
		||||
# Send the etherboot magic flag and then etherboot options (a string).
 | 
			
		||||
#dhcp-option=128,e4:45:74:68:00:00
 | 
			
		||||
#dhcp-option=129,NIC=eepro100
 | 
			
		||||
 | 
			
		||||
@ -266,6 +266,11 @@ setup_dnsmasq() {
 | 
			
		||||
      sed -i -e "/^[#]*dhcp-option=6.*$/d" /etc/dnsmasq.conf
 | 
			
		||||
      echo "dhcp-option=6,$GUEST_GW" >> /etc/dnsmasq.conf
 | 
			
		||||
  fi
 | 
			
		||||
  
 | 
			
		||||
  if [ -n "$DOMAIN_SUFFIX" ]
 | 
			
		||||
  then
 | 
			
		||||
    sed -i s/[#]*dhcp-option=119.*$/dhcp-option=119,\"$DOMAIN_SUFFIX\"/ /etc/dnsmasq.conf
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
setup_sshd(){
 | 
			
		||||
@ -531,6 +536,9 @@ for i in $CMDLINE
 | 
			
		||||
      domain)
 | 
			
		||||
          DOMAIN=$VALUE
 | 
			
		||||
          ;;
 | 
			
		||||
      domainsuffix)
 | 
			
		||||
          DOMAIN_SUFFIX=$VALUE
 | 
			
		||||
          ;;
 | 
			
		||||
      mgmtcidr)
 | 
			
		||||
          MGMTNET=$VALUE
 | 
			
		||||
          ;;
 | 
			
		||||
 | 
			
		||||
@ -121,6 +121,7 @@ import com.cloud.user.UserContext;
 | 
			
		||||
import com.cloud.user.dao.AccountDao;
 | 
			
		||||
import com.cloud.user.dao.UserDao;
 | 
			
		||||
import com.cloud.utils.NumbersUtil;
 | 
			
		||||
import com.cloud.utils.StringUtils;
 | 
			
		||||
import com.cloud.utils.component.Adapters;
 | 
			
		||||
import com.cloud.utils.component.ComponentLocator;
 | 
			
		||||
import com.cloud.utils.component.Inject;
 | 
			
		||||
@ -1155,6 +1156,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
 | 
			
		||||
        String internalDns2 = cmd.getInternalDns2();
 | 
			
		||||
        String vnetRange = cmd.getVlan();
 | 
			
		||||
        String guestCidr = cmd.getGuestCidrAddress();
 | 
			
		||||
        List<String> domainSuffixList = cmd.getDomainSuffixList();
 | 
			
		||||
        Long userId = UserContext.current().getCallerUserId();
 | 
			
		||||
        int startVnetRange = 0;
 | 
			
		||||
        int stopVnetRange = 0;
 | 
			
		||||
@ -1183,6 +1185,11 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
 | 
			
		||||
            }
 | 
			
		||||
        }  
 | 
			
		||||
        
 | 
			
		||||
        // add the domain prefix list to details if not null
 | 
			
		||||
        if (domainSuffixList != null){
 | 
			
		||||
            newDetails.put("dns.suffixes", StringUtils.join(domainSuffixList, ","));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (userId == null) {
 | 
			
		||||
            userId = Long.valueOf(User.UID_SYSTEM);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -73,6 +73,7 @@ import com.cloud.dc.DataCenterVO;
 | 
			
		||||
import com.cloud.dc.HostPodVO;
 | 
			
		||||
import com.cloud.dc.dao.AccountVlanMapDao;
 | 
			
		||||
import com.cloud.dc.dao.DataCenterDao;
 | 
			
		||||
import com.cloud.dc.dao.DcDetailsDaoImpl;
 | 
			
		||||
import com.cloud.dc.dao.HostPodDao;
 | 
			
		||||
import com.cloud.dc.dao.VlanDao;
 | 
			
		||||
import com.cloud.deploy.DataCenterDeployment;
 | 
			
		||||
@ -1109,6 +1110,8 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
 | 
			
		||||
        String dhcpRange = null;
 | 
			
		||||
 | 
			
		||||
        DataCenter dc = dest.getDataCenter();
 | 
			
		||||
        DataCenterVO dcVO = _dcDao.findById(dc.getId());
 | 
			
		||||
        _dcDao.loadDetails(dcVO);
 | 
			
		||||
 | 
			
		||||
        if (dc.getNetworkType() == NetworkType.Advanced) {
 | 
			
		||||
            String cidr = network.getCidr();
 | 
			
		||||
@ -1200,6 +1203,10 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
 | 
			
		||||
        if (domain != null) {
 | 
			
		||||
            buf.append(" domain=" + domain);
 | 
			
		||||
        }  
 | 
			
		||||
        String domain_suffix = dcVO.getDetail("dns.suffixes");
 | 
			
		||||
        if (domain_suffix != null) {
 | 
			
		||||
            buf.append(" domainsuffix=").append(domain_suffix);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!network.isDefault() && network.getGuestType() == GuestIpType.Direct) {
 | 
			
		||||
            buf.append(" defaultroute=false");
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user