[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [LVM2 PATCH] Broken "--corelog" option in lvcreate/lvconvert



Hi,

In 2.02.28, "--corelog" option is just broken.

# lvcreate -m1 -l1 --corelog testvg
  --mirrorlog disk and --corelog are incompatible

# lvcreate -l1 -n lv0 testvg; lvconvert -m1 --corelog testvg/lv0
  Logical volume "lv0" created
  --mirrorlog disk and --corelog are incompatible

I guess this is not an intended behavior.

Attached patch will fix it.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
Fix "--mirrorlog disk and --corelog are incompatible" error
on "lvcreate/lvconvert -m<n> --corelog".

Expected results:

# lvcreate -l1 -m1 testvg
  Logical volume "lvol0" created
# lvcreate -l1 -m1 --corelog testvg
  Logical volume "lvol1" created
# lvcreate -l1 -m1 --mirrorlog disk testvg
  Logical volume "lvol2" created
# lvcreate -l1 -m1 --mirrorlog core testvg
  Logical volume "lvol3" created
# lvcreate -l1 -m1 --mirrorlog core --corelog testvg
  Logical volume "lvol4" created
# lvcreate -l1 -m1 --mirrorlog disk --corelog testvg
  --mirrorlog disk and --corelog are incompatible
# lvs
  LV    VG     Attr   LSize Origin Snap%  Move Log        Copy% 
  lvol0 testvg mwi-a- 4.00M                    lvol0_mlog 100.00
  lvol1 testvg mwi-a- 4.00M                               100.00
  lvol2 testvg mwi-a- 4.00M                    lvol2_mlog 100.00
  lvol3 testvg mwi-a- 4.00M                               100.00
  lvol4 testvg mwi-a- 4.00M                               100.00

# lvcreate -l1 testvg; lvconvert -m1 testvg/lvol5
  Logical volume "lvol5" created
  Logical volume lvol5 converted.
# lvcreate -l1 testvg; lvconvert -m1 --corelog testvg/lvol6
  Logical volume "lvol6" created
  Logical volume lvol6 converted.
# lvcreate -l1 testvg; lvconvert -m1 --mirrorlog disk testvg/lvol7
  Logical volume "lvol7" created
  Logical volume lvol7 converted.
# lvcreate -l1 testvg; lvconvert -m1 --mirrorlog core testvg/lvol8
  Logical volume "lvol8" created
  Logical volume lvol8 converted.
# lvcreate -l1 testvg; lvconvert -m1 --mirrorlog core --corelog testvg/lvol9
  Logical volume "lvol9" created
  Logical volume lvol9 converted.
# lvcreate -l1 testvg; lvconvert -m1 --mirrorlog disk --corelog testvg/lvol10
  Logical volume "lvol10" created
  --mirrorlog disk and --corelog are incompatible
# lvs
  LV     VG     Attr   LSize Origin Snap%  Move Log        Copy% 
  lvol5  testvg mwi-a- 4.00M                    lvol5_mlog 100.00
  lvol6  testvg mwi-a- 4.00M                               100.00
  lvol7  testvg mwi-a- 4.00M                    lvol7_mlog 100.00
  lvol8  testvg mwi-a- 4.00M                               100.00
  lvol9  testvg mwi-a- 4.00M                               100.00
  lvol10 testvg -wi-a- 4.00M                                     

Index: LVM2.work/tools/lvcreate.c
===================================================================
--- LVM2.work.orig/tools/lvcreate.c
+++ LVM2.work/tools/lvcreate.c
@@ -288,7 +288,9 @@ static int _read_mirror_params(struct lv
 	if (arg_count(cmd, corelog_ARG))
 		lp->corelog = 1;
 
-	mirrorlog = arg_str_value(cmd, mirrorlog_ARG, DEFAULT_MIRRORLOG);
+	mirrorlog = arg_str_value(cmd, mirrorlog_ARG,
+				  lp->corelog ? "core" : DEFAULT_MIRRORLOG);
+
 	if (!strcmp("disk", mirrorlog)) {
 		if (lp->corelog) {
 			log_error("--mirrorlog disk and --corelog "
Index: LVM2.work/tools/lvconvert.c
===================================================================
--- LVM2.work.orig/tools/lvconvert.c
+++ LVM2.work/tools/lvconvert.c
@@ -275,7 +275,8 @@ static int lvconvert_mirrors(struct cmd_
 	if (arg_count(cmd, corelog_ARG))
 		corelog = 1;
 
-	mirrorlog = arg_str_value(cmd, mirrorlog_ARG, DEFAULT_MIRRORLOG);
+	mirrorlog = arg_str_value(cmd, mirrorlog_ARG,
+				  corelog ? "core" : DEFAULT_MIRRORLOG);
 	if (!strcmp("disk", mirrorlog)) {
 		if (corelog) {
 			log_error("--mirrorlog disk and --corelog "

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]