ia64/xen-unstable
changeset 13712:c2f1bb01bca3
Tidy up the VBD API calls.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
Signed-off-by: Ewan Mellor <ewan@xensource.com>
author | Ewan Mellor <ewan@xensource.com> |
---|---|
date | Sun Jan 28 23:05:59 2007 +0000 (2007-01-28) |
parents | 044c57d0fef2 |
children | a403d70fc94c |
files | tools/python/xen/xend/XendAPI.py |
line diff
1.1 --- a/tools/python/xen/xend/XendAPI.py Sun Jan 28 18:39:17 2007 +0000 1.2 +++ b/tools/python/xen/xend/XendAPI.py Sun Jan 28 23:05:59 2007 +0000 1.3 @@ -1404,49 +1404,38 @@ class XendAPI(object): 1.4 return xen_api_success_void() 1.5 1.6 # attributes (rw) 1.7 + def _VBD_get(self, vbd_ref, prop): 1.8 + return xen_api_success( 1.9 + XendDomain.instance().get_dev_property_by_uuid( 1.10 + 'vbd', vbd_ref, prop)) 1.11 + 1.12 def VBD_get_VM(self, session, vbd_ref): 1.13 - xendom = XendDomain.instance() 1.14 - return xen_api_success(xendom.get_dev_property_by_uuid('vbd', 1.15 - vbd_ref, 'VM')) 1.16 + return self._VBD_get(vbd_ref, 'VM') 1.17 1.18 def VBD_get_VDI(self, session, vbd_ref): 1.19 - xendom = XendDomain.instance() 1.20 - return xen_api_success(xendom.get_dev_property_by_uuid('vbd', 1.21 - vbd_ref, 'VDI')) 1.22 - 1.23 + return self._VBD_get(vbd_ref, 'VDI') 1.24 + 1.25 def VBD_get_device(self, session, vbd_ref): 1.26 - xendom = XendDomain.instance() 1.27 - return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref, 1.28 - 'device')) 1.29 + return self._VBD_get(vbd_ref, 'device') 1.30 + 1.31 def VBD_get_bootable(self, session, vbd_ref): 1.32 - xendom = XendDomain.instance() 1.33 - return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref, 1.34 - 'bootable')) 1.35 + return self._VBD_get(vbd_ref, 'bootable') 1.36 + 1.37 def VBD_get_mode(self, session, vbd_ref): 1.38 - xendom = XendDomain.instance() 1.39 - return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref, 1.40 - 'mode')) 1.41 + return self._VBD_get(vbd_ref, 'mode') 1.42 + 1.43 def VBD_get_driver(self, session, vbd_ref): 1.44 - xendom = XendDomain.instance() 1.45 - return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref, 1.46 - 'driver')) 1.47 + return self._VBD_get(vbd_ref, 'driver') 1.48 1.49 def VBD_get_type(self, session, vbd_ref): 1.50 - xendom = XendDomain.instance() 1.51 - return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref, 1.52 - 'type')) 1.53 + return self._VBD_get(vbd_ref, 'type') 1.54 1.55 def VBD_get_io_read_kbs(self, session, vbd_ref): 1.56 - xendom = XendDomain.instance() 1.57 - return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref, 1.58 - 'io_read_kbs')) 1.59 - 1.60 + return self._VBD_get(vbd_ref, 'io_read_kbs') 1.61 1.62 def VBD_get_io_write_kbs(self, session, vbd_ref): 1.63 - xendom = XendDomain.instance() 1.64 - return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref, 1.65 - 'io_read_kbs')) 1.66 - 1.67 + return self._VBD_get(vbd_ref, 'io_write_kbs') 1.68 + 1.69 def VBD_set_bootable(self, session, vbd_ref, bootable): 1.70 bootable = bool(bootable) 1.71 xd = XendDomain.instance()