diff --git a/systemvm/patches/debian/config/etc/init.d/cloud-early-config b/systemvm/patches/debian/config/etc/init.d/cloud-early-config index 79a85e7fa13..6fbedff77bf 100755 --- a/systemvm/patches/debian/config/etc/init.d/cloud-early-config +++ b/systemvm/patches/debian/config/etc/init.d/cloud-early-config @@ -117,18 +117,31 @@ get_boot_params() { if [ ! -e /dev/vport0p1 ]; then log_it "/dev/vport0p1 not loaded, perhaps guest kernel is too old." && exit 2 fi - while [ -z "$cmd" ]; do - while read line; do - if [[ $line == cmdline:* ]]; then - cmd=${line//cmdline:/} + + local factor=2 + local progress=1 + for i in {1..5} + do + while read line; do + if [[ $line == cmdline:* ]]; then + cmd=${line//cmdline:/} echo $cmd > /var/cache/cloud/cmdline - elif [[ $line == pubkey:* ]]; then - pubkey=${line//pubkey:/} - echo $pubkey > /var/cache/cloud/authorized_keys - echo $pubkey > /root/.ssh/authorized_keys + elif [[ $line == pubkey:* ]]; then + pubkey=${line//pubkey:/} + echo $pubkey > /var/cache/cloud/authorized_keys + echo $pubkey > /root/.ssh/authorized_keys fi - done < /dev/vport0p1 - done + done < /dev/vport0p1 + # 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 ;; vmware) diff --git a/test/integration/smoke/test_ssvm.py b/test/integration/smoke/test_ssvm.py index fc6abf76b86..9224893a12e 100644 --- a/test/integration/smoke/test_ssvm.py +++ b/test/integration/smoke/test_ssvm.py @@ -47,6 +47,13 @@ class TestSSVMs(cloudstackTestCase): self.cleanup = [] self.services = self.testClient.getParsedTestDataConfig() 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 def tearDown(self): @@ -470,6 +477,47 @@ class TestSSVMs(cloudstackTestCase): 1, "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 @attr( @@ -564,6 +612,47 @@ class TestSSVMs(cloudstackTestCase): 1, "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 @attr( @@ -817,7 +906,7 @@ class TestSSVMs(cloudstackTestCase): old_public_ip, "Check Public IP after reboot with that of before reboot" ) - + # Private IP Address of System VMs are allowed to change after reboot - CLOUDSTACK-7745 # Wait for the agent to be up