bug 10023: only set ip route for internal DNS

status 10023: resolved fixed
This commit is contained in:
anthony 2011-05-25 17:37:25 -07:00
parent f026cd5540
commit 37e6ded80c
5 changed files with 62 additions and 38 deletions

View File

@ -243,20 +243,20 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
_proxyVmId = NumbersUtil.parseLong(value, 0); _proxyVmId = NumbersUtil.parseLong(value, 0);
if (_localgw != null) { if (_localgw != null) {
String internalDns1 = (String)params.get("dns1"); String mgmtHost = (String) params.get("host");
String internalDns2 = (String)params.get("dns2"); addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, mgmtHost);
if (internalDns1 == null) { String internalDns1 = (String) params.get("internaldns1");
s_logger.warn("No DNS entry found during configuration of NfsSecondaryStorage"); if (internalDns1 == null) {
} else { s_logger.warn("No DNS entry found during configuration of NfsSecondaryStorage");
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns1); } else {
} addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns1);
}
String mgmtHost = (String)params.get("host");
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, mgmtHost); String internalDns2 = (String) params.get("internaldns2");
if (internalDns2 != null) { if (internalDns2 != null) {
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns2); addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns2);
} }
} }
_pubIp = (String)params.get("public.ip"); _pubIp = (String)params.get("public.ip");

View File

@ -433,6 +433,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
@Override @Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
_eth1ip = (String)params.get("eth1ip"); _eth1ip = (String)params.get("eth1ip");
_eth1mask = (String)params.get("eth1mask");
if (_eth1ip != null) { //can only happen inside service vm if (_eth1ip != null) { //can only happen inside service vm
params.put("private.network.device", "eth1"); params.put("private.network.device", "eth1");
} else { } else {
@ -505,23 +506,21 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
if (inSystemVM == null || "true".equalsIgnoreCase(inSystemVM)) { if (inSystemVM == null || "true".equalsIgnoreCase(inSystemVM)) {
_inSystemVM = true; _inSystemVM = true;
_localgw = (String)params.get("localgw"); _localgw = (String)params.get("localgw");
if (_localgw != null) { //can only happen inside service vm if (_localgw != null) { // can only happen inside service vm
_eth1mask = (String)params.get("eth1mask"); String mgmtHost = (String) params.get("host");
String internalDns1 = (String)params.get("dns1"); addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, mgmtHost);
String internalDns2 = (String)params.get("dns2");
if (internalDns1 == null) { String internalDns1 = (String) params.get("internaldns1");
s_logger.warn("No DNS entry found during configuration of NfsSecondaryStorage"); if (internalDns1 == null) {
} else { s_logger.warn("No DNS entry found during configuration of NfsSecondaryStorage");
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns1); } else {
} addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns1);
}
String mgmtHost = (String)params.get("host");
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, mgmtHost); String internalDns2 = (String) params.get("internaldns2");
if (internalDns2 != null) { if (internalDns2 != null) {
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns2); addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns2);
} }
} }
String useSsl = (String)params.get("sslcopy"); String useSsl = (String)params.get("sslcopy");

View File

@ -203,10 +203,21 @@ setup_common() {
hostname $NAME hostname $NAME
#Nameserver #Nameserver
if [ -n "$internalNS1" ]
then
echo "nameserver $internalNS1" > /etc/dnsmasq-resolv.conf
echo "nameserver $internalNS1" > /etc/resolv.conf
fi
if [ -n "$internalNS2" ]
then
echo "nameserver $internalNS2" >> /etc/dnsmasq-resolv.conf
echo "nameserver $internalNS2" >> /etc/resolv.conf
fi
if [ -n "$NS1" ] if [ -n "$NS1" ]
then then
echo "nameserver $NS1" > /etc/dnsmasq-resolv.conf echo "nameserver $NS1" >> /etc/dnsmasq-resolv.conf
echo "nameserver $NS1" > /etc/resolv.conf echo "nameserver $NS1" >> /etc/resolv.conf
fi fi
if [ -n "$NS2" ] if [ -n "$NS2" ]
@ -453,6 +464,12 @@ for i in $CMDLINE
eth2mask) eth2mask)
ETH2_MASK=$VALUE ETH2_MASK=$VALUE
;; ;;
internaldns1)
internalNS1=$VALUE
;;
internaldns2)
internalNS2=$VALUE
;;
dns1) dns1)
NS1=$VALUE NS1=$VALUE
;; ;;

View File

@ -1310,10 +1310,6 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
if (nic.isDefaultNic()) { if (nic.isDefaultNic()) {
buf.append(" gateway=").append(nic.getGateway()); buf.append(" gateway=").append(nic.getGateway());
buf.append(" dns1=").append(nic.getDns1());
if (nic.getDns2() != null) {
buf.append(" dns2=").append(nic.getDns2());
}
} }
if (nic.getTrafficType() == TrafficType.Management) { if (nic.getTrafficType() == TrafficType.Management) {
@ -1329,7 +1325,16 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
if (externalDhcp) { if (externalDhcp) {
buf.append(" bootproto=dhcp"); buf.append(" bootproto=dhcp");
} }
DataCenterVO dc = _dcDao.findById(profile.getVirtualMachine().getDataCenterId());
buf.append(" internaldns1=").append(dc.getInternalDns1());
if (dc.getInternalDns2() != null) {
buf.append(" internaldns2=").append(dc.getInternalDns2());
}
buf.append(" dns1=").append(dc.getDns1());
if (dc.getDns2() != null) {
buf.append(" dns2=").append(dc.getDns2());
}
String bootArgs = buf.toString(); String bootArgs = buf.toString();
if (s_logger.isDebugEnabled()) { if (s_logger.isDebugEnabled()) {
s_logger.debug("Boot Args for " + profile + ": " + bootArgs); s_logger.debug("Boot Args for " + profile + ": " + bootArgs);

View File

@ -959,7 +959,6 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
if (NetUtils.isValidCIDR(mgmt_cidr)) { if (NetUtils.isValidCIDR(mgmt_cidr)) {
buf.append(" mgmtcidr=").append(mgmt_cidr); buf.append(" mgmtcidr=").append(mgmt_cidr);
} }
buf.append(" localgw=").append(dest.getPod().getGateway()); buf.append(" localgw=").append(dest.getPod().getGateway());
buf.append(" private.network.device=").append("eth").append(deviceId); buf.append(" private.network.device=").append("eth").append(deviceId);
} else if (nic.getTrafficType() == TrafficType.Public) { } else if (nic.getTrafficType() == TrafficType.Public) {
@ -973,9 +972,13 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
} }
DataCenterVO dc = _dcDao.findById(profile.getVirtualMachine().getDataCenterId()); DataCenterVO dc = _dcDao.findById(profile.getVirtualMachine().getDataCenterId());
buf.append(" dns1=").append(dc.getInternalDns1()); buf.append(" internaldns1=").append(dc.getInternalDns1());
if (dc.getInternalDns2() != null) { if (dc.getInternalDns2() != null) {
buf.append(" dns2=").append(dc.getInternalDns2()); buf.append(" internaldns2=").append(dc.getInternalDns2());
}
buf.append(" dns1=").append(dc.getDns1());
if (dc.getDns2() != null) {
buf.append(" dns2=").append(dc.getDns2());
} }
String bootArgs = buf.toString(); String bootArgs = buf.toString();