From 3dd09e36f8905d80c078dd83c9be361839382cc7 Mon Sep 17 00:00:00 2001 From: Babu Shanmugam Date: Fri, 7 Mar 2014 12:49:20 +0000 Subject: [PATCH] Removed nw_info from sysinfo Signed-off-by: Babu Shanmugam --- README.md | 4 - client/ceph-brag | 25 ------- server/ceph_brag/json.py | 3 +- server/ceph_brag/model/db.py | 4 - server/sample.json | 138 +++++++++++++++++------------------ 5 files changed, 69 insertions(+), 105 deletions(-) diff --git a/README.md b/README.md index cb2622100871d..9791eeea9b50b 100644 --- a/README.md +++ b/README.md @@ -75,10 +75,6 @@ Run 'ceph-brag -h' to get the usage information of this tool. ], "sysinfo": [ { - "nw_info": { - "hostname": "ceph-brag", - "address": "127.0.0.1" - }, "hw_info": { "swap_kb": 0, "arch": "x86_64", diff --git a/client/ceph-brag b/client/ceph-brag index b28bcd4926731..c4dc41cd7911e 100755 --- a/client/ceph-brag +++ b/client/ceph-brag @@ -165,7 +165,6 @@ def get_sysinfo(max_osds): osd_metadata_available = True os_info = {} hw_info = {} - nw_info = {} jmeta = json.loads(o) @@ -194,11 +193,6 @@ def get_sysinfo(max_osds): hw_info['swap_kb'] = int(jmeta['mem_swap_kb']) meta['hw_info'] = hw_info - (ip, hname) = get_osd_host(count) - nw_info['address'] = ip - nw_info['hostname'] = hname - meta['nw_info'] = nw_info - sysinfo.append(meta) count = count + 1 @@ -207,25 +201,6 @@ def get_sysinfo(max_osds): return sysinfo -def get_osd_host(osd_id): - loc = {} - - (rc, o, e) = run_command(['ceph', 'osd', 'find', str(osd_id)]) - if rc is not 0: - raise RuntimeError("\'ceph osd find\' failed - " + e) - - jloc = json.loads(o) - - mo = re.search("(\d+.\d+.\d+.\d+).*", jloc['ip']) - if mo is None: - #Might be in ipv6 format, TODO: Verify - return None; - - ip = mo.group(1) - host = jloc['crush_location']['host'] - - return (ip, host) - def get_ownership_info(): (rc, o, e) = run_command(['ceph', 'config-key', 'get', CLUSTER_OWNERSHIP_NAME]) diff --git a/server/ceph_brag/json.py b/server/ceph_brag/json.py index f272209477ed9..07ba7c4256bb1 100644 --- a/server/ceph_brag/json.py +++ b/server/ceph_brag/json.py @@ -45,8 +45,7 @@ def jsonify_pools_info(pool): @jsonify.register(db.osds_info) def jsonify_osds_info(osd): - return dict(nw_info={'address':osd.nw_address,'hostname':osd.hostname}, - hw_info={'swap_kb':osd.swap_kb,'mem_kb':osd.mem_kb, + return dict(hw_info={'swap_kb':osd.swap_kb,'mem_kb':osd.mem_kb, 'arch':osd.arch, 'cpu':osd.cpu}, id=osd.osd_id, os_info={'os':osd.os,'version':osd.os_version, diff --git a/server/ceph_brag/model/db.py b/server/ceph_brag/model/db.py index 4696a31332732..66b8d61181500 100644 --- a/server/ceph_brag/model/db.py +++ b/server/ceph_brag/model/db.py @@ -67,8 +67,6 @@ class osds_info(Base): index = Column(Integer, primary_key=True) vid = Column(ForeignKey('version_info.index')) osd_id = Column(String(8)) - nw_address = Column(String(16)) - hostname = Column(String(16)) swap_kb = Column(Integer) mem_kb = Column(Integer) arch = Column(String(16)) @@ -190,8 +188,6 @@ def put_new_version(data): for o in osds: osd = osds_info(vid=vi.index, osd_id=o['id'], - nw_address=o['nw_info']['address'], - hostname=o['nw_info']['hostname'], swap_kb=o['hw_info']['swap_kb'], mem_kb=o['hw_info']['mem_kb'], arch=o['hw_info']['arch'], diff --git a/server/sample.json b/server/sample.json index d51fe59f7f956..5218b65b0d02a 100644 --- a/server/sample.json +++ b/server/sample.json @@ -1,74 +1,72 @@ { - "cluster_creation_date": "2014-01-16 13:38:41.928551", - "uuid": "20679d0e-04b1-4004-8ee9-45ac271510e9", - "components_count": { - "bytes": { - "count": 0, - "scale": "bytes" - }, - "osds": 1, - "objects": 0, - "pgs": 192, - "pools": 3, - "mdss": 1, - "mons": 1 + "cluster_creation_date": "2014-01-16 13:38:41.928551", + "uuid": "20679d0e-04b1-4004-8ee9-45ac271510e9", + "components_count": { + "num_pgs": 192, + "num_mdss": 1, + "num_osds": 1, + "num_bytes": "0 bytes", + "num_pools": 3, + "num_mons": 1, + "num_objects": 0 + }, + "crush_types": [ + { + "count": 1, + "type": "osd" + }, + { + "count": 1, + "type": "rack" + }, + { + "count": 1, + "type": "host" + }, + { + "count": 1, + "type": "root" + } + ], + "ownership": { + "organization": "eNovance", + "description": "Use case1", + "name": "Cluster1", + "email": "mail@enovance.com" + }, + "pool_metadata": [ + { + "type": "replicated", + "id": "0", + "size": 3 + }, + { + "type": "replicated", + "id": "1", + "size": 3 + }, + { + "type": "replicated", + "id": "2", + "size": 3 + } + ], + "sysinfo": [ + { + "hw_info": { + "swap_kb": 0, + "arch": "x86_64", + "cpu": "Intel Xeon E312xx (Sandy Bridge)", + "mem_kb": 2051648 }, - "crush_types": [ - "osd", - "host", - "chassis", - "rack", - "row", - "pdu", - "pod", - "room", - "datacenter", - "region", - "root" - ], - "ownership": { - "organization": "eNovance", - "description": "Use case1", - "email": "mail@enovance.com", - "name": "Cluster1" + "id": 0, + "os_info": { + "version": "3.2.0-23-virtual", + "os": "Linux", + "description": "#36-Ubuntu SMP Tue Apr 10 22:29:03 UTC 2012", + "distro": "Ubuntu 12.04 precise (Ubuntu 12.04 LTS)" }, - "pool_metadata": [ - { - "rep_size": 3, - "id": "0", - "name": "data" - }, - { - "rep_size": 3, - "id": "1", - "name": "metadata" - }, - { - "rep_size": 3, - "id": "2", - "name": "rbd" - } - ], - "sysinfo": [ - { - "nw_info": { - "hostname": "ceph-brag", - "address": "127.0.0.1" - }, - "hw_info": { - "swap_kb": 0, - "arch": "x86_64", - "cpu": "Intel Xeon E312xx (Sandy Bridge)", - "mem_kb": 2051648 - }, - "id": 0, - "os_info": { - "version": "3.2.0-23-virtual", - "os": "Linux", - "description": "#36-Ubuntu SMP Tue Apr 10 22:29:03 UTC 2012", - "distro": "Ubuntu 12.04 precise (Ubuntu 12.04 LTS)" - }, - "ceph_version": "ceph version 0.75-229-g4050eae (4050eae32cd77a1c210ca11d0f12c74daecb1bd3)" - } - ] + "ceph_version": "0.75-229-g4050eae(4050eae32cd77a1c210ca11d0f12c74daecb1bd3)" } + ] +} -- 2.39.5