]> sourceware.org Git - lvm2.git/commitdiff
lvconvert: Limit --corelog and --mirrorlog to mirrors.
authorAlasdair G Kergon <agk@redhat.com>
Mon, 8 Aug 2016 13:25:46 +0000 (14:25 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Mon, 8 Aug 2016 13:39:55 +0000 (14:39 +0100)
It's an error to specify a log when the final result is not of type
mirror.

WHATS_NEW
tools/lvconvert.c

index 4ba8a0c35e30c245fbc130db0e4dd9f0cbeff277..f438fc8308c90a62afe7941da2ac8fc8061ed9d7 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.163 - 
 =================================
+  Limit use of --corelog and --mirrorlog to mirrors in lvconvert.
   Do not refresh whole cmd context if profile dropped after processing LVM cmd.
   Support straightforward lvconvert between striped and raid4 LVs.
   Support straightforward lvconvert between raid1 and mirror LVs.
index 5677e9ccabbce33f2506b7382db385262bb7b1f3..e7c34f7c6524a7d73ae4e65d9567a8e117f39da4 100644 (file)
@@ -1700,6 +1700,11 @@ static int _lvconvert_mirrors(struct cmd_context *cmd,
        uint32_t new_mimage_count;
        uint32_t new_log_count;
 
+       if (*lp->type_str && strcmp(lp->type_str, SEG_TYPE_NAME_MIRROR)) {
+               log_error("--corelog and --mirrorlog is only compatible with --type mirror");
+               return 0;
+       }
+
        if (lp->merge_mirror) {
                log_error("Unable to merge mirror images"
                          "of segment type 'mirror'.");
@@ -1888,6 +1893,11 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
                }
        }
 
+       if ((lp->corelog || lp->mirrorlog) && strcmp(lp->type_str, SEG_TYPE_NAME_MIRROR)) {
+               log_error("--corelog and --mirrorlog is only compatible with --type mirror");
+               return 0;
+       }
+
        if (lp->merge_mirror)
                return lv_raid_merge(lv);
 
@@ -1898,7 +1908,8 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
                return lv_raid_split(lv, lp->lv_split_name, image_count, lp->pvh);
 
        if (lp->mirrors_supplied) {
-               if (!*lp->type_str || !strcmp(lp->type_str, SEG_TYPE_NAME_RAID1) || !strcmp(lp->type_str, SEG_TYPE_NAME_LINEAR)) {
+               if (!*lp->type_str || !strcmp(lp->type_str, SEG_TYPE_NAME_RAID1) || !strcmp(lp->type_str, SEG_TYPE_NAME_LINEAR) ||
+                   (!strcmp(lp->type_str, SEG_TYPE_NAME_STRIPED) && image_count == 1)) {
                        if (!lv_raid_change_image_count(lv, image_count, lp->pvh))
                                return_0;
 
This page took 0.052786 seconds and 5 git commands to generate.