[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xend: Implement get_by_name_label for class XendNetwork



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1196764915 0
# Node ID d1e1db24bd5fb09b53fa4c2c5400fdc10a8393d3
# Parent  7bee812a03979e2b99ba7a6731de22eb24290e2c
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@xxxxxxxxxx>
---
 tools/python/xen/xend/XendNetwork.py |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff -r 7bee812a0397 -r d1e1db24bd5f tools/python/xen/xend/XendNetwork.py
--- a/tools/python/xen/xend/XendNetwork.py      Tue Dec 04 10:40:48 2007 +0000
+++ b/tools/python/xen/xend/XendNetwork.py      Tue Dec 04 10:41:55 2007 +0000
@@ -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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.