-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/25933/
-----------------------------------------------------------
Review request for cloudstack, Santhosh Edukulla and SrikanteswaraRao Talluri.
Bugs: CLOUDSTACK-7408
https://issues.apache.org/jira/browse/CLOUDSTACK-7408
Repository: cloudstack-git
Description
-------
Test cases in test suite failed while trying SSH using the private key file
after resetting SSH keypair (CS sends private key to client, public key to ssh
host - in this case VM).
SSH failed because the private key file was getting corrupted because it was
passed to Paramiko's load_host_keys() function. This function loads the host
key (fingerprint) into the passed file. Here path to known_hosts file should be
passed instead of path to private key file.
Also set the "look_for_keys" option to False because we don't want Paramiko to
look for ssh keys at default location, because we are passing the private key
itself and it is stored in temporary location.
I have added extra parameter "knownHostsFilePath" which is initialised in
sshClient class. This can be used in future if some user has his/her
known_hosts file at different location than ~/.ssh/known_hosts. However, there
is no necessity to pass this value from test cases as of now, it will be taken
the default.
Diffs
-----
tools/marvin/marvin/lib/base.py b0dd6e2
tools/marvin/marvin/lib/utils.py 8788b3b
tools/marvin/marvin/sshClient.py df2eeee
Diff: https://reviews.apache.org/r/25933/diff/
Testing
-------
Yes. I ran two test classes present in this test suite separately, hence adding
separate logs.
Log:
[I]
Test Reset SSH keys for VM already having SSH key ... === TestName:
test_01_reset_ssh_keys | Status : SUCCESS ===
ok
Reset SSH keys for VM created from password enabled template and ... ===
TestName: test_02_reset_ssh_key_password_enabled_template | Status : SUCCESS ===
ok
Reset SSH key for VM having no SSH key ... === TestName:
test_03_reset_ssh_with_no_key | Status : SUCCESS ===
ok
Reset SSH keys for VM created from password enabled template and ... ===
TestName: test_04_reset_key_passwd_enabled_no_key | Status : SUCCESS ===
ok
Reset SSH keys for VM already having SSH key when VM is in running ... ===
TestName: test_05_reset_key_in_running_state | Status : SUCCESS ===
ok
Reset SSH keys for VM created from password enabled template and ... ===
TestName: test_06_reset_key_passwd_enabled_vm_running | Status : SUCCESS ===
ok
Verify API resetSSHKeyForVirtualMachine with incorrect parameters ... ===
TestName: test_07_reset_keypair_invalid_params | Status : SUCCESS ===
ok
----------------------------------------------------------------------
Ran 7 tests in 2247.949s
OK
[II]
Verify API resetSSHKeyForVirtualMachine for non admin non root ... ===
TestName: test_01_reset_keypair_normal_user | Status : SUCCESS ===
ok
Verify API resetSSHKeyForVirtualMachine for domain admin non root ... ===
TestName: test_02_reset_keypair_domain_admin | Status : SUCCESS ===
ok
Verify API resetSSHKeyForVirtualMachine for domain admin root ... === TestName:
test_03_reset_keypair_root_admin | Status : SUCCESS ===
ok
----------------------------------------------------------------------
Ran 3 tests in 1866.305s
OK
Thanks,
Gaurav Aradhye