[
https://issues.apache.org/jira/browse/CLOUDSTACK-3424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13748301#comment-13748301
]
Nitin Mehta commented on CLOUDSTACK-3424:
-----------------------------------------
Summary: Release old DHCP entries
Detail: Refresh dnsmasq with updated entries live, no outage
BUG-ID: CLOUDSTACK-2299
Submitted-by: Dennis Lawler <[email protected]>
Signed-off-by: Marcus Sorensen <[email protected]> 1367611792 -0600
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/870d21c4
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/870d21c4
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/870d21c4
Branch: refs/heads/master
Commit: 870d21c436f8ca34f3d865409444e2f4c84a4319
Parents: a3a5c13
Author: Marcus Sorensen <[email protected]>
Authored: Fri May 3 14:09:52 2013 -0600
Committer: Marcus Sorensen <[email protected]>
Committed: Fri May 3 14:09:52 2013 -0600
----------------------------------------------------------------------
patches/systemvm/debian/config/root/edithosts.sh | 28 ++++++++++-----
scripts/network/exdhcp/dnsmasq_edithosts.sh | 19 ++++++++--
.../definitions/systemvmtemplate/postinstall.sh | 2 +-
.../definitions/systemvmtemplate64/postinstall.sh | 2 +-
4 files changed, 37 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/870d21c4/patches/systemvm/debian/config/root/edithosts.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/root/edithosts.sh
b/patches/systemvm/debian/config/root/edithosts.sh
index 8609da7..fb0c34f 100755
--- a/patches/systemvm/debian/config/root/edithosts.sh
+++ b/patches/systemvm/debian/config/root/edithosts.sh
@@ -19,12 +19,6 @@
# edithosts.sh -- edit the dhcphosts file on the routing domain
-# $mac : the mac address
-# $ip : the associated ip address
-# $host : the hostname
-# $4 : default router
-# $5 : nameserver on default nic
-# $6 : comma separated static routes
usage() {
printf "Usage: %s: -m <MAC address> -4 <IPv4 address> -6 <IPv6 address> -h
<hostname> -d <default router> -n <name server address> -s <Routes> -u <DUID>
[-N]\n" $(basename $0) >&2
@@ -84,6 +78,9 @@ fi
grep "redundant_router=1" /var/cache/cloud/cmdline > /dev/null
no_redundant=$?
+command -v dhcp_release > /dev/null 2>&1
+no_dhcp_release=$?
+
wait_for_dnsmasq () {
local _pid=$(pidof dnsmasq)
for i in 0 1 2 3 4 5 6 7 8 9 10
@@ -97,7 +94,15 @@ wait_for_dnsmasq () {
return 1
}
-logger -t cloud "edithosts: update $1 $2 $3 to hosts"
+if [ $no_dhcp_release -eq 0 ]
+then
+ #release previous dhcp lease if present
+ logger -t cloud "edithosts: releasing $ipv4"
+ dhcp_release lo $ipv4 $(grep $ipv4 $DHCP_LEASES | awk '{print $2}') >
/dev/null 2>&1
+ logger -t cloud "edithosts: released $ipv4"
+fi
+
+logger -t cloud "edithosts: update $mac $ipv4 $ipv6 $host to hosts"
[ ! -f $DHCP_HOSTS ] && touch $DHCP_HOSTS
[ ! -f $DHCP_OPTS ] && touch $DHCP_OPTS
@@ -201,8 +206,13 @@ fi
pid=$(pidof dnsmasq)
if [ "$pid" != "" ]
then
- #service dnsmasq restart
- kill -HUP $pid
+ # use SIGHUP to avoid service outage if dhcp_release is available.
+ if [ $no_dhcp_release -eq 0 ]
+ then
+ kill -HUP $pid
+ else
+ service dnsmasq restart
+ fi
else
if [ $no_redundant -eq 1 ]
then
> IPV6 - When a Vm is expunged and a new Vm is deployed with the same name ,
> /etc/dhchosts.txt has 2 entries with the same name.
> ------------------------------------------------------------------------------------------------------------------------------
>
> Key: CLOUDSTACK-3424
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-3424
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Components: Management Server
> Affects Versions: 4.2.0
> Environment: Build from master-6-17-stable
> Reporter: Sangeetha Hariharan
> Assignee: Nitin Mehta
> Priority: Critical
> Fix For: 4.2.1
>
> Attachments: management-server.log
>
>
> IPV6 - When a Vm is expunged and a new Vm is deployed with the same name ,
> /etc/dhchosts.txt has 2 entries with the same name
> Steps to reproduce the problem:
> Create a ipv6 network.
> Deploy a Vm with name - test456.
> Destroy this VM. Wait for it to be expunged.
> Deploy another Vm with same name - test456.
> We see that there are 2 entries in the router with the same name "test456"
> resolving to 2 different ipv6 addresses.
> root@r-17-VM:~# cat /etc/dhcphosts.txt
> id:00:03:00:01:06:4e:de:00:00:2f,[fc00:3:1370::744f],test123,infinite
> id:00:03:00:01:06:75:46:00:00:31,[fc00:3:1370::34ed],test456,infinite
> id:00:03:00:01:06:e4:ae:00:00:32,[fc00:3:1370::ae4b],testyoyo,infinite
> id:00:03:00:01:06:96:aa:00:00:33,[fc00:3:1370::34ed],testyoyo1,infinite
> id:00:03:00:01:06:cb:88:00:00:34,[fc00:3:1370::6eb2],test456,infinite
> root@r-17-VM:~#
> Attaching management server logs:
> Have 2 entries for the same name is a problem.
> Is it also a problem to have the same ipv6 address associated with 2
> different vms with different Vm names ( 1 expunged and 1 active , in my case
> "test456" which is expunged and "testyoyo1" which is active) ?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira