[Libvirt-cim] [PATCH] [TEST] Fixing the run() fn of vxml.py

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Thu Mar 19 06:14:40 UTC 2009


Deepti B Kalakeri wrote:
> 
> 
> Kaitlin Rupert wrote:
>>> @@ -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 
> the one below:
> 
> 
> 
>  From Machine ABC:
> 
> ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i 
> /root/.ssh/id_rsa root at 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 ?

This is my mistake Deepti.  When I read the patch, I thought you were 
copying the ssh key of the source to the target.  I wasn't reading 
carefully enough.

Although, I'm not sure that calling copy_remote() each time is a good 
idea.  Since most of the calls will take place on the source system, the 
files should already be present there.

Ideally, you would have a way of specifying whether a net-create call is 
happening on a source or target (and copy only when necessary), but the 
structure of vxml isn't well suited for handling this.

I think this is a reasonable approach for now.


-- 
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list