Updated Branches: refs/heads/master-6-17-stable 20d05d684 -> b8b786d66
Cloudstack-2644 [Multiple_IP_Ranges] user data service on VR does not work in case of multiple subnets Cloudstack-2953 [Multiple_IP_Ranges] VM does not get the public key from VR incase of multiple subnets per vlan Also removed some unused code and fixed the an error in the dnsmasq config function Signed-off-by: Abhinandan Prateek <aprat...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cd89ff72 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cd89ff72 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cd89ff72 Branch: refs/heads/master-6-17-stable Commit: cd89ff72412192f847b67fa60d01ed5ef8c52a4f Parents: 20d05d6 Author: Bharat Kumar <bharat.ku...@citrix.com> Authored: Wed Jun 19 11:53:48 2013 +0530 Committer: Abhinandan Prateek <aprat...@apache.org> Committed: Fri Jun 21 14:23:27 2013 +0530 ---------------------------------------------------------------------- .../debian/config/etc/init.d/cloud-early-config | 2 + .../VirtualNetworkApplianceManagerImpl.java | 3 +- server/src/com/cloud/vm/dao/NicIpAliasDao.java | 1 - .../src/com/cloud/vm/dao/NicIpAliasDaoImpl.java | 9 ----- setup/bindir/cloud-set-guest-sshkey.in | 39 +++++--------------- 5 files changed, 14 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cd89ff72/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 0dcd571..b215271 100755 --- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config +++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config @@ -540,6 +540,8 @@ setup_dnsmasq() { NS6=${NS6%?} [ $ETH0_IP ] && echo "dhcp-option=6,$NS" >> /etc/dnsmasq.conf [ $ETH0_IP6 ] && echo "dhcp-option=option6:dns-server,$NS6" >> /etc/dnsmasq.conf +#adding the name data-server to the /etc/hosts for allowing the access to user-data service and ssh-key reset in every subnet. + echo "$ETH0_IP data-server" >> /etc/hosts } setup_sshd(){ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cd89ff72/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 acf73da..16e01c9 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -3428,7 +3428,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V private void configDnsMasq(VirtualRouter router, Network network, Commands cmds) { DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId()); - List<NicIpAliasVO> ipAliasVOList = _nicIpAliasDao.getAliasIpForVm(router.getId()); + List<NicIpAliasVO> ipAliasVOList = _nicIpAliasDao.listByNetworkIdAndState(network.getId(), NicIpAlias.state.active); List<DnsmasqTO> ipList = new ArrayList<DnsmasqTO>(); NicVO router_guest_nic = _nicDao.findByNtwkIdAndInstanceId(network.getId(), router.getId()); @@ -3442,6 +3442,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V for (NicIpAliasVO ipAliasVO : ipAliasVOList) { DnsmasqTO dnsmasqTO = new DnsmasqTO(ipAliasVO.getIp4Address(), ipAliasVO.getGateway(), ipAliasVO.getNetmask(), ipAliasVO.getStartIpOfSubnet()); ipList.add(dnsmasqTO); + ipAliasVO.setVmId(router.getId()); } DataCenterVO dcvo = _dcDao.findById(router.getDataCenterId()); DnsMasqConfigCommand dnsMasqConfigCmd = new DnsMasqConfigCommand(network.getNetworkDomain(),ipList, dcvo.getDns1(), dcvo.getDns2(), dcvo.getInternalDns1(), dcvo.getInternalDns2()); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cd89ff72/server/src/com/cloud/vm/dao/NicIpAliasDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/vm/dao/NicIpAliasDao.java b/server/src/com/cloud/vm/dao/NicIpAliasDao.java index f1e4b8e..2a0da92 100644 --- a/server/src/com/cloud/vm/dao/NicIpAliasDao.java +++ b/server/src/com/cloud/vm/dao/NicIpAliasDao.java @@ -57,5 +57,4 @@ public interface NicIpAliasDao extends GenericDao<NicIpAliasVO, Long> { List<NicIpAliasVO> listByNetworkIdAndState(long networkId, NicIpAlias.state state); - List<NicIpAliasVO> listByNetworkIdAndAliasIpAndState(long networkId, String aliasIpOfSubnet, NicIpAlias.state state); } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cd89ff72/server/src/com/cloud/vm/dao/NicIpAliasDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/vm/dao/NicIpAliasDaoImpl.java b/server/src/com/cloud/vm/dao/NicIpAliasDaoImpl.java index e6c52a2..2cd8a2f 100644 --- a/server/src/com/cloud/vm/dao/NicIpAliasDaoImpl.java +++ b/server/src/com/cloud/vm/dao/NicIpAliasDaoImpl.java @@ -92,15 +92,6 @@ public class NicIpAliasDaoImpl extends GenericDaoBase<NicIpAliasVO, Long> implem } @Override - public List<NicIpAliasVO> listByNetworkIdAndAliasIpAndState(long networkId, String aliasIpOfSubnet, NicIpAlias.state state) { - SearchCriteria<NicIpAliasVO> sc = AllFieldsSearch.create(); - sc.setParameters("network", networkId); - sc.setParameters("address", aliasIpOfSubnet); - sc.setParameters("state", state); - return listBy(sc); - } - - @Override public List<NicIpAliasVO> listByNicIdAndVmid(long nicId, long vmId) { SearchCriteria<NicIpAliasVO> sc = AllFieldsSearch.create(); sc.setParameters("nicId", nicId); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cd89ff72/setup/bindir/cloud-set-guest-sshkey.in ---------------------------------------------------------------------- diff --git a/setup/bindir/cloud-set-guest-sshkey.in b/setup/bindir/cloud-set-guest-sshkey.in index 15008b8..92c35d4 100755 --- a/setup/bindir/cloud-set-guest-sshkey.in +++ b/setup/bindir/cloud-set-guest-sshkey.in @@ -26,37 +26,18 @@ # Modify this line to specify the user (default is root) user=root +SSHKEY_SERVER_IP=$(nslookup data-server | grep Server | awk '{print $2}') +logger -t "cloud" "Sending request to ssh key server at $SSHKEY_SERVER_IP" +publickey=$(wget -t 3 -T 20 -O - http://data-server/latest/public-keys 2>/dev/null) -# Add your DHCP lease folders here -DHCP_FOLDERS="/var/lib/dhclient/* /var/lib/dhcp3/*" -keys_received=0 -file_count=0 - -for DHCP_FILE in $DHCP_FOLDERS -do - if [ -f $DHCP_FILE ] - then - file_count=$((file_count+1)) - SSHKEY_SERVER_IP=$(grep dhcp-server-identifier $DHCP_FILE | tail -1 | awk '{print $NF}' | tr -d '\;') - - if [ -n "$SSHKEY_SERVER_IP" ] - then - logger -t "cloud" "Sending request to ssh key server at $SSHKEY_SERVER_IP" - - publickey=$(wget -t 3 -T 20 -O - http://$SSHKEY_SERVER_IP/latest/public-keys 2>/dev/null) - - if [ $? -eq 0 ] - then - logger -t "cloud" "Got response from server at $SSHKEY_SERVER_IP" - keys_received=1 - break - fi - else - logger -t "cloud" "Could not find ssh key server IP in $DHCP_FILE" - fi - fi -done +if [ $? -eq 0 ] +then + logger -t "cloud" "Got response from server at $SSHKEY_SERVER_IP" + keys_received=1 +else + logger -t "cloud" "Could not find ssh key server IP in $DHCP_FILE" +fi # did we find the keys anywhere? if [ "$keys_received" == "0" ]