systemvm: setup radvd correctly (#6343)

* systemvm: setup radvd correctly

Fixes radvd setup on VR for isolated network

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

* donot start radvd on startup

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

* Revert "donot start radvd on startup"

This reverts commit 2a8f737f3cf548386f025a436da5e66f59af858b.

* ipv6: do not start radvd in common.sh

* ipv6: do not add radvd to enabled_svcs in CsRedundant.py

* systemvm: add radvd to /var/cache/cloud/enabled_svcs when enable radvd

* test: fix test_network_ipv6.py

Co-authored-by: Wei Zhou <weizhou@apache.org>
This commit is contained in:
Abhishek Kumar 2022-05-04 02:23:32 +05:30 committed by GitHub
parent 17afe0510e
commit d42c0eeb11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 15 deletions

View File

@ -481,7 +481,6 @@ class CsRedundant(object):
if dev == '':
return
CsHelper.service("radvd", "enable")
CsHelper.execute("echo \"radvd\" >> /var/cache/cloud/enabled_svcs")
CsHelper.start_if_stopped("radvd")
def _disable_radvd(self, dev):
@ -492,8 +491,6 @@ class CsRedundant(object):
return
CsHelper.service("radvd", "stop")
CsHelper.service("radvd", "disable")
CsHelper.execute("sed -i \"s,radvd,,g\" /var/cache/cloud/enabled_svcs")
CsHelper.execute("sed -i '/^$/d' /var/cache/cloud/enabled_svcs")
logging.info(CsHelper.execute("systemctl status radvd"))

View File

@ -75,6 +75,8 @@ setup_interface() {
local intf=eth${intfnum}
local bootproto="static"
log_it "Setting up interface: ${intf}"
if [ "$BOOTPROTO" == "dhcp" ]
then
if [ "$intfnum" != "0" ]
@ -280,8 +282,9 @@ setup_ipv6() {
then
enableradvd=true
setup_interface_ipv6 "0" $ETH0_IP6 $ETH0_IP6_PRELEN
fi
if [ -n "$ETH0_IP6" ] || [ -n "$GUEST_GW6" -a -n "$GUEST_CIDR6_SIZE" ]
rm -rf /etc/radvd.conf
setup_radvd "0" $ETH0_IP6 $ETH0_IP6_PRELEN $enableradvd
elif [ -n "$GUEST_GW6" -a -n "$GUEST_CIDR6_SIZE" ]
then
rm -rf /etc/radvd.conf
setup_radvd "0" $GUEST_GW6 $GUEST_CIDR6_SIZE $enableradvd
@ -293,6 +296,7 @@ setup_ipv6() {
}
restore_ipv6() {
log_it "Restoring IPv6 configurations with ETH0_IP6=$ETH0_IP6 GUEST_GW6=$GUEST_GW6 GUEST_CIDR6_SIZE=$GUEST_CIDR6_SIZE ETH2_IP6=$ETH2_IP6"
if [ -n "$ETH0_IP6" ] || [ -n "$GUEST_GW6" -a -n "$GUEST_CIDR6_SIZE" ]
then
enable_interface_ipv6 "0" true
@ -406,15 +410,8 @@ enable_radvd() {
then
log_it "Enabling radvd"
systemctl enable radvd
echo "radvd" >> /var/cache/cloud/enabled_svcs
fi
systemctl -q is-active radvd
status=$?
if [ $status -ne 0 ]
then
log_it "Starting radvd"
systemctl start radvd
fi
grep -q "radvd" /var/cache/cloud/enabled_svcs || echo "radvd" >> /var/cache/cloud/enabled_svcs
}
setup_radvd() {

View File

@ -20,6 +20,11 @@ set -x
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
CMDLINE=/var/cache/cloud/cmdline
log_it() {
echo "$(date) $@" >> /var/log/cloud.log
log_action_msg "$@"
}
hypervisor() {
if [ -d /proc/xen ]; then
mount -t xenfs none /proc/xen

View File

@ -845,7 +845,7 @@ class TestIpv6Network(cloudstackTestCase):
cmd,
hypervisor=self.routerDetailsMap[router.id]['hypervisor']
)
self.assertTrue(type(result) == list and len(result) > 0,
self.assertTrue(type(result) == list,
"%s on router %s returned invalid result" % (cmd, router.id))
result = '\n'.join(result)
return result