This is an automated email from the ASF dual-hosted git repository.
nvazquez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new d42c0eeb11 systemvm: setup radvd correctly (#6343)
d42c0eeb11 is described below
commit d42c0eeb11d0131f8123de0eb0b9731f4297bb5e
Author: Abhishek Kumar <[email protected]>
AuthorDate: Wed May 4 02:23:32 2022 +0530
systemvm: setup radvd correctly (#6343)
* systemvm: setup radvd correctly
Fixes radvd setup on VR for isolated network
Signed-off-by: Abhishek Kumar <[email protected]>
* donot start radvd on startup
Signed-off-by: Abhishek Kumar <[email protected]>
* 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 <[email protected]>
---
systemvm/debian/opt/cloud/bin/cs/CsRedundant.py | 3 ---
systemvm/debian/opt/cloud/bin/setup/common.sh | 17 +++++++----------
systemvm/debian/opt/cloud/bin/setup/init.sh | 7 ++++++-
test/integration/smoke/test_network_ipv6.py | 2 +-
4 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py
b/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py
index d693080393..fff9074ffc 100755
--- a/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py
@@ -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"))
diff --git a/systemvm/debian/opt/cloud/bin/setup/common.sh
b/systemvm/debian/opt/cloud/bin/setup/common.sh
index a799a88be8..18a78311ae 100755
--- a/systemvm/debian/opt/cloud/bin/setup/common.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/common.sh
@@ -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() {
diff --git a/systemvm/debian/opt/cloud/bin/setup/init.sh
b/systemvm/debian/opt/cloud/bin/setup/init.sh
index a1ac48e46b..8b78e5807d 100644
--- a/systemvm/debian/opt/cloud/bin/setup/init.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/init.sh
@@ -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
@@ -214,4 +219,4 @@ log_it "Starting guest services for $HYPERVISOR"
config_guest
source /opt/cloud/bin/setup/common.sh
-setup_interface_sshd
\ No newline at end of file
+setup_interface_sshd
diff --git a/test/integration/smoke/test_network_ipv6.py
b/test/integration/smoke/test_network_ipv6.py
index 1aff1fc1f2..5450234a3b 100644
--- a/test/integration/smoke/test_network_ipv6.py
+++ b/test/integration/smoke/test_network_ipv6.py
@@ -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