From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Fehlig Subject: [PATC][xend] Implement get_by_name_label for class XendNetwork Date: Thu, 29 Nov 2007 16:07:57 -0700 Message-ID: <474F464D.9050300@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040200040903000400070107" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------040200040903000400070107 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Although XenAPI c-bindings support this operation on Network class, there is no implementation in xend. This patch provides one. Regards, Jim Signed-off-by: Jim Fehlig --------------040200040903000400070107 Content-Type: text/x-patch; name="xend_network.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xend_network.patch" diff -r e10eacec8b91 tools/python/xen/xend/XendNetwork.py --- a/tools/python/xen/xend/XendNetwork.py Wed Nov 28 22:36:33 2007 +0000 +++ b/tools/python/xen/xend/XendNetwork.py Thu Nov 29 15:27:46 2007 -0700 @@ -65,7 +65,7 @@ class XendNetwork(XendBase): return XendBase.getMethods() + methods def getFuncs(self): - funcs = ['create'] + funcs = ['create', 'get_by_name_label'] return XendBase.getFuncs() + funcs getClass = classmethod(getClass) @@ -133,9 +133,15 @@ class XendNetwork(XendBase): return uuid - create_phy = classmethod(create_phy) - recreate = classmethod(recreate) - create = classmethod(create) + def get_by_name_label(cls, name): + return [inst.get_uuid() + for inst in XendAPIStore.get_all(cls.getClass()) + if inst.get_name_label() == name] + + create_phy = classmethod(create_phy) + recreate = classmethod(recreate) + create = classmethod(create) + get_by_name_label = classmethod(get_by_name_label) def __init__(self, record, uuid): XendBase.__init__(self, uuid, record) --------------040200040903000400070107 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------040200040903000400070107--