From 280ce7690cfc15c53a21266fbfd151cd4af5b168 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Tue, 12 Apr 2022 13:14:02 +0300 Subject: [PATCH] FIXUP - don't expose sync_percent, copy_percent is the same maybe --- src/lib/plugin_apis/lvm.api | 2 -- src/plugins/lvm.c | 15 ++++----------- src/plugins/lvm.h | 1 - tests/lvm_test.py | 4 ---- 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/lib/plugin_apis/lvm.api b/src/lib/plugin_apis/lvm.api index 325bfff7a..7c0422dd2 100644 --- a/src/lib/plugin_apis/lvm.api +++ b/src/lib/plugin_apis/lvm.api @@ -310,7 +310,6 @@ typedef struct BDLVMLVdata { guint64 copy_percent; gchar **lv_tags; gchar *health_status; - guint64 sync_percent; } BDLVMLVdata; /** @@ -342,7 +341,6 @@ BDLVMLVdata* bd_lvm_lvdata_copy (BDLVMLVdata *data) { new_data->copy_percent = data->copy_percent; new_data->lv_tags = g_strdupv (data->lv_tags); new_data->health_status = g_strdup (data->health_status); - new_data->sync_percent = data->sync_percent; return new_data; } diff --git a/src/plugins/lvm.c b/src/plugins/lvm.c index 9bc4f2642..08434788d 100644 --- a/src/plugins/lvm.c +++ b/src/plugins/lvm.c @@ -157,7 +157,6 @@ BDLVMLVdata* bd_lvm_lvdata_copy (BDLVMLVdata *data) { new_data->copy_percent = data->copy_percent; new_data->lv_tags = g_strdupv (data->lv_tags); new_data->health_status = g_strdup (data->health_status); - new_data->sync_percent = data->sync_percent; return new_data; } @@ -667,12 +666,6 @@ static BDLVMLVdata* get_lv_data_from_table (GHashTable *table, gboolean free_tab data->health_status = g_strdup (g_hash_table_lookup (table, "LVM2_LV_HEALTH_STATUS")); - value = (gchar*) g_hash_table_lookup (table, "LVM2_SYNC_PERCENT"); - if (value) - data->sync_percent = g_ascii_strtoull (value, NULL, 0); - else - data->sync_percent = 0; - /* replace '[' and ']' (marking LVs as internal) with spaces and then remove all the leading and trailing whitespace */ g_strstrip (g_strdelimit (data->pool_lv, "[]", ' ')); @@ -1946,7 +1939,7 @@ gboolean bd_lvm_delete_lv_tags (const gchar *vg_name, const gchar *lv_name, cons BDLVMLVdata* bd_lvm_lvinfo (const gchar *vg_name, const gchar *lv_name, GError **error) { const gchar *args[11] = {"lvs", "--noheadings", "--nosuffix", "--nameprefixes", "--unquoted", "--units=b", "-a", - "-o", "vg_name,lv_name,lv_uuid,lv_size,lv_attr,segtype,origin,pool_lv,data_lv,metadata_lv,role,move_pv,data_percent,metadata_percent,copy_percent,lv_tags,health_status,sync_percent", + "-o", "vg_name,lv_name,lv_uuid,lv_size,lv_attr,segtype,origin,pool_lv,data_lv,metadata_lv,role,move_pv,data_percent,metadata_percent,copy_percent,lv_tags,health_status", NULL, NULL}; GHashTable *table = NULL; @@ -1970,7 +1963,7 @@ BDLVMLVdata* bd_lvm_lvinfo (const gchar *vg_name, const gchar *lv_name, GError * for (lines_p = lines; *lines_p; lines_p++) { table = parse_lvm_vars ((*lines_p), &num_items); - if (table && (num_items == 18)) { + if (table && (num_items == 17)) { g_strfreev (lines); return get_lv_data_from_table (table, TRUE); } else @@ -1998,7 +1991,7 @@ BDLVMLVdata* bd_lvm_lvinfo (const gchar *vg_name, const gchar *lv_name, GError * BDLVMLVdata** bd_lvm_lvs (const gchar *vg_name, GError **error) { const gchar *args[11] = {"lvs", "--noheadings", "--nosuffix", "--nameprefixes", "--unquoted", "--units=b", "-a", - "-o", "vg_name,lv_name,lv_uuid,lv_size,lv_attr,segtype,origin,pool_lv,data_lv,metadata_lv,role,move_pv,data_percent,metadata_percent,copy_percent,lv_tags,health_status,sync_percent", + "-o", "vg_name,lv_name,lv_uuid,lv_size,lv_attr,segtype,origin,pool_lv,data_lv,metadata_lv,role,move_pv,data_percent,metadata_percent,copy_percent,lv_tags,health_status", NULL, NULL}; GHashTable *table = NULL; @@ -2038,7 +2031,7 @@ BDLVMLVdata** bd_lvm_lvs (const gchar *vg_name, GError **error) { for (lines_p = lines; *lines_p; lines_p++) { table = parse_lvm_vars ((*lines_p), &num_items); - if (table && (num_items == 18)) { + if (table && (num_items == 17)) { /* valid line, try to parse and record it */ lvdata = get_lv_data_from_table (table, TRUE); if (lvdata) { diff --git a/src/plugins/lvm.h b/src/plugins/lvm.h index 01d599cf4..df48ceee3 100644 --- a/src/plugins/lvm.h +++ b/src/plugins/lvm.h @@ -146,7 +146,6 @@ typedef struct BDLVMLVdata { guint64 copy_percent; gchar **lv_tags; gchar *health_status; - guint64 sync_percent; } BDLVMLVdata; void bd_lvm_lvdata_free (BDLVMLVdata *data); diff --git a/tests/lvm_test.py b/tests/lvm_test.py index 9c5f83ef3..4bd10f87f 100644 --- a/tests/lvm_test.py +++ b/tests/lvm_test.py @@ -851,7 +851,6 @@ def test_lvpartial(self): info = BlockDev.lvm_lvinfo("testVG", "testLV") self.assertTrue(info) self.assertEqual(info.health_status, "") - self.assertEqual(info.sync_percent, 100) # remove records of missing PVs succ = BlockDev.lvm_vgreduce("testVG", None, None) @@ -974,9 +973,6 @@ def test_lvcreate_type(self): info = BlockDev.lvm_lvinfo("testVG", "testLV") self.assertEqual(info.segtype, "raid1") - # it should be fully synched - self.assertEqual(info.sync_percent, 100) - succ = BlockDev.lvm_lvremove("testVG", "testLV", True, None) self.assertTrue(succ)