From ab7a2c3df8a9997c693fdd6ace38b89c67650197 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Mon, 3 Aug 2020 19:44:48 +0530 Subject: [PATCH] ceph-volume: remove api.lvm.get_api_vgs() and related tests Signed-off-by: Rishabh Dave --- src/ceph-volume/ceph_volume/api/lvm.py | 21 --------------- .../ceph_volume/tests/api/test_lvm.py | 27 ------------------- 2 files changed, 48 deletions(-) diff --git a/src/ceph-volume/ceph_volume/api/lvm.py b/src/ceph-volume/ceph_volume/api/lvm.py index 2a3a5e73b7417..cabc7923172a6 100644 --- a/src/ceph-volume/ceph_volume/api/lvm.py +++ b/src/ceph-volume/ceph_volume/api/lvm.py @@ -401,27 +401,6 @@ VG_FIELDS = 'vg_name,pv_count,lv_count,vg_attr,vg_extent_count,vg_free_count,vg_ VG_CMD_OPTIONS = ['--noheadings', '--readonly', '--units=b', '--nosuffix', '--separator=";"'] -def get_api_vgs(): - """ - Return the list of group volumes available in the system using flags to - include common metadata associated with them - - Command and sample delimited output should look like:: - - $ vgs --noheadings --units=b --readonly --separator=';' \ - -o vg_name,pv_count,lv_count,vg_attr,vg_free_count,vg_extent_size - ubuntubox-vg;1;2;wz--n-;12; - - To normalize sizing, the units are forced in 'g' which is equivalent to - gigabytes, which uses multiples of 1024 (as opposed to 1000) - """ - stdout, stderr, returncode = process.call( - ['vgs'] + VG_CMD_OPTIONS + ['-o', VG_FIELDS], - verbose_on_failure=False - ) - return _output_parser(stdout, VG_FIELDS) - - class VolumeGroup(object): """ Represents an LVM group, with some top-level attributes like ``vg_name`` diff --git a/src/ceph-volume/ceph_volume/tests/api/test_lvm.py b/src/ceph-volume/ceph_volume/tests/api/test_lvm.py index 9a2c32d081113..c3df9c6c67632 100644 --- a/src/ceph-volume/ceph_volume/tests/api/test_lvm.py +++ b/src/ceph-volume/ceph_volume/tests/api/test_lvm.py @@ -31,33 +31,6 @@ class TestParseTags(object): assert result['ceph.fsid'] == '0000' -class TestGetAPIVgs(object): - - def test_report_is_emtpy(self, monkeypatch): - monkeypatch.setattr(api.process, 'call', lambda x,**kw: ('\n\n', '', 0)) - assert api.get_api_vgs() == [] - - def test_report_has_stuff(self, monkeypatch): - report = [' VolGroup00'] - monkeypatch.setattr(api.process, 'call', lambda x, **kw: (report, '', 0)) - assert api.get_api_vgs() == [{'vg_name': 'VolGroup00'}] - - def test_report_has_stuff_with_empty_attrs(self, monkeypatch): - report = [' VolGroup00 ;;;;;;4194304'] - monkeypatch.setattr(api.process, 'call', lambda x, **kw: (report, '', 0)) - result = api.get_api_vgs()[0] - assert len(result.keys()) == 7 - assert result['vg_name'] == 'VolGroup00' - assert result['vg_extent_size'] == '4194304' - - def test_report_has_multiple_items(self, monkeypatch): - report = [' VolGroup00;;;;;;;', ' ceph_vg;;;;;;;'] - monkeypatch.setattr(api.process, 'call', lambda x, **kw: (report, '', 0)) - result = api.get_api_vgs() - assert result[0]['vg_name'] == 'VolGroup00' - assert result[1]['vg_name'] == 'ceph_vg' - - class TestGetAPILvs(object): def test_report_is_emtpy(self, monkeypatch): -- 2.39.5