mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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>
This commit is contained in:
commit
e7638c0288
@ -117,18 +117,31 @@ get_boot_params() {
|
|||||||
if [ ! -e /dev/vport0p1 ]; then
|
if [ ! -e /dev/vport0p1 ]; then
|
||||||
log_it "/dev/vport0p1 not loaded, perhaps guest kernel is too old." && exit 2
|
log_it "/dev/vport0p1 not loaded, perhaps guest kernel is too old." && exit 2
|
||||||
fi
|
fi
|
||||||
while [ -z "$cmd" ]; do
|
|
||||||
while read line; do
|
local factor=2
|
||||||
if [[ $line == cmdline:* ]]; then
|
local progress=1
|
||||||
cmd=${line//cmdline:/}
|
for i in {1..5}
|
||||||
|
do
|
||||||
|
while read line; do
|
||||||
|
if [[ $line == cmdline:* ]]; then
|
||||||
|
cmd=${line//cmdline:/}
|
||||||
echo $cmd > /var/cache/cloud/cmdline
|
echo $cmd > /var/cache/cloud/cmdline
|
||||||
elif [[ $line == pubkey:* ]]; then
|
elif [[ $line == pubkey:* ]]; then
|
||||||
pubkey=${line//pubkey:/}
|
pubkey=${line//pubkey:/}
|
||||||
echo $pubkey > /var/cache/cloud/authorized_keys
|
echo $pubkey > /var/cache/cloud/authorized_keys
|
||||||
echo $pubkey > /root/.ssh/authorized_keys
|
echo $pubkey > /root/.ssh/authorized_keys
|
||||||
fi
|
fi
|
||||||
done < /dev/vport0p1
|
done < /dev/vport0p1
|
||||||
done
|
# In case of reboot we do not send the boot args again.
|
||||||
|
# So, no need to wait for them, as the boot args are already set at startup
|
||||||
|
if [ -s /var/cache/cloud/cmdline ]
|
||||||
|
then
|
||||||
|
log_it "Found a non empty cmdline file. Will now exit the loop and proceed with configuration."
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
sleep ${progress}s
|
||||||
|
progress=$[ progress * factor ]
|
||||||
|
done
|
||||||
chmod go-rwx /root/.ssh/authorized_keys
|
chmod go-rwx /root/.ssh/authorized_keys
|
||||||
;;
|
;;
|
||||||
vmware)
|
vmware)
|
||||||
|
|||||||
@ -47,6 +47,13 @@ class TestSSVMs(cloudstackTestCase):
|
|||||||
self.cleanup = []
|
self.cleanup = []
|
||||||
self.services = self.testClient.getParsedTestDataConfig()
|
self.services = self.testClient.getParsedTestDataConfig()
|
||||||
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
|
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
|
||||||
|
|
||||||
|
# Default sleep is set to 90 seconds, which is too long if the SSVM takes up to 2min to start.
|
||||||
|
# Second sleep in the loop will waste test time.
|
||||||
|
self.services["sleep"] = 30
|
||||||
|
# Default value is 120 seconds. That's just too much.
|
||||||
|
self.services["configurableData"]["systemVmDelay"] = 60
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
@ -470,6 +477,47 @@ class TestSSVMs(cloudstackTestCase):
|
|||||||
1,
|
1,
|
||||||
"Check cloud service is running or not"
|
"Check cloud service is running or not"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
linklocal_ip = None
|
||||||
|
# Check status of cloud service
|
||||||
|
if self.hypervisor.lower() in ('vmware', 'hyperv'):
|
||||||
|
# SSH into SSVMs is done via management server for Vmware and
|
||||||
|
# Hyper-V
|
||||||
|
linklocal_ip = ssvm.privateip
|
||||||
|
result = get_process_status(
|
||||||
|
self.apiclient.connection.mgtSvr,
|
||||||
|
22,
|
||||||
|
self.apiclient.connection.user,
|
||||||
|
self.apiclient.connection.passwd,
|
||||||
|
ssvm.privateip,
|
||||||
|
"cat /var/cache/cloud/cmdline | xargs | sed \"s/ /\\n/g\" | grep eth0ip= | sed \"s/\=/ /g\" | awk '{print $2}'",
|
||||||
|
hypervisor=self.hypervisor
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
linklocal_ip = ssvm.linklocalip
|
||||||
|
host.user, host.passwd = get_host_credentials(
|
||||||
|
self.config, host.ipaddress)
|
||||||
|
result = get_process_status(
|
||||||
|
host.ipaddress,
|
||||||
|
22,
|
||||||
|
host.user,
|
||||||
|
host.passwd,
|
||||||
|
ssvm.linklocalip,
|
||||||
|
"cat /var/cache/cloud/cmdline | xargs | sed \"s/ /\\n/g\" | grep eth0ip= | sed \"s/\=/ /g\" | awk '{print $2}'"
|
||||||
|
)
|
||||||
|
except KeyError:
|
||||||
|
self.skipTest(
|
||||||
|
"Marvin configuration has no host\
|
||||||
|
credentials to check router services")
|
||||||
|
res = result[0]
|
||||||
|
self.debug("Cached Link Local IP: %s" % res)
|
||||||
|
self.assertEqual(
|
||||||
|
linklocal_ip,
|
||||||
|
res,
|
||||||
|
"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)
|
||||||
|
)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(
|
@attr(
|
||||||
@ -564,6 +612,47 @@ class TestSSVMs(cloudstackTestCase):
|
|||||||
1,
|
1,
|
||||||
"Check cloud service is running or not"
|
"Check cloud service is running or not"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
linklocal_ip = None
|
||||||
|
# Check status of cloud service
|
||||||
|
if self.hypervisor.lower() in ('vmware', 'hyperv'):
|
||||||
|
# SSH into SSVMs is done via management server for Vmware and
|
||||||
|
# Hyper-V
|
||||||
|
linklocal_ip = cpvm.privateip
|
||||||
|
result = get_process_status(
|
||||||
|
self.apiclient.connection.mgtSvr,
|
||||||
|
22,
|
||||||
|
self.apiclient.connection.user,
|
||||||
|
self.apiclient.connection.passwd,
|
||||||
|
cpvm.privateip,
|
||||||
|
"cat /var/cache/cloud/cmdline | xargs | sed \"s/ /\\n/g\" | grep eth0ip= | sed \"s/\=/ /g\" | awk '{print $2}'",
|
||||||
|
hypervisor=self.hypervisor
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
linklocal_ip = cpvm.linklocalip
|
||||||
|
host.user, host.passwd = get_host_credentials(
|
||||||
|
self.config, host.ipaddress)
|
||||||
|
result = get_process_status(
|
||||||
|
host.ipaddress,
|
||||||
|
22,
|
||||||
|
host.user,
|
||||||
|
host.passwd,
|
||||||
|
cpvm.linklocalip,
|
||||||
|
"cat /var/cache/cloud/cmdline | xargs | sed \"s/ /\\n/g\" | grep eth0ip= | sed \"s/\=/ /g\" | awk '{print $2}'"
|
||||||
|
)
|
||||||
|
except KeyError:
|
||||||
|
self.skipTest(
|
||||||
|
"Marvin configuration has no host\
|
||||||
|
credentials to check router services")
|
||||||
|
res = result[0]
|
||||||
|
self.debug("Cached Link Local IP: %s" % res)
|
||||||
|
self.assertEqual(
|
||||||
|
linklocal_ip,
|
||||||
|
res,
|
||||||
|
"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)
|
||||||
|
)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(
|
@attr(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user