
@@ -164,12 +164,29 @@ else: name = param
+ # We need to copy the xml files to remote machine for + # successful execution of the ssh remote commands like net-createa via virsh, + # otherwise the remote execution of the command fails when the + # file is not locally present on the remote machine. + if vcmd == 'define' or vcmd == 'create' or vcmd == 'net-create' or \ + vcmd == 'pool-create': + s, o = utils.copy_remote(ip, name, remote=name) + if s != 0: + logger.error("Failed to copy the tempxml file to execute '%s'"\ + " cmd on '%s'", vcmd, ip) + return 0 +
You're doing this copy every time run() is called, which isn't necessary for actions that are taking place on the local system.
Instead, it would be better to copy the key once. In main.py, if the user specifies --target_url, then call copy_remote(). Copying the files is required when we are planning to initiate the test execution on the remote machine from the local machine. target_url is used for remote migration as of now. But otherwise also for cases like the following to run commands like define/net-create via *ssh* we would need the temp files to be present on the remote machines. This is what I realized when I executed some ssh commands manually like
Kaitlin Rupert wrote: the one below: From Machine ABC: ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa root@machinexyz "virsh -c qemu:///system net-create /tmp/tmpPnWJnU" CIM_NS=root/virt CIM_USER=root CIM_PASS=<xyzpasswd> ./runtests libvirt-cim -i <xyzhost> -c -v KVM -g ElementConforms
However, the problem with copy_remote() is that it doesn't do anyCopying the files is required when we are planning to run the tests checking to see if the id_rsa file exists on the remote system. So if a file exists, it is replaced by the testsuite. Also, we don't really need to copy the private key itself, we need to write the public key to the target's authorized_keys file.
Do you mean that copying the ssh_ids.pub key to authorized file will solve the problem ? If yes, then we already have copied the ssh_ids.pub manually to authorized file on the remote machine. Also, the changes are wrt to executing the commands like virsh define , virsh net-create , virsh pool-create and are conditionally executed only for these cases. Please let me know if I am missing something ?
I think something like setup_ssh_keys() is needed to do a proper key exchange between the source and target systems.
Also, there's a long standing bug that needs to be fixed here.. I'll follow up with a patch.
I have not yet verified your patch yet if it will solve the issue which I mentioned above. -- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik@linux.vnet.ibm.com