[Kimchi-devel] [PATCHv7 1/7] Export list vms functionality
Sheldon
shaohef at linux.vnet.ibm.com
Mon Mar 10 09:40:42 UTC 2014
Reviewed-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
On 03/10/2014 05:05 PM, lvroyce at linux.vnet.ibm.com wrote:
> From: Royce Lv <lvroyce at linux.vnet.ibm.com>
>
> List vms is a common function which is likely to be refered
> by multiple module,
> make it static will avoid unnecessary instantiation of vms model
> and stats collecting task to start.
>
> Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
> ---
> src/kimchi/model/vms.py | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
> index 3f3a152..3b8a666 100644
> --- a/src/kimchi/model/vms.py
> +++ b/src/kimchi/model/vms.py
> @@ -226,7 +226,11 @@ class VMsModel(object):
> return name
>
> def get_list(self):
> - conn = self.conn.get()
> + return self.get_vms(self.conn)
> +
> + @staticmethod
> + def get_vms(conn):
> + conn = conn.get()
> names = [dom.name().decode('utf-8') for dom in conn.listAllDomains(0)]
> return sorted(names, key=unicode.lower)
>
--
Thanks and best regards!
Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center
More information about the Kimchi-devel
mailing list