[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Convert XendPIFMetrics into an autoplug class.
# HG changeset patch # User Ewan Mellor <ewan@xxxxxxxxxxxxx> # Date 1174953245 -3600 # Node ID f6c38a084bef70bbf95816ae3b035ac8cb706339 # Parent 75c797744eb4d216cdfbf0510a341f88e44e3aed Convert XendPIFMetrics into an autoplug class. Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx> --- tools/python/xen/xend/XendAPI.py | 20 +++++--------------- tools/python/xen/xend/XendPIFMetrics.py | 8 +++++--- 2 files changed, 10 insertions(+), 18 deletions(-) diff -r 75c797744eb4 -r f6c38a084bef tools/python/xen/xend/XendAPI.py --- a/tools/python/xen/xend/XendAPI.py Tue Mar 27 00:48:46 2007 +0100 +++ b/tools/python/xen/xend/XendAPI.py Tue Mar 27 00:54:05 2007 +0100 @@ -34,6 +34,7 @@ from xen.xend.XendLogging import log from xen.xend.XendLogging import log from xen.xend.XendNetwork import XendNetwork from xen.xend.XendTask import XendTask +from xen.xend.XendPIFMetrics import XendPIFMetrics from xen.xend.XendVMMetrics import XendVMMetrics from xen.xend.XendAPIConstants import * @@ -438,8 +439,9 @@ class XendAPI(object): } autoplug_classes = { - 'network' : XendNetwork, - 'VM_metrics' : XendVMMetrics, + 'network' : XendNetwork, + 'VM_metrics' : XendVMMetrics, + 'PIF_metrics' : XendPIFMetrics, } # Cheat methods @@ -1071,20 +1073,8 @@ class XendAPI(object): def PIF_metrics_get_all(self, _): return xen_api_success(XendNode.instance().pif_metrics.keys()) - def _PIF_metrics_get(self, ref): + def _PIF_metrics_get(self, _, ref): return XendNode.instance().pif_metrics[ref] - - def PIF_metrics_get_record(self, _, ref): - return xen_api_success(self._PIF_metrics_get(ref).get_record()) - - def PIF_metrics_get_io_read_kbs(self, _, ref): - return xen_api_success(self._PIF_metrics_get(ref).get_io_read_kbs()) - - def PIF_metrics_get_io_write_kbs(self, _, ref): - return xen_api_success(self._PIF_metrics_get(ref).get_io_write_kbs()) - - def PIF_metrics_get_last_updated(self, _1, _2): - return xen_api_success(now()) # Xen API: Class VM diff -r 75c797744eb4 -r f6c38a084bef tools/python/xen/xend/XendPIFMetrics.py --- a/tools/python/xen/xend/XendPIFMetrics.py Tue Mar 27 00:48:46 2007 +0100 +++ b/tools/python/xen/xend/XendPIFMetrics.py Tue Mar 27 00:54:05 2007 +0100 @@ -39,11 +39,13 @@ class XendPIFMetrics: return pifs_util[pifname][n] return 0.0 + def get_last_updated(self): + import xen.xend.XendAPI as XendAPI + return XendAPI.now() + def get_record(self): - import xen.xend.XendAPI as XendAPI return {'uuid' : self.uuid, - 'PIF' : self.pif.uuid, 'io_read_kbs' : self.get_io_read_kbs(), 'io_write_kbs' : self.get_io_write_kbs(), - 'last_updated' : XendAPI.now(), + 'last_updated' : self.get_last_updated(), } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |