From 250ce9cd44d13b24f1235cc9e7106c33fb3148c7747f4987be28b3beeb7b8057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Mon, 19 May 2014 12:02:02 +0000 Subject: [PATCH] Accepting request 233542 from home:wanglh:branches:Base:System add 0001-RAID-Make-RAID-4-5-6-display-sync-status-under-headi.patch OBS-URL: https://build.opensuse.org/request/show/233542 OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=91 --- ...-5-6-display-sync-status-under-headi.patch | 119 ++++++++++++++++++ lvm2.changes | 5 + lvm2.spec | 5 + 3 files changed, 129 insertions(+) create mode 100644 0001-RAID-Make-RAID-4-5-6-display-sync-status-under-headi.patch diff --git a/0001-RAID-Make-RAID-4-5-6-display-sync-status-under-headi.patch b/0001-RAID-Make-RAID-4-5-6-display-sync-status-under-headi.patch new file mode 100644 index 0000000..96d6c20 --- /dev/null +++ b/0001-RAID-Make-RAID-4-5-6-display-sync-status-under-headi.patch @@ -0,0 +1,119 @@ +From e1917809477c4850cc1094121001d61a2b70ef26 Mon Sep 17 00:00:00 2001 +From: Jonathan Brassow +Date: Tue, 23 Oct 2012 21:19:27 -0500 +Subject: [PATCH 1/1] RAID: Make RAID 4/5/6 display sync status under heading + s/Copy%/Cpy%Sync + +The heading 'Copy%' is specific to PVMOVE volumes, but can be generalized +to apply to LVM mirrors also. It is a bit awkward to use 'Copy%' for +RAID 4/5/6, however - 'Sync%' would be more appropriate. This is why +RAID 4/5/6 have not displayed their sync status by any means available to +'lvs' yet. + +Example (old): +[root@hayes-02 lvm2]# lvs vg + LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sy Convert + lv vg -wi-a---- 1.00g + raid1 vg rwi-a-r-- 1.00g 100.00 + raid4 vg rwi-a-r-- 1.01g + raid5 vg rwi-a-r-- 1.01g + raid6 vg rwi-a-r-- 1.01g + +This patch changes the heading to 'Cpy%Sync' and allows RAID 4/5/6 to print +their sync percent in this field. + +Example (new): +[root@hayes-02 lvm2]# lvs vg + LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert + lv vg -wi-a---- 1.00g + raid1 vg rwi-a-r-- 1.00g 100.00 + raid4 vg rwi-a-r-- 1.01g 100.00 + raid5 vg rwi-a-r-- 1.01g 100.00 + raid6 vg rwi-a-r-- 1.01g 100.00 +--- + lib/report/columns.h | 3 ++- + lib/report/properties.c | 2 ++ + lib/report/report.c | 20 +++++++++++++------- + man/lvs.8.in | 1 + + 4 files changed, 18 insertions(+), 8 deletions(-) + +diff --git a/lib/report/columns.h b/lib/report/columns.h +index 6299a2b..c83a086 100644 +--- a/lib/report/columns.h ++++ b/lib/report/columns.h +@@ -78,7 +78,8 @@ FIELD(LVS, lv, NUM, "OSize", lvid, 5, originsize, origin_size, "For snapshots, t + FIELD(LVS, lv, NUM, "Data%", lvid, 6, datapercent, data_percent, "For snapshot and thin pools and volumes, the percentage full if LV is active.", 0) + FIELD(LVS, lv, NUM, "Snap%", lvid, 6, snpercent, snap_percent, "For snapshots, the percentage full if LV is active.", 0) + FIELD(LVS, lv, NUM, "Meta%", lvid, 6, metadatapercent, metadata_percent, "For thin pools, the percentage of metadata full if LV is active.", 0) +-FIELD(LVS, lv, NUM, "Copy%", lvid, 6, copypercent, copy_percent, "For mirrors and pvmove, current percentage in-sync.", 0) ++FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, copy_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0) ++FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, sync_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0) + FIELD(LVS, lv, STR, "Move", lvid, 4, movepv, move_pv, "For pvmove, Source PV of temporary LV created by pvmove.", 0) + FIELD(LVS, lv, STR, "Convert", lvid, 7, convertlv, convert_lv, "For lvconvert, Name of temporary LV created by lvconvert.", 0) + FIELD(LVS, lv, STR, "Log", lvid, 3, loglv, mirror_log, "For mirrors, the LV holding the synchronisation log.", 0) +diff --git a/lib/report/properties.c b/lib/report/properties.c +index c4f6ab9..fe197f5 100644 +--- a/lib/report/properties.c ++++ b/lib/report/properties.c +@@ -189,6 +189,8 @@ GET_LV_NUM_PROPERTY_FN(snap_percent, _snap_percent(lv)) + #define _snap_percent_set _not_implemented_set + GET_LV_NUM_PROPERTY_FN(copy_percent, _copy_percent(lv)) + #define _copy_percent_set _not_implemented_set ++GET_LV_NUM_PROPERTY_FN(sync_percent, _copy_percent(lv)) ++#define _sync_percent_set _not_implemented_set + GET_LV_STR_PROPERTY_FN(move_pv, lv_move_pv_dup(lv->vg->vgmem, lv)) + #define _move_pv_set _not_implemented_set + GET_LV_STR_PROPERTY_FN(convert_lv, lv_convert_lv_dup(lv->vg->vgmem, lv)) +diff --git a/lib/report/report.c b/lib/report/report.c +index b1e2bc1..1833458 100644 +--- a/lib/report/report.c ++++ b/lib/report/report.c +@@ -898,13 +898,14 @@ static int _copypercent_disp(struct dm_report *rh __attribute__((unused)), + return 0; + } + +- if ((!(lv->status & PVMOVE) && !(lv->status & MIRRORED)) || +- !lv_mirror_percent(lv->vg->cmd, lv, 0, &percent, +- NULL) || (percent == PERCENT_INVALID)) { +- *sortval = UINT64_C(0); +- dm_report_field_set_value(field, "", sortval); +- return 1; +- } ++ if (lv->status & RAID) { ++ if (!lv_raid_percent(lv, &percent) || ++ (percent == PERCENT_INVALID)) ++ goto no_copypercent; ++ } else if ((!(lv->status & PVMOVE) && !(lv->status & MIRRORED)) || ++ !lv_mirror_percent(lv->vg->cmd, lv, 0, &percent, NULL) || ++ (percent == PERCENT_INVALID)) ++ goto no_copypercent; + + percent = copy_percent(lv); + +@@ -922,6 +923,11 @@ static int _copypercent_disp(struct dm_report *rh __attribute__((unused)), + dm_report_field_set_value(field, repstr, sortval); + + return 1; ++ ++no_copypercent: ++ *sortval = UINT64_C(0); ++ dm_report_field_set_value(field, "", sortval); ++ return 1; + } + + static int _dtpercent_disp(int metadata, struct dm_report *rh, +diff --git a/man/lvs.8.in b/man/lvs.8.in +index f31256c..d4d77b0 100644 +--- a/man/lvs.8.in ++++ b/man/lvs.8.in +@@ -113,6 +113,7 @@ seg_tags, + snap_percent, + stripes, + stripe_size, ++sync_percent, + thin_count, + transaction_id, + zero. +-- +1.9.0 + diff --git a/lvm2.changes b/lvm2.changes index cf77a26..593175d 100644 --- a/lvm2.changes +++ b/lvm2.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon May 12 08:11:08 UTC 2014 - lwang@suse.com + +-bnc#871176, 0001-RAID-Make-RAID-4-5-6-display-sync-status-under-headi.patch + ------------------------------------------------------------------- Wed Apr 16 09:11:32 UTC 2014 - trenn@suse.de diff --git a/lvm2.spec b/lvm2.spec index bdf284a..a6a00ca 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -100,6 +100,10 @@ Patch89: 0001-clvmd-avoid-logging-in-signal-handler.patch # Never upstream Patch90: cmirrord_remove_date_time_from_compilation.patch + +#upstream, bnc#871176 +Patch91: 0001-RAID-Make-RAID-4-5-6-display-sync-status-under-headi.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-build # Not a real replacement but we drop evms Provides: evms = 2.5.5 @@ -154,6 +158,7 @@ Volume Manager. %patch88 -p1 %patch89 -p1 %patch90 -p1 +%patch91 -p1 %build #set path so that thin_check can be found