WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATC][xend] Implement get_by_name_label for class XendNetwo

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATC][xend] Implement get_by_name_label for class XendNetwork
From: Jim Fehlig <jfehlig@xxxxxxxxxx>
Date: Thu, 29 Nov 2007 16:07:57 -0700
Delivery-date: Thu, 29 Nov 2007 15:08:46 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.8 (X11/20060911)
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 <jfehlig@xxxxxxxxxx>

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)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATC][xend] Implement get_by_name_label for class XendNetwork, Jim Fehlig <=