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-changelog

[Xen-changelog] [xen-unstable] Tidy up the VBD API calls.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Tidy up the VBD API calls.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 30 Jan 2007 06:01:00 -0800
Delivery-date: Tue, 30 Jan 2007 06:03:53 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1170025559 0
# Node ID c2f1bb01bca3dc651d77f1b14deb39115208452f
# Parent  044c57d0fef28055d7465778d885114cdf3e4ef9
Tidy up the VBD API calls.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendAPI.py |   49 +++++++++++++++------------------------
 1 files changed, 19 insertions(+), 30 deletions(-)

diff -r 044c57d0fef2 -r c2f1bb01bca3 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Sun Jan 28 18:39:17 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Sun Jan 28 23:05:59 2007 +0000
@@ -1404,49 +1404,38 @@ class XendAPI(object):
         return xen_api_success_void()
 
     # attributes (rw)
+    def _VBD_get(self, vbd_ref, prop):
+        return xen_api_success(
+            XendDomain.instance().get_dev_property_by_uuid(
+            'vbd', vbd_ref, prop))
+
     def VBD_get_VM(self, session, vbd_ref):
-        xendom = XendDomain.instance()
-        return xen_api_success(xendom.get_dev_property_by_uuid('vbd',
-                                                               vbd_ref, 'VM'))
+        return self._VBD_get(vbd_ref, 'VM')
     
     def VBD_get_VDI(self, session, vbd_ref):
-        xendom = XendDomain.instance()
-        return xen_api_success(xendom.get_dev_property_by_uuid('vbd',
-                                                               vbd_ref, 'VDI'))
-    
+        return self._VBD_get(vbd_ref, 'VDI')
+
     def VBD_get_device(self, session, vbd_ref):
-        xendom = XendDomain.instance()
-        return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref,
-                                                               'device'))
+        return self._VBD_get(vbd_ref, 'device')
+
     def VBD_get_bootable(self, session, vbd_ref):
-        xendom = XendDomain.instance()
-        return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref,
-                                                               'bootable'))
+        return self._VBD_get(vbd_ref, 'bootable')
+
     def VBD_get_mode(self, session, vbd_ref):
-        xendom = XendDomain.instance()
-        return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref,
-                                                               'mode'))
+        return self._VBD_get(vbd_ref, 'mode')
+
     def VBD_get_driver(self, session, vbd_ref):
-        xendom = XendDomain.instance()
-        return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref,
-                                                               'driver'))
+        return self._VBD_get(vbd_ref, 'driver')
 
     def VBD_get_type(self, session, vbd_ref):
-        xendom = XendDomain.instance()
-        return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref,
-                                                              'type'))        
+        return self._VBD_get(vbd_ref, 'type')
 
     def VBD_get_io_read_kbs(self, session, vbd_ref):
-        xendom = XendDomain.instance()
-        return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref,
-                                                              'io_read_kbs'))
-    
+        return self._VBD_get(vbd_ref, 'io_read_kbs')
     
     def VBD_get_io_write_kbs(self, session, vbd_ref):
-        xendom = XendDomain.instance()
-        return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref,
-                                                              'io_read_kbs'))
-    
+        return self._VBD_get(vbd_ref, 'io_write_kbs')
+
     def VBD_set_bootable(self, session, vbd_ref, bootable):
         bootable = bool(bootable)
         xd = XendDomain.instance()

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Tidy up the VBD API calls., Xen patchbot-unstable <=