debuggers.hg
changeset 16539:d1e1db24bd5f
xend: Implement get_by_name_label for class XendNetwork
Although XenAPI c-bindings support this operation on Network class,
there is no implementation in xend. This patch provides one.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Although XenAPI c-bindings support this operation on Network class,
there is no implementation in xend. This patch provides one.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Tue Dec 04 10:41:55 2007 +0000 (2007-12-04) |
parents | 7bee812a0397 |
children | 9ce9d43a76a2 |
files | tools/python/xen/xend/XendNetwork.py |
line diff
1.1 --- a/tools/python/xen/xend/XendNetwork.py Tue Dec 04 10:40:48 2007 +0000 1.2 +++ b/tools/python/xen/xend/XendNetwork.py Tue Dec 04 10:41:55 2007 +0000 1.3 @@ -65,7 +65,7 @@ class XendNetwork(XendBase): 1.4 return XendBase.getMethods() + methods 1.5 1.6 def getFuncs(self): 1.7 - funcs = ['create'] 1.8 + funcs = ['create', 'get_by_name_label'] 1.9 return XendBase.getFuncs() + funcs 1.10 1.11 getClass = classmethod(getClass) 1.12 @@ -133,9 +133,15 @@ class XendNetwork(XendBase): 1.13 1.14 return uuid 1.15 1.16 - create_phy = classmethod(create_phy) 1.17 - recreate = classmethod(recreate) 1.18 - create = classmethod(create) 1.19 + def get_by_name_label(cls, name): 1.20 + return [inst.get_uuid() 1.21 + for inst in XendAPIStore.get_all(cls.getClass()) 1.22 + if inst.get_name_label() == name] 1.23 + 1.24 + create_phy = classmethod(create_phy) 1.25 + recreate = classmethod(recreate) 1.26 + create = classmethod(create) 1.27 + get_by_name_label = classmethod(get_by_name_label) 1.28 1.29 def __init__(self, record, uuid): 1.30 XendBase.__init__(self, uuid, record)