Fix instance volume mount script creation
Now the volume mount script would be created with correct newlines.
Also, this change contain some additional debugging information, so
the process of creating and mounting the volume logged to the
instance /var/log/messages through syslog. Also, this commit contain
the the workaround for the AuthenticationException because the
Cirros image starts ssh servece just before the cloud-init and in
some cases we need to wait when the instance_initial_scenario canges
the password for the cirros user.
Change-Id: Icb981c90a5ed8beb75fa119158161bf5ea3e5900
Closes-Bug: #1588808
Signed-off-by: Maksim Malchuk <mmalchuk@mirantis.com>
(cherry picked from commit d28b6868f5
)
This commit is contained in:
parent
7abc5a5821
commit
235edd3495
@ -4,7 +4,7 @@ echo "Creating test file"
|
||||
touch /home/test_file
|
||||
|
||||
echo "Creating volume mount script on instance"
|
||||
echo "#!/bin/sh\nsudo /usr/sbin/mkfs.ext4 /dev/vdb\nsudo mount /dev/vdb /mnt" | tee /home/mount_volume.sh
|
||||
echo -e '#!/bin/sh\nsudo /usr/sbin/mkfs.ext4 /dev/vdb | logger -t mount_volume.sh\nsudo mount -t ext4 /dev/vdb /mnt | logger -t mount_volume.sh\nmount | grep /mnt | logger -t mount_volume.sh' | tee /home/mount_volume.sh
|
||||
chmod 777 /home/mount_volume.sh
|
||||
|
||||
echo -e "test\ntest" | passwd cirros
|
||||
|
@ -14,6 +14,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import time
|
||||
|
||||
import paramiko
|
||||
from pkg_resources import parse_version
|
||||
from proboscis.asserts import assert_true, assert_false, assert_equal
|
||||
from proboscis import SkipTest
|
||||
@ -655,7 +656,17 @@ class VmBackedWithCephMigrationBasic(TestBasic):
|
||||
|
||||
wait(lambda: tcp_ping(floating_ip.ip, 22), timeout=120)
|
||||
|
||||
def ssh_ready(remote, ip, creds):
|
||||
try:
|
||||
os.execute_through_host(remote, ip, '/bin/true', creds)
|
||||
return True
|
||||
except paramiko.AuthenticationException:
|
||||
logger.info("Authentication failed. Trying again in a minute.")
|
||||
time.sleep(60)
|
||||
return False
|
||||
|
||||
with self.fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
wait(lambda: ssh_ready(remote, floating_ip.ip, creds), timeout=300)
|
||||
md5before = os.get_md5sum(
|
||||
"/home/test_file", remote, floating_ip.ip, creds)
|
||||
|
||||
@ -743,6 +754,8 @@ class VmBackedWithCephMigrationBasic(TestBasic):
|
||||
logger.info("Create filesystem and mount volume")
|
||||
|
||||
with self.fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
wait(lambda: ssh_ready(remote, floating_ip.ip, creds), timeout=300)
|
||||
|
||||
os.execute_through_host(
|
||||
remote,
|
||||
floating_ip.ip, 'sudo sh /home/mount_volume.sh', creds)
|
||||
|
Loading…
Reference in New Issue
Block a user