Repository: cloudstack Updated Branches: refs/heads/4.5 e41850c2d -> fd44bc5f3
CLOUDSTACK-9042: VR: DHCP: fix missing DHCP host enties in /etc/dhcpentries.txt we had: 02:00:1e:07:01:53,set:10_102_92_5,10.102.92.5,songlog-1,infinite 02:00:0b:a2:00:3d,set:10_102_92_234,10.102.92.234,log-1,infinite This sed matched unexpectetly "songlog-1" as well when "log-1" was processed, resulting missing dhcp entry for songlog-1. Also fixed other potenials problems relating to sed matching. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e7291fd6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e7291fd6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e7291fd6 Branch: refs/heads/4.5 Commit: e7291fd600ce922a76b1fe9cd2c120a40d4cbc18 Parents: efe93d7 Author: Rene Moser <[email protected]> Authored: Fri Nov 6 12:25:10 2015 +0100 Committer: Rene Moser <[email protected]> Committed: Sat Nov 7 11:31:14 2015 +0100 ---------------------------------------------------------------------- .../debian/config/opt/cloud/bin/edithosts.sh | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7291fd6/systemvm/patches/debian/config/opt/cloud/bin/edithosts.sh ---------------------------------------------------------------------- diff --git a/systemvm/patches/debian/config/opt/cloud/bin/edithosts.sh b/systemvm/patches/debian/config/opt/cloud/bin/edithosts.sh index f0d9c00..efb7790 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/edithosts.sh +++ b/systemvm/patches/debian/config/opt/cloud/bin/edithosts.sh @@ -110,10 +110,10 @@ logger -t cloud "edithosts: update $mac $ipv4 $ipv6 $host to hosts" [ ! -f $DHCP_LEASES ] && touch $DHCP_LEASES #delete any previous entries from the dhcp hosts file -sed -i /$mac/d $DHCP_HOSTS +sed -i /^$mac,/d $DHCP_HOSTS if [ $ipv4 ] then - sed -i /$ipv4,/d $DHCP_HOSTS + sed -i /,$ipv4,/d $DHCP_HOSTS fi if [ $ipv6 ] then @@ -121,7 +121,7 @@ then sed -i /$ipv6],/d $DHCP_HOSTS fi # don't want to do this in the future, we can have same VM with multiple nics/entries -sed -i /$host,/d $DHCP_HOSTS +sed -i /,$host,/d $DHCP_HOSTS #put in the new entry if [ $ipv4 ] @@ -143,15 +143,15 @@ then #delete leases to supplied mac and ip addresses if [ $ipv4 ] then - sed -i /$mac/d $DHCP_LEASES - sed -i /"$ipv4 "/d $DHCP_LEASES + sed -i /\b$mac\b/d $DHCP_LEASES + sed -i /\b$ipv4\b/d $DHCP_LEASES fi if [ $ipv6 ] then - sed -i /$duid/d $DHCP_LEASES - sed -i /"$ipv6 "/d $DHCP_LEASES + sed -i /\b$duid\b/d $DHCP_LEASES + sed -i /\b$ipv6\b/d $DHCP_LEASES fi - sed -i /"$host "/d $DHCP_LEASES + sed -i /\b$host\b/d $DHCP_LEASES #put in the new entry if [ $ipv4 ] @@ -167,11 +167,11 @@ fi #edit hosts file as well if [ $ipv4 ] then - sed -i /"$ipv4 "/d $HOSTS + sed -i /\b$ipv4\b/d $HOSTS fi if [ $ipv6 ] then - sed -i /"$ipv6 "/d $HOSTS + sed -i /\b$ipv6\b/d $HOSTS fi sed -i /" $host$"/d $HOSTS if [ $ipv4 ] @@ -201,7 +201,7 @@ then fi [ "$routes" != "" ] && echo "$tag,121,$routes" >> $DHCP_OPTS #delete entry we just put in because we need a tag - sed -i /$ipv4,/d $DHCP_HOSTS + sed -i /,$ipv4,/d $DHCP_HOSTS #put it back with a tag echo "$mac,set:$tag,$ipv4,$host,infinite" >>$DHCP_HOSTS fi
