[Libvirt-cim] [PATCH] [TEST] Move some functions from utils.py to xm_virt_util.py

Guo Lian Yun yunguol at cn.ibm.com
Tue Nov 4 02:17:18 UTC 2008


libvirt-cim-bounces at redhat.com wrote on 2008-11-04 06:13:53:

> >  > > +def run_remote_guest(ip, domain, command):
> >  > > +    """ Execute commands on remote guest console.
> >  > > +    """
> >  > > +
> >  > > +    cmd = 'python %s %s "%s"' % (CONSOLE_APP_PATH, domain, 
command)
> >  > > +
> >  > > +    return run_remote(ip, cmd)
> >  > > +
> >  > > +
> >  >
> >  >    Kaitlin,
> >  >
> >  >    I think we can remove run_remote_guest to xm_virt_util.py under
> >  > ../libvirt-cim/lib/XenKvmLib,
> >  >    because it have to be used by live.py under lib/VirtLib. We have
> >  > to make it stay in utils.py.
> > 
> >      I'm sorry, I intend to say we cann't remove run_remote_guest() 
from 
> > ../lib/XenKvmLib to xm_virt_util.py =)
> > 
> >  >    Thoughts?
> >  > 
> >  >    If you agree to make it stay in utils.py, I will rework on this 
> > patch.
> >  >    Thanks!
> 
> I'm sorry Daisy - I'm not sure I understand what you mean here.  Are you 

> saying that run_remote_guest() needs to stay in lib/VirtLib/utils.py?
> 
   Yeah, I want to say that run_remote_guest() needs to stay in 
lib/VirtLib/utils.py.
   It because that lib/VirtLib/live.py have to call run_remote_guest(), 
such as below 
   function in live.py:

   def processors_count(ip, vs_name):
    """Returns the number of processors of the specified VS
    """

    guest_cmd = "grep '^$' /proc/cpuinfo | wc -l"

    rc, out = utils.run_remote_guest(ip, vs_name, guest_cmd)
    if rc != 0:
        return -1

    try:
        cpus = int(out)
        return cpus
    except ValueError:
        return -1

   If we move it to /libvirt-cim/lib/XenKvmLib/xm_virt_util.py, how does 
live.py work? 
   Thanks!

> If so, why?
> 
> -- 
> Kaitlin Rupert
> IBM Linux Technology Center
> kaitlin at linux.vnet.ibm.com
> 
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20081104/d8da7d76/attachment.htm>


More information about the Libvirt-cim mailing list