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

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Tue Nov 4 16:11:49 UTC 2008


>  > 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?

Oh, I see.  I had missed this before when we discussed what functions 
should be moved.  Any function that is run within the guest should also 
be moved.

So the following should be moved to 
libvirt-cim/lib/XenKvmLib/xm_virt_util.p:

  processors_count()
  memory_count()
  network_macs()

I had originally thought these were running on the host, not within the 
guest.  Sorry for the confusion!

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




More information about the Libvirt-cim mailing list