ia64/xen-unstable

changeset 14587:e43a9c52c843

Fix some fields so that they are declared as read-only (always should have
been) and implement {VBD,VIF}_metrics.get_all.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Tue Mar 27 14:22:29 2007 +0100 (2007-03-27)
parents 7eff43986c3a
children 035ce339d337
files tools/python/xen/xend/XendAPI.py
line diff
     1.1 --- a/tools/python/xen/xend/XendAPI.py	Tue Mar 27 14:02:17 2007 +0100
     1.2 +++ b/tools/python/xen/xend/XendAPI.py	Tue Mar 27 14:22:29 2007 +0100
     1.3 @@ -982,10 +982,10 @@ class XendAPI(object):
     1.4      # Xen API: Class PIF
     1.5      # ----------------------------------------------------------------
     1.6  
     1.7 -    PIF_attr_ro = ['metrics']
     1.8 +    PIF_attr_ro = ['network',
     1.9 +                   'host',
    1.10 +                   'metrics']
    1.11      PIF_attr_rw = ['device',
    1.12 -                   'network',
    1.13 -                   'host',
    1.14                     'MAC',
    1.15                     'MTU',
    1.16                     'VLAN']
    1.17 @@ -1689,6 +1689,9 @@ class XendAPI(object):
    1.18      VM_metrics_attr_rw = []
    1.19      VM_metrics_methods = []
    1.20  
    1.21 +    def VIF_metrics_get_all(self, session):
    1.22 +        return self.VIF_get_all(session)
    1.23 +
    1.24      def _VM_metrics_get(self, _, ref):
    1.25          return XendVMMetrics.get_by_uuid(ref)
    1.26  
    1.27 @@ -1699,11 +1702,11 @@ class XendAPI(object):
    1.28      # Xen API: Class VBD
    1.29      # ----------------------------------------------------------------
    1.30  
    1.31 -    VBD_attr_ro = ['metrics',
    1.32 +    VBD_attr_ro = ['VM',
    1.33 +                   'VDI',
    1.34 +                   'metrics',
    1.35                     'runtime_properties']
    1.36 -    VBD_attr_rw = ['VM',
    1.37 -                   'VDI',
    1.38 -                   'device',
    1.39 +    VBD_attr_rw = ['device',
    1.40                     'bootable',
    1.41                     'mode',
    1.42                     'type']
    1.43 @@ -1854,6 +1857,9 @@ class XendAPI(object):
    1.44      VBD_metrics_attr_rw = []
    1.45      VBD_methods = []
    1.46  
    1.47 +    def VBD_metrics_get_all(self, session):
    1.48 +        return self.VBD_get_all(session)
    1.49 +
    1.50      def VBD_metrics_get_record(self, _, ref):
    1.51          vm = XendDomain.instance().get_vm_with_dev_uuid('vbd', ref)
    1.52          if not vm:
    1.53 @@ -1877,11 +1883,11 @@ class XendAPI(object):
    1.54      # Xen API: Class VIF
    1.55      # ----------------------------------------------------------------
    1.56  
    1.57 -    VIF_attr_ro = ['metrics',
    1.58 +    VIF_attr_ro = ['network',
    1.59 +                   'VM',
    1.60 +                   'metrics',
    1.61                     'runtime_properties']
    1.62      VIF_attr_rw = ['device',
    1.63 -                   'network',
    1.64 -                   'VM',
    1.65                     'MAC',
    1.66                     'MTU']
    1.67  
    1.68 @@ -1945,10 +1951,10 @@ class XendAPI(object):
    1.69          return xen_api_success(vif_ref)
    1.70  
    1.71      def VIF_get_VM(self, session, vif_ref):
    1.72 -        xendom = XendDomain.instance()        
    1.73 -        vm = xendom.get_vm_with_dev_uuid('vif', vif_ref)        
    1.74 +        xendom = XendDomain.instance()
    1.75 +        vm = xendom.get_vm_with_dev_uuid('vif', vif_ref)
    1.76          return xen_api_success(vm.get_uuid())
    1.77 -    
    1.78 +
    1.79      def VIF_get_MTU(self, session, vif_ref):
    1.80          return self._VIF_get(vif_ref, 'MTU')
    1.81