def __init__(self, cli=None): VNXCliResource.__init__(self, cli=cli) ResourceList.__init__(self) extra_headers = ['timestamp', 'name'] self._metrics_dumper = MetricsDumper( self, extra_headers, _hdr_cb) self._poll = True
def enable_perf_stats(self, interval=None, rsc_clz_list=None): if interval is None: interval = 60 if rsc_clz_list is None: rsc_list_collection = self._default_rsc_list_with_perf_stats() rsc_clz_list = ResourceList.get_rsc_clz_list(rsc_list_collection) def get_real_time_query_list(): paths = calculators.get_all_paths(rsc_clz_list) return UnityMetricRealTimeQuery.get_query_list(self._cli, interval, paths=paths) def f(): query_list = get_real_time_query_list() if query_list: paths = calculators.get_all_paths(rsc_clz_list) ret = query_list.get_query_result(paths) else: ret = None return ret queries = get_real_time_query_list() self._cli.enable_perf_metric(interval, f, rsc_clz_list) return queries
def get_rsc_list_2(self, rsc_clz_list=None): """get the list of resource list to collect based on clz list :param rsc_clz_list: the list of classes to collect :return: filtered list of resource list, like [VNXLunList(), VNXDiskList()] """ rsc_list_2 = self._default_rsc_list_with_perf_stats() if rsc_clz_list is None: rsc_clz_list = ResourceList.get_rsc_clz_list(rsc_list_2) return [rsc_list for rsc_list in rsc_list_2 if rsc_list.get_resource_class() in rsc_clz_list]
def _is_updated(self): return ResourceList._is_updated(self)
def __init__(self, cli=None, **the_filter): UnityResource.__init__(self, cli=cli) ResourceList.__init__(self) self._rsc_filter = the_filter
def test_default_rsc_clz_list_with_perf_stats(self): rsc_list_collection = t_unity()._default_rsc_list_with_perf_stats() clz_list = ResourceList.get_rsc_clz_list(rsc_list_collection) assert_that(clz_list, has_items(UnityDisk, UnityLun, UnityFileSystem))
def __init__(self, cli=None, **the_filter): UnityResource.__init__(self, cli=cli) ResourceList.__init__(self) self._rsc_filter = the_filter