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