-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for infinite DHCP leases #1176
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,3 +243,13 @@ if [ "$DISABLE_MULTICAST" == "true" ]; then | |
sudo ebtables -A OUTPUT --pkttype-type multicast -p ip6 --ip6-dst ${dst} -j DROP | ||
done | ||
fi | ||
|
||
# Hack to force use of infinite leases in versions of libvirt that don't | ||
# support setting the lease time in the network config. | ||
# This should be removed when we have a new enough version of libvirt to | ||
# do it properly. I believe any version 6.3.0 or above should have the feature. | ||
if [ ${INFINITE_LEASES:-0} -eq 1 ] | ||
then | ||
./infinite-leases.sh & | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder should we redirect io to somewhere, I think its holding ./02_configure_host.sh from finishing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've been using this locally and it hasn't caused any problems. Are you seeing something different? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I think I was mistaken when I mentioned 02_configure_host.sh , what I'm seeing is that after the deployment infinite-leases.sh is still running. If for some reason the loop to edit the leases file is executed then the terminal where I had run the make command from gets the output There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I guess I've never had the script trigger after make was complete. I could probably remove the log message entirely. It was mostly there to let me know the script was working, but it isn't particularly necessary. |
||
echo "$!" > "${WORKING_DIR}/infinite-lease-pid" | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
NETWORK_NAME=${CLUSTER_NAME}bm | ||
FILENAME=/var/lib/libvirt/dnsmasq/${NETWORK_NAME}.hostsfile | ||
|
||
# We need to keep running even after setting the infinite leases because | ||
# they are overwritten multiple times in the deployment process. | ||
while : | ||
do | ||
if grep -q -v infinite $FILENAME | ||
then | ||
sudo perl -pi -e 's/(.*?)(,infinite|)$/\1,infinite/' $FILENAME | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. adding this to the hostsfile means that we cant restart the libvirt network (I guess the lease-init script can't parse it), maybe we don't care but I thought it was worth pointing out.
Also the scripts that generates the clouds.yaml no longer works, as it can't get the host IP addresses with virsh
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good point. There was a bug opened for it: https://bugzilla.redhat.com/show_bug.cgi?id=1908053 It was just a problem with libvirt's handling of infinite leases in general. Even setting them properly through the libvirt xml was failing. I guess this will be fixed when we get to a newer version of libvirt, at which point we should be able to drop this hack. It is a bit of an issue though since one of the reasons I wanted to get this in dev-scripts was so we could use it for ci, which won't work if the post-deploy steps are failing. Still useful for development, but if we do get a ci job configured before getting a fixed libvirt I'll have to find some workaround. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess if its not on by default then its not a big problem, and it'll have to be sorted somehow before getting switched on. |
||
|
||
pid=$(ps aux | grep dnsmasq | grep "$NETWORK_NAME" | grep -v root | awk '{print $2}') | ||
sudo kill -s SIGHUP $pid | ||
echo "Added infinite leases to $FILENAME" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is triggered after make completes, as is it is output to where ever make was run from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't really designed to be run after deployment. The problem the script was designed to solve is the fact that the hosts file gets rewritten multiple times during the deployment, so if you manually added the leases they might get removed again. After deployment that's no longer a problem. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So would it be ok to just kill the script at the end of the deployment? |
||
fi | ||
sleep 10 | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add what that version number would be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll see if I can find it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is done.