Skip to content

Commit e7638c0

Browse files
committed
Merge pull request #959 from ekholabs/pr/930-CLOUDSTACK-8933
CLOUDSTACK-8933 SSVm and CPVM do not survive a reboot from APIThis closes PR #930 as well. I Rebased @bvbharat's PR with latest Master and tested the SSVM/CPVM and the routers: rVPC; VPC; VR; and RVR. * pr/959: CLOUDSTACK-8933 - Improves the the test internals of the SSVM/CPVM CLOUDSTACK-8933 - Replace infinite loop by a for loop CLOUDSTACK-8933 SSVm and CPVM do not survive a reboot from API This closes #930 Signed-off-by: Remi Bergsma <github@remi.nl>
2 parents c7ca952 + ae6aa2a commit e7638c0

2 files changed

Lines changed: 113 additions & 11 deletions

File tree

systemvm/patches/debian/config/etc/init.d/cloud-early-config

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,31 @@ get_boot_params() {
117117
if [ ! -e /dev/vport0p1 ]; then
118118
log_it "/dev/vport0p1 not loaded, perhaps guest kernel is too old." && exit 2
119119
fi
120-
while [ -z "$cmd" ]; do
121-
while read line; do
122-
if [[ $line == cmdline:* ]]; then
123-
cmd=${line//cmdline:/}
120+
121+
local factor=2
122+
local progress=1
123+
for i in {1..5}
124+
do
125+
while read line; do
126+
if [[ $line == cmdline:* ]]; then
127+
cmd=${line//cmdline:/}
124128
echo $cmd > /var/cache/cloud/cmdline
125-
elif [[ $line == pubkey:* ]]; then
126-
pubkey=${line//pubkey:/}
127-
echo $pubkey > /var/cache/cloud/authorized_keys
128-
echo $pubkey > /root/.ssh/authorized_keys
129+
elif [[ $line == pubkey:* ]]; then
130+
pubkey=${line//pubkey:/}
131+
echo $pubkey > /var/cache/cloud/authorized_keys
132+
echo $pubkey > /root/.ssh/authorized_keys
129133
fi
130-
done < /dev/vport0p1
131-
done
134+
done < /dev/vport0p1
135+
# In case of reboot we do not send the boot args again.
136+
# So, no need to wait for them, as the boot args are already set at startup
137+
if [ -s /var/cache/cloud/cmdline ]
138+
then
139+
log_it "Found a non empty cmdline file. Will now exit the loop and proceed with configuration."
140+
break;
141+
fi
142+
sleep ${progress}s
143+
progress=$[ progress * factor ]
144+
done
132145
chmod go-rwx /root/.ssh/authorized_keys
133146
;;
134147
vmware)

test/integration/smoke/test_ssvm.py

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ def setUp(self):
4747
self.cleanup = []
4848
self.services = self.testClient.getParsedTestDataConfig()
4949
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
50+
51+
# Default sleep is set to 90 seconds, which is too long if the SSVM takes up to 2min to start.
52+
# Second sleep in the loop will waste test time.
53+
self.services["sleep"] = 30
54+
# Default value is 120 seconds. That's just too much.
55+
self.services["configurableData"]["systemVmDelay"] = 60
56+
5057
return
5158

5259
def tearDown(self):
@@ -470,6 +477,47 @@ def test_03_ssvm_internals(self):
470477
1,
471478
"Check cloud service is running or not"
472479
)
480+
481+
linklocal_ip = None
482+
# Check status of cloud service
483+
if self.hypervisor.lower() in ('vmware', 'hyperv'):
484+
# SSH into SSVMs is done via management server for Vmware and
485+
# Hyper-V
486+
linklocal_ip = ssvm.privateip
487+
result = get_process_status(
488+
self.apiclient.connection.mgtSvr,
489+
22,
490+
self.apiclient.connection.user,
491+
self.apiclient.connection.passwd,
492+
ssvm.privateip,
493+
"cat /var/cache/cloud/cmdline | xargs | sed \"s/ /\\n/g\" | grep eth0ip= | sed \"s/\=/ /g\" | awk '{print $2}'",
494+
hypervisor=self.hypervisor
495+
)
496+
else:
497+
try:
498+
linklocal_ip = ssvm.linklocalip
499+
host.user, host.passwd = get_host_credentials(
500+
self.config, host.ipaddress)
501+
result = get_process_status(
502+
host.ipaddress,
503+
22,
504+
host.user,
505+
host.passwd,
506+
ssvm.linklocalip,
507+
"cat /var/cache/cloud/cmdline | xargs | sed \"s/ /\\n/g\" | grep eth0ip= | sed \"s/\=/ /g\" | awk '{print $2}'"
508+
)
509+
except KeyError:
510+
self.skipTest(
511+
"Marvin configuration has no host\
512+
credentials to check router services")
513+
res = result[0]
514+
self.debug("Cached Link Local IP: %s" % res)
515+
self.assertEqual(
516+
linklocal_ip,
517+
res,
518+
"The cached Link Local should be the same as the current Link Local IP, but they are different! Current ==> %s; Cached ==> %s " % (linklocal_ip, res)
519+
)
520+
473521
return
474522

475523
@attr(
@@ -564,6 +612,47 @@ def test_04_cpvm_internals(self):
564612
1,
565613
"Check cloud service is running or not"
566614
)
615+
616+
linklocal_ip = None
617+
# Check status of cloud service
618+
if self.hypervisor.lower() in ('vmware', 'hyperv'):
619+
# SSH into SSVMs is done via management server for Vmware and
620+
# Hyper-V
621+
linklocal_ip = cpvm.privateip
622+
result = get_process_status(
623+
self.apiclient.connection.mgtSvr,
624+
22,
625+
self.apiclient.connection.user,
626+
self.apiclient.connection.passwd,
627+
cpvm.privateip,
628+
"cat /var/cache/cloud/cmdline | xargs | sed \"s/ /\\n/g\" | grep eth0ip= | sed \"s/\=/ /g\" | awk '{print $2}'",
629+
hypervisor=self.hypervisor
630+
)
631+
else:
632+
try:
633+
linklocal_ip = cpvm.linklocalip
634+
host.user, host.passwd = get_host_credentials(
635+
self.config, host.ipaddress)
636+
result = get_process_status(
637+
host.ipaddress,
638+
22,
639+
host.user,
640+
host.passwd,
641+
cpvm.linklocalip,
642+
"cat /var/cache/cloud/cmdline | xargs | sed \"s/ /\\n/g\" | grep eth0ip= | sed \"s/\=/ /g\" | awk '{print $2}'"
643+
)
644+
except KeyError:
645+
self.skipTest(
646+
"Marvin configuration has no host\
647+
credentials to check router services")
648+
res = result[0]
649+
self.debug("Cached Link Local IP: %s" % res)
650+
self.assertEqual(
651+
linklocal_ip,
652+
res,
653+
"The cached Link Local should be the same as the current Link Local IP, but they are different! Current ==> %s; Cached ==> %s " % (linklocal_ip, res)
654+
)
655+
567656
return
568657

569658
@attr(
@@ -817,7 +906,7 @@ def test_07_reboot_ssvm(self):
817906
old_public_ip,
818907
"Check Public IP after reboot with that of before reboot"
819908
)
820-
909+
821910
# Private IP Address of System VMs are allowed to change after reboot - CLOUDSTACK-7745
822911

823912
# Wait for the agent to be up

0 commit comments

Comments
 (0)