public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2011-10-07 14:56 jbrassow
0 siblings, 0 replies; 31+ messages in thread
From: jbrassow @ 2011-10-07 14:56 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: jbrassow@sourceware.org 2011-10-07 14:56:01
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h raid_manip.c
test : t-lvconvert-raid.sh
tools : lvconvert.c
Log message:
Add the ability to convert LVs of "mirror" segtype to "raid1" segtype.
Example:
~> lvconvert --type raid1 vg/mirror_lv
Steps to convert "mirror" to "raid1"
1) Allocate a RAID metadata LV for each mirror image from the same PVs
on which they are located.
2) Clear the metadata LVs. This involves writing LVM metadata, so we don't
change any aspects of the mirror LV before this so that the user can easily
remove LVs from the failed convert attempt while retaining the original
mirror.
3) Remove the mirror log, if it exists.
4) Add metadata LVs to mirror LV
5) Rename mirror sub-lvs (s/mimage/rimage/)
6) Change flags and segtype from mirror to raid1
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2151&r2=1.2152
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.213&r2=1.214
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/raid_manip.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-lvconvert-raid.sh.diff?cvsroot=lvm2&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.173&r2=1.174
--- LVM2/WHATS_NEW 2011/10/07 14:52:26 1.2151
+++ LVM2/WHATS_NEW 2011/10/07 14:56:01 1.2152
@@ -1,5 +1,6 @@
Version 2.02.89 -
==================================
+ Add ability to convert mirror segtype to RAID1 segtype.
Add ability to convert from linear to RAID1.
Add ability to extend mirrors with '--nosync' option.
Fix splitmirror in cluster having different DM/LVM views of storage.
--- LVM2/lib/metadata/metadata-exported.h 2011/09/29 08:56:39 1.213
+++ LVM2/lib/metadata/metadata-exported.h 2011/10/07 14:56:01 1.214
@@ -770,6 +770,8 @@
int lv_raid_split_and_track(struct logical_volume *lv,
struct dm_list *splittable_pvs);
int lv_raid_merge(struct logical_volume *lv);
+int lv_raid_reshape(struct logical_volume *lv,
+ const struct segment_type *new_segtype);
/* -- metadata/raid_manip.c */
--- LVM2/lib/metadata/raid_manip.c 2011/10/07 14:52:27 1.16
+++ LVM2/lib/metadata/raid_manip.c 2011/10/07 14:56:01 1.17
@@ -166,6 +166,16 @@
return 1;
}
+/*
+ * _raid_in_sync
+ * @lv
+ *
+ * _raid_in_sync works for all types of RAID segtypes, as well
+ * as 'mirror' segtype. (This is because 'lv_raid_percent' is
+ * simply a wrapper around 'lv_mirror_percent'.
+ *
+ * Returns: 1 if in-sync, 0 otherwise.
+ */
static int _raid_in_sync(struct logical_volume *lv)
{
percent_t sync_percent;
@@ -399,20 +409,22 @@
* This function does not make metadata changes.
*/
static int _alloc_image_component(struct logical_volume *lv,
+ const char *alt_base_name,
struct alloc_handle *ah, uint32_t first_area,
uint64_t type, struct logical_volume **new_lv)
{
uint64_t status;
size_t len = strlen(lv->name) + 32;
char img_name[len];
+ const char *base_name = (alt_base_name) ? alt_base_name : lv->name;
struct logical_volume *tmp_lv;
const struct segment_type *segtype;
if (type == RAID_META) {
- if (dm_snprintf(img_name, len, "%s_rmeta_%%d", lv->name) < 0)
+ if (dm_snprintf(img_name, len, "%s_rmeta_%%d", base_name) < 0)
return_0;
} else if (type == RAID_IMAGE) {
- if (dm_snprintf(img_name, len, "%s_rimage_%%d", lv->name) < 0)
+ if (dm_snprintf(img_name, len, "%s_rimage_%%d", base_name) < 0)
return_0;
} else {
log_error(INTERNAL_ERROR
@@ -490,13 +502,14 @@
* allocated areas. Thus, the metadata areas are pulled
* from 's + count'.
*/
- if (!_alloc_image_component(lv, ah, s + count,
+ if (!_alloc_image_component(lv, NULL, ah, s + count,
RAID_META, &tmp_lv))
return_0;
lvl_array[s + count].lv = tmp_lv;
dm_list_add(new_meta_lvs, &(lvl_array[s + count].list));
- if (!_alloc_image_component(lv, ah, s, RAID_IMAGE, &tmp_lv))
+ if (!_alloc_image_component(lv, NULL, ah, s,
+ RAID_IMAGE, &tmp_lv))
return_0;
lvl_array[s].lv = tmp_lv;
dm_list_add(new_data_lvs, &(lvl_array[s].list));
@@ -519,6 +532,7 @@
struct dm_list allocatable_pvs;
struct alloc_handle *ah;
struct lv_segment *seg = first_seg(data_lv);
+ char *p, base_name[strlen(data_lv->name) + 1];
dm_list_init(&allocatable_pvs);
@@ -528,10 +542,9 @@
return 0;
}
- if (strstr("_mimage_", data_lv->name)) {
- log_error("Unable to alloc metadata device for mirror device");
- return 0;
- }
+ sprintf(base_name, "%s", data_lv->name);
+ if ((p = strstr(base_name, "_mimage_")))
+ *p = '\0';
if (!_get_pv_list_for_lv(data_lv, &allocatable_pvs)) {
log_error("Failed to build list of PVs for %s/%s",
@@ -545,7 +558,8 @@
&allocatable_pvs, data_lv->alloc, NULL)))
return_0;
- if (!_alloc_image_component(data_lv, ah, 0, RAID_META, meta_lv))
+ if (!_alloc_image_component(data_lv, base_name, ah, 0,
+ RAID_META, meta_lv))
return_0;
alloc_destroy(ah);
@@ -1264,3 +1278,153 @@
vg->name, lv->name);
return 1;
}
+
+static int _convert_mirror_to_raid1(struct logical_volume *lv,
+ const struct segment_type *new_segtype)
+{
+ uint32_t s;
+ struct lv_segment *seg = first_seg(lv);
+ struct lv_list lvl_array[seg->area_count], *lvl;
+ struct dm_list meta_lvs;
+ struct lv_segment_area *meta_areas;
+
+ dm_list_init(&meta_lvs);
+
+ if (!_raid_in_sync(lv)) {
+ log_error("Unable to convert %s/%s while it is not in-sync",
+ lv->vg->name, lv->name);
+ return 0;
+ }
+
+ meta_areas = dm_pool_zalloc(lv->vg->vgmem,
+ lv_mirror_count(lv) * sizeof(*meta_areas));
+ if (!meta_areas) {
+ log_error("Failed to allocate memory");
+ return 0;
+ }
+
+ for (s = 0; s < seg->area_count; s++) {
+ log_debug("Allocating new metadata LV for %s",
+ seg_lv(seg, s)->name);
+ if (!_alloc_rmeta_for_lv(seg_lv(seg, s), &(lvl_array[s].lv))) {
+ log_error("Failed to allocate metadata LV for %s in %s",
+ seg_lv(seg, s)->name, lv->name);
+ return 0;
+ }
+ dm_list_add(&meta_lvs, &(lvl_array[s].list));
+ }
+
+ log_debug("Clearing newly allocated metadata LVs");
+ if (!_clear_lvs(&meta_lvs)) {
+ log_error("Failed to initialize metadata LVs");
+ return 0;
+ }
+
+ if (seg->log_lv) {
+ log_debug("Removing mirror log, %s", seg->log_lv->name);
+ if (!remove_mirror_log(lv->vg->cmd, lv, NULL, 0)) {
+ log_error("Failed to remove mirror log");
+ return 0;
+ }
+ }
+
+ seg->meta_areas = meta_areas;
+ s = 0;
+
+ dm_list_iterate_items(lvl, &meta_lvs) {
+ log_debug("Adding %s to %s", lvl->lv->name, lv->name);
+
+ /* Images are known to be in-sync */
+ lvl->lv->status &= ~LV_NOTSYNCED;
+ first_seg(lvl->lv)->status &= ~LV_NOTSYNCED;
+ lv_set_hidden(lvl->lv);
+
+ if (!set_lv_segment_area_lv(seg, s, lvl->lv, 0,
+ lvl->lv->status)) {
+ log_error("Failed to add %s to %s",
+ lvl->lv->name, lv->name);
+ return 0;
+ }
+ s++;
+ }
+
+ for (s = 0; s < seg->area_count; s++) {
+ char *new_name;
+
+ new_name = dm_pool_zalloc(lv->vg->vgmem,
+ strlen(lv->name) +
+ strlen("_rimage_XXn"));
+ if (!new_name) {
+ log_error("Failed to rename mirror images");
+ return 0;
+ }
+
+ sprintf(new_name, "%s_rimage_%u", lv->name, s);
+ log_debug("Renaming %s to %s", seg_lv(seg, s)->name, new_name);
+ seg_lv(seg, s)->name = new_name;
+ seg_lv(seg, s)->status &= ~MIRROR_IMAGE;
+ seg_lv(seg, s)->status |= RAID_IMAGE;
+ }
+ init_mirror_in_sync(1);
+
+ log_debug("Setting new segtype for %s", lv->name);
+ seg->segtype = new_segtype;
+ lv->status &= ~MIRRORED;
+ lv->status |= RAID;
+ seg->status |= RAID;
+
+ if (!vg_write(lv->vg)) {
+ log_error("Failed to write changes to %s in %s",
+ lv->name, lv->vg->name);
+ return 0;
+ }
+
+ if (!suspend_lv(lv->vg->cmd, lv)) {
+ log_error("Failed to suspend %s/%s before committing changes",
+ lv->vg->name, lv->name);
+ return 0;
+ }
+
+ if (!vg_commit(lv->vg)) {
+ log_error("Failed to commit changes to %s in %s",
+ lv->name, lv->vg->name);
+ return 0;
+ }
+
+ if (!resume_lv(lv->vg->cmd, lv)) {
+ log_error("Failed to resume %s/%s after committing changes",
+ lv->vg->name, lv->name);
+ return 0;
+ }
+
+ return 1;
+}
+
+/*
+ * lv_raid_reshape
+ * @lv
+ * @new_segtype
+ *
+ * Convert an LV from one RAID type (or 'mirror' segtype) to another.
+ *
+ * Returns: 1 on success, 0 on failure
+ */
+int lv_raid_reshape(struct logical_volume *lv,
+ const struct segment_type *new_segtype)
+{
+ struct lv_segment *seg = first_seg(lv);
+
+ if (!new_segtype) {
+ log_error(INTERNAL_ERROR "New segtype not specified");
+ return 0;
+ }
+
+ if (!strcmp(seg->segtype->name, "mirror") &&
+ (!strcmp(new_segtype->name, "raid1")))
+ return _convert_mirror_to_raid1(lv, new_segtype);
+
+ log_error("Converting the segment type for %s/%s from %s to %s"
+ " is not yet supported.", lv->vg->name, lv->name,
+ seg->segtype->name, new_segtype->name);
+ return 0;
+}
--- LVM2/test/t-lvconvert-raid.sh 2011/10/07 14:52:27 1.2
+++ LVM2/test/t-lvconvert-raid.sh 2011/10/07 14:56:01 1.3
@@ -12,8 +12,8 @@
. lib/test
-# is_raid_in_sync <VG/LV>
-function is_raid_in_sync()
+# is_in_sync <VG/LV>
+function is_in_sync()
{
local dm_name
local a
@@ -26,7 +26,19 @@
echo "Unable to get sync status of $1"
exit 1
fi
- idx=$((${#a[@]} - 1))
+
+ # 6th argument is the sync ratio for RAID and mirror
+ echo ${a[@]}
+ if [ ${a[2]} = "raid" ]; then
+ # Last argument is the sync ratio for RAID
+ idx=$((${#a[@]} - 1))
+ elif [ ${a[2]} = "mirror" ]; then
+ # 4th Arg tells us how far to the sync ratio
+ idx=$((${a[3]} + 4))
+ else
+ echo "Unable to get sync ratio for target type '${a[2]}'"
+ exit 1
+ fi
b=(`echo ${a[$idx]} | sed s:/:' ':`)
if [ ${b[0]} != ${b[1]} ]; then
@@ -39,16 +51,21 @@
exit 1
fi
- echo "$dm_name (${a[3]}) is in-sync"
+ if [ ${a[2]} = "raid" ]; then
+ echo "$dm_name (${a[3]}) is in-sync"
+ else
+ echo "$dm_name (${a[2]}) is in-sync"
+ fi
+
return 0
}
-# wait_for_raid_sync <VG/LV>
-function wait_for_raid_sync()
+# wait_for_sync <VG/LV>
+function wait_for_sync()
{
local i=0
- while ! is_raid_in_sync $1; do
+ while ! is_in_sync $1; do
sleep 2
i=$(($i + 1))
if [ $i -gt 500 ]; then
@@ -106,7 +123,7 @@
lvcreate -l 2 -n $lv1 $vg
else
lvcreate --type raid1 -m $(($i - 1)) -l 2 -n $lv1 $vg
- wait_for_raid_sync $vg/$lv1
+ wait_for_sync $vg/$lv1
fi
lvconvert -m $((j - 1)) $vg/$lv1
@@ -128,7 +145,7 @@
###########################################
# 3-way to 2-way/linear
lvcreate --type raid1 -m 2 -l 2 -n $lv1 $vg
-wait_for_raid_sync $vg/$lv1
+wait_for_sync $vg/$lv1
lvconvert --splitmirrors 1 -n $lv2 $vg/$lv1
check lv_exists $vg $lv1
check linear $vg $lv2
@@ -137,7 +154,7 @@
# 2-way to linear/linear
lvcreate --type raid1 -m 1 -l 2 -n $lv1 $vg
-wait_for_raid_sync $vg/$lv1
+wait_for_sync $vg/$lv1
lvconvert --splitmirrors 1 -n $lv2 $vg/$lv1
check linear $vg $lv1
check linear $vg $lv2
@@ -146,8 +163,8 @@
# 3-way to linear/2-way
lvcreate --type raid1 -m 2 -l 2 -n $lv1 $vg
-wait_for_raid_sync $vg/$lv1
-# FIXME: Can't split off a mirror from a mirror yet
+wait_for_sync $vg/$lv1
+# FIXME: Can't split off a RAID1 from a RAID1 yet
should lvconvert --splitmirrors 2 -n $lv2 $vg/$lv1
#check linear $vg $lv1
#check lv_exists $vg $lv2
@@ -159,10 +176,22 @@
###########################################
# 3-way to 2-way/linear
lvcreate --type raid1 -m 2 -l 2 -n $lv1 $vg
-wait_for_raid_sync $vg/$lv1
+wait_for_sync $vg/$lv1
lvconvert --splitmirrors 1 --trackchanges $vg/$lv1
check lv_exists $vg $lv1
check linear $vg ${lv1}_rimage_2
lvconvert --merge $vg/${lv1}_rimage_2
# FIXME: ensure no residual devices
lvremove -ff $vg
+
+###########################################
+# Mirror to RAID1 conversion
+###########################################
+for i in 1 2 3 ; do
+ lvcreate --type mirror -m $i -l 2 -n $lv1 $vg
+ wait_for_sync $vg/$lv1
+ lvconvert --type raid1 $vg/$lv1
+ lvremove -ff $vg
+done
+
+exit 0
--- LVM2/tools/lvconvert.c 2011/10/07 14:52:27 1.173
+++ LVM2/tools/lvconvert.c 2011/10/07 14:56:01 1.174
@@ -1452,6 +1452,9 @@
if (arg_count(cmd, mirrors_ARG))
return lv_raid_change_image_count(lv, image_count, lp->pvh);
+ if (arg_count(cmd, type_ARG))
+ return lv_raid_reshape(lv, lp->segtype);
+
log_error("Conversion operation not yet supported.");
return 0;
}
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2011-12-01 0:09 jbrassow
0 siblings, 0 replies; 31+ messages in thread
From: jbrassow @ 2011-12-01 0:09 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: jbrassow@sourceware.org 2011-12-01 00:09:35
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h raid_manip.c
tools : lvrename.c
Log message:
Do not allow users to change the name of RAID sub-LVs or the name of the
RAID LV if it is tracking changes for a split image.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2200&r2=1.2201
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.224&r2=1.225
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/raid_manip.c.diff?cvsroot=lvm2&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvrename.c.diff?cvsroot=lvm2&r1=1.58&r2=1.59
--- LVM2/WHATS_NEW 2011/12/01 00:05:40 1.2200
+++ LVM2/WHATS_NEW 2011/12/01 00:09:34 1.2201
@@ -1,5 +1,7 @@
Version 2.02.89 -
==================================
+ Don't allow name change of RAID LV while tracking a split image.
+ Do not allow users to change the name of RAID sub-LVs
Do not allow users to change permissions on RAID sub-LVs
Support the ability to replace specific devices in a RAID array via lvconvert.
Add activation/use_linear_target enabled by default.
--- LVM2/lib/metadata/metadata-exported.h 2011/11/30 02:20:13 1.224
+++ LVM2/lib/metadata/metadata-exported.h 2011/12/01 00:09:35 1.225
@@ -780,6 +780,7 @@
/* -- metadata/replicator_manip.c */
/* ++ metadata/raid_manip.c */
+int lv_is_raid_with_tracking(const struct logical_volume *lv);
uint32_t lv_raid_image_count(const struct logical_volume *lv);
int lv_raid_change_image_count(struct logical_volume *lv,
uint32_t new_count, struct dm_list *pvs);
--- LVM2/lib/metadata/raid_manip.c 2011/11/30 02:02:11 1.18
+++ LVM2/lib/metadata/raid_manip.c 2011/12/01 00:09:35 1.19
@@ -26,6 +26,22 @@
#define RAID_REGION_SIZE 1024
+int lv_is_raid_with_tracking(const struct logical_volume *lv)
+{
+ uint32_t s;
+ struct lv_segment *seg;
+
+ if (lv->status & RAID) {
+ seg = first_seg(lv);
+
+ for (s = 0; s < seg->area_count; s++)
+ if (lv_is_visible(seg_lv(seg, s)) &&
+ !(seg_lv(seg, s)->status & LVM_WRITE))
+ return 1;
+ }
+ return 0;
+}
+
uint32_t lv_raid_image_count(const struct logical_volume *lv)
{
struct lv_segment *seg = first_seg(lv);
--- LVM2/tools/lvrename.c 2011/08/10 20:25:31 1.58
+++ LVM2/tools/lvrename.c 2011/12/01 00:09:35 1.59
@@ -115,6 +115,21 @@
goto error;
}
+ if (lvl->lv->status & (RAID_IMAGE | RAID_META)) {
+ log_error("Cannot rename a RAID %s directly",
+ (lvl->lv->status & RAID_IMAGE) ? "image" :
+ "metadata area");
+ r = ECMD_FAILED;
+ goto error;
+ }
+
+ if (lv_is_raid_with_tracking(lvl->lv)) {
+ log_error("Cannot rename %s while it is tracking a split image",
+ lvl->lv->name);
+ r = ECMD_FAILED;
+ goto error;
+ }
+
if (!lv_rename(cmd, lvl->lv, lv_name_new))
goto error;
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2011-10-28 20:12 zkabelac
0 siblings, 0 replies; 31+ messages in thread
From: zkabelac @ 2011-10-28 20:12 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-10-28 20:12:55
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c
Log message:
Add last_seg
Implement a function to return the last segment in a LV.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2173&r2=1.2174
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.216&r2=1.217
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.470&r2=1.471
--- LVM2/WHATS_NEW 2011/10/28 20:06:49 1.2173
+++ LVM2/WHATS_NEW 2011/10/28 20:12:54 1.2174
@@ -1,5 +1,6 @@
Version 2.02.89 -
==================================
+ Add last_seg(lv) internal function.
Support empty string for log/prefix.
Fix regression that allowed mirrored logs for cluster mirrors.
Don't print char type[8] as a plain string in pvck PV type.
--- LVM2/lib/metadata/metadata-exported.h 2011/10/21 11:38:35 1.216
+++ LVM2/lib/metadata/metadata-exported.h 2011/10/28 20:12:55 1.217
@@ -660,6 +660,7 @@
const char *pvid);
/* Find LV segment containing given LE */
struct lv_segment *first_seg(const struct logical_volume *lv);
+struct lv_segment *last_seg(const struct logical_volume *lv);
/*
--- LVM2/lib/metadata/metadata.c 2011/10/24 10:24:40 1.470
+++ LVM2/lib/metadata/metadata.c 2011/10/28 20:12:55 1.471
@@ -1906,6 +1906,16 @@
return NULL;
}
+struct lv_segment *last_seg(const struct logical_volume *lv)
+{
+ struct lv_segment *seg;
+
+ dm_list_iterate_back_items(seg, &lv->segments)
+ return seg;
+
+ return NULL;
+}
+
int vg_remove_mdas(struct volume_group *vg)
{
struct metadata_area *mda;
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2011-09-14 9:57 zkabelac
0 siblings, 0 replies; 31+ messages in thread
From: zkabelac @ 2011-09-14 9:57 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-09-14 09:57:36
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h raid_manip.c
Log message:
LVM_WRITE and LVM_READ are 64bit constants
Revert John patch, which fixed only 1 place where ~LVM_WRITE was in use and
convert ommited LVM_READ/WRITE flags to 64bit constants as well.
(Since both 'status' flags for LV and VG are 64bit.)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2107&r2=1.2108
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.210&r2=1.211
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/raid_manip.c.diff?cvsroot=lvm2&r1=1.13&r2=1.14
--- LVM2/WHATS_NEW 2011/09/14 02:45:36 1.2107
+++ LVM2/WHATS_NEW 2011/09/14 09:57:35 1.2108
@@ -3,7 +3,6 @@
Fix lv_mirror_count to handle mirrored stripes properly.
Fix failure to down-convert a mirror to linear due to udev "dev open" conflict
Fix mirrored log creation when PE size is small - force log_size >= region_size
- Fix improper RAID 64-bit status flag reset when and'ing against 32-bit flag.
Fix log size calculation when only a log is being added to a mirror.
Work around resume_lv causing error LV scanning during splitmirror operation.
Add 7th lv_attr char to show the related kernel target.
--- LVM2/lib/metadata/metadata-exported.h 2011/09/08 20:55:39 1.210
+++ LVM2/lib/metadata/metadata-exported.h 2011/09/14 09:57:35 1.211
@@ -88,8 +88,8 @@
#define THIN_POOL_DATA UINT64_C(0x0000004000000000) /* LV */
#define THIN_POOL_METADATA UINT64_C(0x0000008000000000) /* LV */
-#define LVM_READ 0x00000100U /* LV VG 32-bit */
-#define LVM_WRITE 0x00000200U /* LV VG 32-bit */
+#define LVM_READ UINT64_C(0x00000100) /* LV, VG */
+#define LVM_WRITE UINT64_C(0x00000200) /* LV, VG */
#define CLUSTERED UINT64_C(0x00000400) /* VG */
//#define SHARED UINT64_C(0x00000800) /* VG */
--- LVM2/lib/metadata/raid_manip.c 2011/09/13 16:33:21 1.13
+++ LVM2/lib/metadata/raid_manip.c 2011/09/14 09:57:35 1.14
@@ -971,11 +971,7 @@
if (!_lv_is_on_pvs(seg_lv(seg, s), splittable_pvs))
continue;
lv_set_visible(seg_lv(seg, s));
- /*
- * LVM_WRITE is 32-bit, if we don't '|' it with
- * UINT64_C(0) it will remove all higher order flags
- */
- seg_lv(seg, s)->status &= ~(UINT64_C(0) | LVM_WRITE);
+ seg_lv(seg, s)->status &= ~LVM_WRITE;
break;
}
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2011-09-07 8:34 zkabelac
0 siblings, 0 replies; 31+ messages in thread
From: zkabelac @ 2011-09-07 8:34 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-09-07 08:34:22
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c
Log message:
Minor change for pv_create api
Switch int to unsigned type.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2095&r2=1.2096
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.207&r2=1.208
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.466&r2=1.467
--- LVM2/WHATS_NEW 2011/09/07 08:31:16 1.2095
+++ LVM2/WHATS_NEW 2011/09/07 08:34:21 1.2096
@@ -1,5 +1,6 @@
Version 2.02.89 -
==================================
+ Switch int to unsigned type for pvmetadatacopies for pv_create().
Replace :space: with [\t ] for awk in vgimportclone (not widely supported).
Begin using 64-bit status field flags.
Detect sscanf recovering_region input error in cmirrord pull_state().
--- LVM2/lib/metadata/metadata-exported.h 2011/09/06 22:43:57 1.207
+++ LVM2/lib/metadata/metadata-exported.h 2011/09/07 08:34:22 1.208
@@ -455,7 +455,7 @@
uint32_t existing_extent_count,
uint32_t existing_extent_size,
uint64_t label_sector,
- int pvmetadatacopies,
+ unsigned pvmetadatacopies,
uint64_t pvmetadatasize,
unsigned metadataignore);
int pv_resize(struct physical_volume *pv, struct volume_group *vg,
--- LVM2/lib/metadata/metadata.c 2011/08/30 14:55:17 1.466
+++ LVM2/lib/metadata/metadata.c 2011/09/07 08:34:22 1.467
@@ -1621,7 +1621,7 @@
uint32_t existing_extent_count,
uint32_t existing_extent_size,
uint64_t label_sector,
- int pvmetadatacopies,
+ unsigned pvmetadatacopies,
uint64_t pvmetadatasize,
unsigned metadataignore)
{
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2011-08-18 19:43 jbrassow
0 siblings, 0 replies; 31+ messages in thread
From: jbrassow @ 2011-08-18 19:43 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: jbrassow@sourceware.org 2011-08-18 19:43:09
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h raid_manip.c
libdm/ioctl : libdm-iface.c
man : lvconvert.8.in
tools : lvconvert.c
Log message:
Add ability to merge back a RAID1 image that has been split w/ --trackchanges
Argument layout is very similar to the merge command for snapshots.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2078&r2=1.2079
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.200&r2=1.201
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/raid_manip.c.diff?cvsroot=lvm2&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.116&r2=1.117
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvconvert.8.in.diff?cvsroot=lvm2&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.170&r2=1.171
--- LVM2/WHATS_NEW 2011/08/18 19:41:21 1.2078
+++ LVM2/WHATS_NEW 2011/08/18 19:43:08 1.2079
@@ -1,5 +1,6 @@
Version 2.02.88 -
==================================
+ Add --merge support for RAID1 images that were split with --trackchanges
Add support for m-way to n-way up-convert in RAID1 (no linear to n-way yet)
Add --trackchanges support to --splitmirrors option for RAID1
Add --splitmirrors support for RAID1 (1 image only)
--- LVM2/lib/metadata/metadata-exported.h 2011/08/18 19:38:27 1.200
+++ LVM2/lib/metadata/metadata-exported.h 2011/08/18 19:43:08 1.201
@@ -746,6 +746,7 @@
uint32_t new_count, struct dm_list *splittable_pvs);
int lv_raid_split_and_track(struct logical_volume *lv,
struct dm_list *splittable_pvs);
+int lv_raid_merge(struct logical_volume *lv);
/* -- metadata/raid_manip.c */
--- LVM2/lib/metadata/raid_manip.c 2011/08/18 19:41:21 1.8
+++ LVM2/lib/metadata/raid_manip.c 2011/08/18 19:43:08 1.9
@@ -1016,3 +1016,89 @@
lv->vg->name, seg_lv(seg, s)->name, lv->name);
return 1;
}
+
+int lv_raid_merge(struct logical_volume *image_lv)
+{
+ uint32_t s;
+ char *p, *lv_name;
+ struct lv_list *lvl;
+ struct logical_volume *lv;
+ struct logical_volume *meta_lv = NULL;
+ struct lv_segment *seg;
+ struct volume_group *vg = image_lv->vg;
+
+ lv_name = dm_pool_strdup(vg->vgmem, image_lv->name);
+ if (!lv_name)
+ return_0;
+
+ if (!(p = strstr(lv_name, "_rimage_"))) {
+ log_error("Unable to merge non-mirror image %s/%s",
+ vg->name, image_lv->name);
+ return 0;
+ }
+ *p = '\0'; /* lv_name is now that of top-level RAID */
+
+ if (image_lv->status & LVM_WRITE) {
+ log_error("%s/%s is not read-only - refusing to merge",
+ vg->name, image_lv->name);
+ return 0;
+ }
+
+ if (!(lvl = find_lv_in_vg(vg, lv_name))) {
+ log_error("Unable to find containing RAID array for %s/%s",
+ vg->name, image_lv->name);
+ return 0;
+ }
+ lv = lvl->lv;
+ seg = first_seg(lv);
+ for (s = 0; s < seg->area_count; s++) {
+ if (seg_lv(seg, s) == image_lv) {
+ meta_lv = seg_metalv(seg, s);
+ }
+ }
+ if (!meta_lv)
+ return_0;
+
+ if (!deactivate_lv(vg->cmd, meta_lv)) {
+ log_error("Failed to deactivate %s", meta_lv->name);
+ return 0;
+ }
+
+ if (!deactivate_lv(vg->cmd, image_lv)) {
+ log_error("Failed to deactivate %s/%s before merging",
+ vg->name, image_lv->name);
+ return 0;
+ }
+ lv_set_hidden(image_lv);
+ image_lv->status |= (lv->status & LVM_WRITE);
+ image_lv->status |= RAID_IMAGE;
+
+ if (!vg_write(vg)) {
+ log_error("Failed to write changes to %s in %s",
+ lv->name, vg->name);
+ return 0;
+ }
+
+ if (!suspend_lv(vg->cmd, lv)) {
+ log_error("Failed to suspend %s/%s before committing changes",
+ vg->name, lv->name);
+ return 0;
+ }
+
+ if (!vg_commit(vg)) {
+ log_error("Failed to commit changes to %s in %s",
+ lv->name, vg->name);
+ return 0;
+ }
+
+ if (!resume_lv(vg->cmd, lv)) {
+ log_error("Failed to resume %s/%s after committing changes",
+ vg->name, lv->name);
+ return 0;
+ }
+
+ log_print("%s/%s successfully merged back into %s/%s",
+ vg->name, image_lv->name,
+ vg->name, lv->name);
+ return 1;
+}
--- LVM2/libdm/ioctl/libdm-iface.c 2011/08/11 20:49:33 1.116
+++ LVM2/libdm/ioctl/libdm-iface.c 2011/08/18 19:43:09 1.117
@@ -1639,9 +1639,10 @@
_cmd_data_v4[dmt->type].name,
strerror(errno));
else
- log_error("device-mapper: %s ioctl "
+ log_error("device-mapper: %s ioctl for %s "
"failed: %s",
- _cmd_data_v4[dmt->type].name,
+ _cmd_data_v4[dmt->type].name,
+ dmi->name ? dmi->name : dmi->uuid,
strerror(errno));
_dm_zfree_dmi(dmi);
return NULL;
--- LVM2/man/lvconvert.8.in 2011/08/18 19:38:27 1.20
+++ LVM2/man/lvconvert.8.in 2011/08/18 19:43:09 1.21
@@ -40,7 +40,7 @@
[\-h|\-?|\-\-help]
[\-v|\-\-verbose]
[\-\-version]
-SnapshotLogicalVolume[Path]...
+LogicalVolume[Path]...
.br
.br
@@ -146,8 +146,11 @@
If the volume is read-only the snapshot will not be zeroed.
.TP
.I \-\-merge
-Merges a snapshot into its origin volume. To check if your kernel
-supports this feature, look for 'snapshot-merge' in the output
+Merges a snapshot into its origin volume or merges a RAID1 image that has
+been split from its mirror with \-\-trackchanges back into its mirror.
+
+To check if your kernel supports the snapshot merge feature, look
+for 'snapshot-merge' in the output
of 'dmsetup targets'. If both the origin and snapshot volume are not
open the merge will start immediately. Otherwise, the merge will start
the first time either the origin or snapshot are activated and both are closed.
@@ -206,7 +209,7 @@
extents /dev/sda:0-15 and /dev/sdb:0-15 for allocation of new extents.
.br
-"lvconvert -m0 vg00/lvmirror1 /dev/sda
+"lvconvert -m0 vg00/lvmirror1 /dev/sda"
.br
converts mirror logical volume "vg00/lvmirror1" to linear, freeing physical
extents from /dev/sda.
@@ -224,6 +227,32 @@
then vg00/lvol2, then vg00/lvol3. If --background were used it would start
all snapshot logical volume merges in parallel.
+.br
+"lvconvert --splitmirrors 1 --name lv_split vg00/lvmirror1"
+.br
+Extract one image from the mirror, making it a new logical volume named
+"lv_split". The mirror the image is extracted from is reduced accordingly.
+If it was a 2-way mirror (created with '-m 1'), then the resulting original
+volume will be linear.
+
+.br
+"lvconvert --splitmirrors 1 --trackchanges vg00/lv_raid1"
+.br
+A mirrored logical volume that uses the "raid1" segment type (i.e. created
+with '--type raid1') can use the '\-\-trackchanges' argument when splitting
+off an image. The split-off image cannot be given a new name, as it is still
+part of the original RAID1 logical volume in the sense that changes between
+the two are being tracked for future integration upon merging. The device that
+results from the split will be read-only and will be named similarly to the
+original - in this case "lv_raid1_rimage_N", where 'N' is the index of the
+image that has been split.
+
+.br
+"lvconvert --merge vg00/lv_raid1_rimage_1"
+.br
+Merge an image back into the mirror it was split from when the '\-\-trackchanges'
+argument was used.
+
.SH SEE ALSO
.BR lvm (8),
.BR vgcreate (8),
--- LVM2/tools/lvconvert.c 2011/08/18 19:38:27 1.170
+++ LVM2/tools/lvconvert.c 2011/08/18 19:43:09 1.171
@@ -20,6 +20,7 @@
struct lvconvert_params {
int snapshot;
int merge;
+ int merge_mirror;
int zero;
const char *origin;
@@ -107,7 +108,7 @@
if ((ptr = strrchr(lp->lv_name_full, '/')))
lp->lv_name = ptr + 1;
- if (!apply_lvname_restrictions(lp->lv_name))
+ if (!lp->merge_mirror && !apply_lvname_restrictions(lp->lv_name))
return_0;
if (*pargc && lp->snapshot) {
@@ -178,8 +179,12 @@
return 0;
}
- if (arg_count(cmd, merge_ARG))
- lp->merge = 1;
+ if (arg_count(cmd, merge_ARG)) {
+ if ((argc == 1) && strstr(argv[0], "_rimage_"))
+ lp->merge_mirror = 1;
+ else
+ lp->merge = 1;
+ }
if (arg_count(cmd, mirrors_ARG)) {
/*
@@ -1339,6 +1344,12 @@
uint32_t new_mimage_count;
uint32_t new_log_count;
+ if (lp->merge_mirror) {
+ log_error("Unable to merge mirror images"
+ "of segment type 'mirror'");
+ return 0;
+ }
+
/* Adjust mimage and/or log count */
if (!_lvconvert_mirrors_parse_params(cmd, lv, lp,
&old_mimage_count, &old_log_count,
@@ -1423,17 +1434,21 @@
"split" : "reduce");
return 0;
}
-
- if (arg_count(cmd, trackchanges_ARG))
- return lv_raid_split_and_track(lv, lp->pvh);
- else if (arg_count(cmd, splitmirrors_ARG))
- return lv_raid_split(lv, lp->lv_split_name,
- image_count, lp->pvh);
- else
- return lv_raid_change_image_count(lv, image_count,
- lp->pvh);
}
+ if (lp->merge_mirror)
+ return lv_raid_merge(lv);
+
+ if (arg_count(cmd, trackchanges_ARG))
+ return lv_raid_split_and_track(lv, lp->pvh);
+
+ if (arg_count(cmd, splitmirrors_ARG))
+ return lv_raid_split(lv, lp->lv_split_name,
+ image_count, lp->pvh);
+
+ if (arg_count(cmd, mirrors_ARG))
+ return lv_raid_change_image_count(lv, image_count, lp->pvh);
+
log_error("Conversion operation not yet supported.");
return 0;
}
@@ -1652,7 +1667,8 @@
stack;
return ECMD_FAILED;
}
- } else if (segtype_is_raid(lp->segtype) || (lv->status & RAID)) {
+ } else if (segtype_is_raid(lp->segtype) ||
+ (lv->status & RAID) || lp->merge_mirror) {
if (!archive(lv->vg)) {
stack;
return ECMD_FAILED;
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2011-08-18 19:34 jbrassow
0 siblings, 0 replies; 31+ messages in thread
From: jbrassow @ 2011-08-18 19:34 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: jbrassow@sourceware.org 2011-08-18 19:34:19
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h raid_manip.c
tools : lvconvert.c
Log message:
Add --splitmirrors support for RAID1 (1 image only)
Users already have the ability to split an image from an LV of "mirror"
segtype. This patch extends that ability to LVs of "raid1" segtype.
This patch only allows a single image to be split off, however. (The
"mirror" segtype allows an arbitrary number of images to be split off.
e.g. 4-way => 3-way/linear, 2-way/2-way, linear,3-way)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2075&r2=1.2076
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.198&r2=1.199
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/raid_manip.c.diff?cvsroot=lvm2&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.168&r2=1.169
--- LVM2/WHATS_NEW 2011/08/18 19:31:33 1.2075
+++ LVM2/WHATS_NEW 2011/08/18 19:34:18 1.2076
@@ -1,5 +1,6 @@
Version 2.02.88 -
==================================
+ Add --splitmirrors support for RAID1 (1 image only)
When down-converting RAID1, don't activate sub-lvs between suspend/resume
Add -V as short form of --virtualsize in lvcreate.
Fix make clean not to remove Makefile. (2.02.87)
--- LVM2/lib/metadata/metadata-exported.h 2011/08/11 18:24:41 1.198
+++ LVM2/lib/metadata/metadata-exported.h 2011/08/18 19:34:18 1.199
@@ -742,6 +742,9 @@
uint32_t lv_raid_image_count(const struct logical_volume *lv);
int lv_raid_change_image_count(struct logical_volume *lv,
uint32_t new_count, struct dm_list *pvs);
+int lv_raid_split(struct logical_volume *lv, const char *split_name,
+ uint32_t new_count, struct dm_list *splittable_pvs);
+
/* -- metadata/raid_manip.c */
struct cmd_vg *cmd_vg_add(struct dm_pool *mem, struct dm_list *cmd_vgs,
--- LVM2/lib/metadata/raid_manip.c 2011/08/18 19:31:33 1.5
+++ LVM2/lib/metadata/raid_manip.c 2011/08/18 19:34:18 1.6
@@ -515,3 +515,111 @@
return 1;
}
+
+int lv_raid_split(struct logical_volume *lv, const char *split_name,
+ uint32_t new_count, struct dm_list *splittable_pvs)
+{
+ const char *old_name;
+ struct lv_list *lvl;
+ struct dm_list removal_list, data_list;
+ struct cmd_context *cmd = lv->vg->cmd;
+ uint32_t old_count = lv_raid_image_count(lv);
+
+ dm_list_init(&removal_list);
+ dm_list_init(&data_list);
+
+ if ((old_count - new_count) != 1) {
+ log_error("Unable to split more than one image from %s/%s",
+ lv->vg->name, lv->name);
+ return 0;
+ }
+
+ if (!seg_is_mirrored(first_seg(lv))) {
+ log_error("Unable to split logical volume of segment type, %s",
+ first_seg(lv)->segtype->name);
+ return 0;
+ }
+
+ if (find_lv_in_vg(lv->vg, split_name)) {
+ log_error("Logical Volume \"%s\" already exists in %s",
+ split_name, lv->vg->name);
+ return 0;
+ }
+
+ if (!raid_in_sync(lv)) {
+ log_error("Unable to split %s/%s while it is not in-sync.",
+ lv->vg->name, lv->name);
+ return 0;
+ }
+
+ if (!raid_extract_images(lv, new_count, splittable_pvs, 1,
+ &removal_list, &data_list)) {
+ log_error("Failed to extract images from %s/%s",
+ lv->vg->name, lv->name);
+ return 0;
+ }
+
+ /* Convert to linear? */
+ if ((new_count == 1) && !raid_remove_top_layer(lv, &removal_list)) {
+ log_error("Failed to remove RAID layer after linear conversion");
+ return 0;
+ }
+
+ /* Get first item */
+ dm_list_iterate_items(lvl, &data_list)
+ break;
+
+ old_name = lvl->lv->name;
+ lvl->lv->name = split_name;
+
+ if (!vg_write(lv->vg)) {
+ log_error("Failed to write changes to %s in %s",
+ lv->name, lv->vg->name);
+ return 0;
+ }
+
+ if (!suspend_lv(cmd, lv)) {
+ log_error("Failed to suspend %s/%s before committing changes",
+ lv->vg->name, lv->name);
+ return 0;
+ }
+
+ if (!vg_commit(lv->vg)) {
+ log_error("Failed to commit changes to %s in %s",
+ lv->name, lv->vg->name);
+ return 0;
+ }
+
+ /*
+ * Resume original LV
+ * This also resumes all other sub-lvs (including the extracted)
+ */
+ if (!resume_lv(cmd, lv)) {
+ log_error("Failed to resume %s/%s after committing changes",
+ lv->vg->name, lv->name);
+ return 0;
+ }
+
+ /* Recycle newly split LV so it is properly renamed */
+ if (!suspend_lv(cmd, lvl->lv) || !resume_lv(cmd, lvl->lv)) {
+ log_error("Failed to rename %s to %s after committing changes",
+ old_name, split_name);
+ return 0;
+ }
+
+ /*
+ * Eliminate the residual LVs
+ */
+ dm_list_iterate_items(lvl, &removal_list) {
+ if (!deactivate_lv(cmd, lvl->lv))
+ return_0;
+
+ if (!lv_remove(lvl->lv))
+ return_0;
+ }
+
+ if (!vg_write(lv->vg) || !vg_commit(lv->vg))
+ return_0;
+
+ return 1;
+}
--- LVM2/tools/lvconvert.c 2011/08/11 18:24:42 1.168
+++ LVM2/tools/lvconvert.c 2011/08/18 19:34:18 1.169
@@ -1401,7 +1401,7 @@
}
/* Change number of RAID1 images */
- if (arg_count(cmd, mirrors_ARG)) {
+ if (arg_count(cmd, mirrors_ARG) || arg_count(cmd, splitmirrors_ARG)) {
image_count = lv_raid_image_count(lv);
if (lp->mirrors_sign == SIGN_PLUS)
image_count += lp->mirrors;
@@ -1411,11 +1411,18 @@
image_count = lp->mirrors + 1;
if (image_count < 1) {
- log_error("Unable to reduce images by specified amount");
+ log_error("Unable to %s images by specified amount",
+ arg_count(cmd, splitmirrors_ARG) ?
+ "split" : "reduce");
return 0;
}
- return lv_raid_change_image_count(lv, image_count, lp->pvh);
+ if (arg_count(cmd, splitmirrors_ARG))
+ return lv_raid_split(lv, lp->lv_split_name,
+ image_count, lp->pvh);
+ else
+ return lv_raid_change_image_count(lv, image_count,
+ lp->pvh);
}
log_error("Conversion operation not yet supported.");
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2011-03-11 14:56 prajnoha
0 siblings, 0 replies; 31+ messages in thread
From: prajnoha @ 2011-03-11 14:56 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2011-03-11 14:56:56
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c mirror.c
tools : lvconvert.c pvcreate.c pvmove.c pvremove.c
pvresize.c pvscan.c toollib.c vgconvert.c
vgreduce.c
Log message:
Add new free_pv_fid fn and use it throughout to free all attached fids.
Since format instances will use own memory pool, it's necessary to properly
deallocate it. For now, only fid is deallocated. The PV structure itself
still uses cmd mempool mostly, but anytime we'd like to add a mempool
in the struct physical_volume, we can just rename this fn to free_pv and
add the code (like we have free_vg fn for VGs).
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1948&r2=1.1949
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.186&r2=1.187
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.444&r2=1.445
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.143&r2=1.144
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.157&r2=1.158
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvcreate.c.diff?cvsroot=lvm2&r1=1.93&r2=1.94
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.81&r2=1.82
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvremove.c.diff?cvsroot=lvm2&r1=1.33&r2=1.34
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvresize.c.diff?cvsroot=lvm2&r1=1.43&r2=1.44
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvscan.c.diff?cvsroot=lvm2&r1=1.52&r2=1.53
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.224&r2=1.225
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgconvert.c.diff?cvsroot=lvm2&r1=1.50&r2=1.51
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.108&r2=1.109
--- LVM2/WHATS_NEW 2011/03/11 14:50:13 1.1948
+++ LVM2/WHATS_NEW 2011/03/11 14:56:56 1.1949
@@ -1,5 +1,6 @@
Version 2.02.85 -
===================================
+ Add new free_pv_fid fn and use it throughout to free all attached fids.
Use only vg_set_fid and new pv_set_fid fn to assign the format instance.
Make create_text_context fn static and move it inside create_instance fn.
Add mem and ref_count fields to struct format_instance for own mempool use.
--- LVM2/lib/metadata/metadata-exported.h 2011/03/11 14:38:39 1.186
+++ LVM2/lib/metadata/metadata-exported.h 2011/03/11 14:56:56 1.187
@@ -460,6 +460,14 @@
int remove_lvs_in_vg(struct cmd_context *cmd,
struct volume_group *vg,
force_t force);
+
+/*
+ * free_pv_fid() must be called on every struct physical_volume allocated
+ * by pv_create, pv_read, find_pv_by_name or pv_by_path to free it when
+ * no longer required.
+ */
+void free_pv_fid(struct physical_volume *pv);
+
/*
* free_vg() must be called on every struct volume_group allocated
* by vg_create() or vg_read_internal() to free it when no longer required.
--- LVM2/lib/metadata/metadata.c 2011/03/11 14:50:15 1.444
+++ LVM2/lib/metadata/metadata.c 2011/03/11 14:56:56 1.445
@@ -644,8 +644,10 @@
if (!pv)
return 0;
}
- if (!add_pv_to_vg(vg, pv_name, pv))
+ if (!add_pv_to_vg(vg, pv_name, pv)) {
+ free_pv_fid(pv);
return 0;
+ }
return 1;
}
@@ -1319,6 +1321,7 @@
* system.
*/
if (pv && is_orphan(pv) && !dm_list_size(&pv->fid->metadata_areas_in_use)) {
+ free_pv_fid(pv);
if (!scan_vgs_for_pvs(cmd, 0))
return_0;
pv = pv_read(cmd, name, NULL, 0, 0);
@@ -1329,18 +1332,18 @@
if (pv && !is_orphan(pv) && pp->force != DONT_PROMPT_OVERRIDE) {
log_error("Can't initialize physical volume \"%s\" of "
"volume group \"%s\" without -ff", name, pv_vg_name(pv));
- return 0;
+ goto bad;
}
/* prompt */
if (pv && !is_orphan(pv) && !pp->yes &&
yes_no_prompt(_really_init, name, pv_vg_name(pv)) == 'n') {
log_error("%s: physical volume not initialized", name);
- return 0;
+ goto bad;
}
if (sigint_caught())
- return 0;
+ goto_bad;
dev = dev_cache_get(name, cmd->filter);
@@ -1355,7 +1358,7 @@
if (!dev) {
log_error("Device %s not found (or ignored by filtering).", name);
- return 0;
+ goto bad;
}
/*
@@ -1365,20 +1368,20 @@
/* FIXME Detect whether device-mapper itself is still using it */
log_error("Can't open %s exclusively. Mounted filesystem?",
name);
- return 0;
+ goto bad;
}
if (!_wipe_sb(dev, "software RAID md superblock", name, 4, pp, dev_is_md))
- return 0;
+ goto_bad;
if (!_wipe_sb(dev, "swap signature", name, 10, pp, dev_is_swap))
- return 0;
+ goto_bad;
if (!_wipe_sb(dev, "LUKS signature", name, 8, pp, dev_is_luks))
- return 0;
+ goto_bad;
if (sigint_caught())
- return 0;
+ goto_bad;
if (pv && !is_orphan(pv) && pp->force) {
log_warn("WARNING: Forcing physical volume creation on "
@@ -1388,7 +1391,12 @@
!is_orphan(pv) ? "\"" : "");
}
+ free_pv_fid(pv);
return 1;
+
+bad:
+ free_pv_fid(pv);
+ return 0;
}
void pvcreate_params_set_defaults(struct pvcreate_params *pp)
@@ -1426,7 +1434,7 @@
const char *pv_name,
struct pvcreate_params *pp)
{
- struct physical_volume *pv;
+ struct physical_volume *pv = NULL;
struct device *dev;
struct dm_list mdas;
struct pvcreate_params default_pp;
@@ -1441,23 +1449,23 @@
(dev != dev_cache_get(pv_name, cmd->filter))) {
if (!id_write_format((const struct id*)&pp->idp->uuid,
buffer, sizeof(buffer)))
- return_NULL;
+ goto_bad;
log_error("uuid %s already in use on \"%s\"", buffer,
dev_name(dev));
- return NULL;
+ goto bad;;
}
}
if (!pvcreate_check(cmd, pv_name, pp))
- goto error;
+ goto_bad;
if (sigint_caught())
- goto error;
+ goto_bad;
if (!(dev = dev_cache_get(pv_name, cmd->filter))) {
log_error("%s: Couldn't find device. Check your filters?",
pv_name);
- goto error;
+ goto bad;
}
dm_list_init(&mdas);
@@ -1468,7 +1476,7 @@
pp->labelsector, pp->pvmetadatacopies,
pp->pvmetadatasize, pp->metadataignore))) {
log_error("Failed to setup physical volume \"%s\"", pv_name);
- goto error;
+ goto bad;
}
log_verbose("Set up physical volume for \"%s\" with %" PRIu64
@@ -1477,20 +1485,20 @@
/* Wipe existing label first */
if (!label_remove(pv_dev(pv))) {
log_error("Failed to wipe existing label on %s", pv_name);
- goto error;
+ goto bad;
}
if (pp->zero) {
log_verbose("Zeroing start of device %s", pv_name);
if (!dev_open_quiet(dev)) {
log_error("%s not opened: device not zeroed", pv_name);
- goto error;
+ goto bad;
}
if (!dev_set(dev, UINT64_C(0), (size_t) 2048, 0)) {
log_error("%s not wiped: aborting", pv_name);
dev_close(dev);
- goto error;
+ goto bad;
}
dev_close(dev);
}
@@ -1500,22 +1508,18 @@
if (!(pv_write(cmd, pv, 0))) {
log_error("Failed to write physical volume \"%s\"", pv_name);
- goto error;
+ goto bad;
}
log_print("Physical volume \"%s\" successfully created", pv_name);
return pv;
- error:
+bad:
+ free_pv_fid(pv);
return NULL;
}
-static void _free_pv(struct dm_pool *mem, struct physical_volume *pv)
-{
- dm_pool_free(mem, pv);
-}
-
static struct physical_volume *_alloc_pv(struct dm_pool *mem, struct device *dev)
{
struct physical_volume *pv = dm_pool_zalloc(mem, sizeof(*pv));
@@ -1654,7 +1658,8 @@
return pv;
bad:
- _free_pv(mem, pv);
+ free_pv_fid(pv);
+ dm_pool_free(mem, pv);
return NULL;
}
@@ -1806,25 +1811,30 @@
if (!(pv = _pv_read(cmd, cmd->mem, pv_name, NULL, NULL, 1, 0))) {
log_error("Physical volume %s not found", pv_name);
- return NULL;
+ goto bad;
}
if (is_orphan_vg(pv->vg_name) && !dm_list_size(&pv->fid->metadata_areas_in_use)) {
/* If a PV has no MDAs - need to search all VGs for it */
if (!scan_vgs_for_pvs(cmd, 1))
- return_NULL;
+ goto_bad;
+ free_pv_fid(pv);
if (!(pv = _pv_read(cmd, cmd->mem, pv_name, NULL, NULL, 1, 0))) {
log_error("Physical volume %s not found", pv_name);
- return NULL;
+ goto bad;
}
}
if (is_orphan_vg(pv->vg_name)) {
log_error("Physical volume %s not in a volume group", pv_name);
- return NULL;
+ goto bad;
}
return pv;
+
+bad:
+ free_pv_fid(pv);
+ return NULL;
}
/* Find segment at a given logical extent in an LV */
@@ -2638,7 +2648,7 @@
struct lvmcache_info *info;
struct pv_list *pvl;
struct volume_group *vg;
- struct physical_volume *pv;
+ struct physical_volume *pv = NULL;
lvmcache_label_scan(cmd, 0);
@@ -2673,6 +2683,7 @@
return vg;
bad:
+ free_pv_fid(pv);
free_vg(vg);
return NULL;
}
@@ -2703,6 +2714,14 @@
return 1;
}
+static void _free_pv_list(struct dm_list *all_pvs)
+{
+ struct pv_list *pvl;
+
+ dm_list_iterate_items(pvl, all_pvs)
+ pvl->pv->fid->fmt->ops->destroy_instance(pvl->pv->fid);
+}
+
int vg_missing_pv_count(const struct volume_group *vg)
{
int ret = 0;
@@ -3011,6 +3030,7 @@
if (!correct_vg) {
correct_vg = vg;
if (!_update_pv_list(cmd->mem, &all_pvs, correct_vg)) {
+ _free_pv_list(&all_pvs);
free_vg(vg);
return_NULL;
}
@@ -3035,6 +3055,7 @@
inconsistent_seqno = 1;
}
if (!_update_pv_list(cmd->mem, &all_pvs, vg)) {
+ _free_pv_list(&all_pvs);
free_vg(vg);
free_vg(correct_vg);
return_NULL;
@@ -3050,8 +3071,10 @@
}
/* Give up looking */
- if (!correct_vg)
+ if (!correct_vg) {
+ _free_pv_list(&all_pvs);
return_NULL;
+ }
}
/*
@@ -3074,20 +3097,25 @@
*/
if (!inconsistent_seqno) {
*consistent = 0;
+ _free_pv_list(&all_pvs);
return correct_vg;
}
+ _free_pv_list(&all_pvs);
free_vg(correct_vg);
return NULL;
}
- if (!*consistent)
+ if (!*consistent) {
+ _free_pv_list(&all_pvs);
return correct_vg;
+ }
/* Don't touch if vgids didn't match */
if (inconsistent_vgid) {
log_error("Inconsistent metadata UUIDs found for "
"volume group %s", vgname);
*consistent = 0;
+ _free_pv_list(&all_pvs);
return correct_vg;
}
@@ -3104,6 +3132,7 @@
cmd->handles_missing_pvs = 1;
if (!vg_write(correct_vg)) {
log_error("Automatic metadata correction failed");
+ _free_pv_list(&all_pvs);
free_vg(correct_vg);
cmd->handles_missing_pvs = saved_handles_missing_pvs;
return NULL;
@@ -3123,12 +3152,14 @@
goto next_pv;
}
if (!id_write_format(&pvl->pv->id, uuid, sizeof(uuid))) {
+ _free_pv_list(&all_pvs);
free_vg(correct_vg);
return_NULL;
}
log_error("Removing PV %s (%s) that no longer belongs to VG %s",
pv_dev_name(pvl->pv), uuid, correct_vg->name);
if (!pv_write_orphan(cmd, pvl->pv)) {
+ _free_pv_list(&all_pvs);
free_vg(correct_vg);
return_NULL;
}
@@ -3140,6 +3171,8 @@
}
}
+ _free_pv_list(&all_pvs);
+
if (vg_missing_pv_count(correct_vg)) {
log_verbose("There are %d physical volumes missing.",
vg_missing_pv_count(correct_vg));
@@ -3199,6 +3232,15 @@
return vg;
}
+void free_pv_fid(struct physical_volume *pv)
+{
+ if (!pv)
+ return;
+
+ if (pv->fid)
+ pv->fid->fmt->ops->destroy_instance(pv->fid);
+}
+
void free_vg(struct volume_group *vg)
{
if (!vg)
@@ -3445,7 +3487,8 @@
return pv;
bad:
- _free_pv(pvmem, pv);
+ free_pv_fid(pv);
+ dm_pool_free(pvmem, pv);
return NULL;
}
--- LVM2/lib/metadata/mirror.c 2011/02/18 14:47:30 1.143
+++ LVM2/lib/metadata/mirror.c 2011/03/11 14:56:56 1.144
@@ -1463,11 +1463,15 @@
uint32_t lv_type)
{
struct physical_volume *pv;
+ struct logical_volume *lv;
if (!(pv = find_pv_by_name(cmd, name)))
return_NULL;
- return find_pvmove_lv(vg, pv->dev, lv_type);
+ lv = find_pvmove_lv(vg, pv->dev, lv_type);
+ free_pv_fid(pv);
+
+ return lv;
}
struct dm_list *lvs_using_lv(struct cmd_context *cmd, struct volume_group *vg,
--- LVM2/tools/lvconvert.c 2011/02/03 01:24:47 1.157
+++ LVM2/tools/lvconvert.c 2011/03/11 14:56:56 1.158
@@ -791,6 +791,7 @@
vg->free_count -= pvl_vg->pv->pe_count;
vg->extent_count -= pvl_vg->pv->pe_count;
del_pvl_from_vgs(vg, pvl_vg);
+ free_pv_fid(pvl_vg->pv);
removed++;
}
--- LVM2/tools/pvcreate.c 2010/12/08 20:50:51 1.93
+++ LVM2/tools/pvcreate.c 2011/03/11 14:56:56 1.94
@@ -93,6 +93,7 @@
int i;
int ret = ECMD_PROCESSED;
struct pvcreate_params pp;
+ struct physical_volume *pv;
pvcreate_params_set_defaults(&pp);
@@ -111,11 +112,12 @@
unescape_colons_and_at_signs(argv[i], NULL, NULL);
- if (!pvcreate_single(cmd, argv[i], &pp)) {
+ if (!(pv = pvcreate_single(cmd, argv[i], &pp))) {
stack;
ret = ECMD_FAILED;
}
+ free_pv_fid(pv);
unlock_vg(cmd, VG_ORPHANS);
if (sigint_caught())
return ret;
--- LVM2/tools/pvmove.c 2010/12/08 20:50:51 1.81
+++ LVM2/tools/pvmove.c 2011/03/11 14:56:56 1.82
@@ -431,11 +431,13 @@
if (!(lv_name = _extract_lvname(cmd, pv_vg_name(pv),
arg_value(cmd, name_ARG)))) {
stack;
+ free_pv_fid(pv);
return EINVALID_CMD_LINE;
}
if (!validate_name(lv_name)) {
log_error("Logical volume name %s is invalid", lv_name);
+ free_pv_fid(pv);
return EINVALID_CMD_LINE;
}
}
@@ -510,6 +512,7 @@
/* LVs are all in status LOCKED */
r = ECMD_PROCESSED;
out:
+ free_pv_fid(pv);
unlock_and_free_vg(cmd, vg, pv_vg_name(pv));
return r;
}
@@ -600,6 +603,7 @@
const char *uuid __attribute__((unused)))
{
struct physical_volume *pv;
+ struct volume_group *vg;
/* Reread all metadata in case it got changed */
if (!(pv = find_pv_by_name(cmd, name))) {
@@ -608,7 +612,10 @@
return NULL;
}
- return _get_vg(cmd, pv_vg_name(pv));
+ vg = _get_vg(cmd, pv_vg_name(pv));
+ free_pv_fid(pv);
+
+ return vg;
}
static struct poll_functions _pvmove_fns = {
--- LVM2/tools/pvremove.c 2011/02/28 19:35:10 1.33
+++ LVM2/tools/pvremove.c 2011/03/11 14:56:56 1.34
@@ -49,31 +49,34 @@
if (!scan_vgs_for_pvs(cmd, 0)) {
log_error("Rescan for PVs without metadata areas "
"failed.");
- return 0;
+ goto bad;
}
+ free_pv_fid(pv);
if (!(pv = pv_read(cmd, name, NULL, 1, 0))) {
log_error("Failed to read physical volume %s", name);
- return 0;
+ goto bad;
}
}
/* orphan ? */
- if (is_orphan(pv))
+ if (is_orphan(pv)) {
+ free_pv_fid(pv);
return 1;
+ }
/* Allow partial & exported VGs to be destroyed. */
/* we must have -ff to overwrite a non orphan */
if (arg_count(cmd, force_ARG) < 2) {
log_error("PV %s belongs to Volume Group %s so please use vgreduce first.", name, pv_vg_name(pv));
log_error("(If you are certain you need pvremove, then confirm by using --force twice.)");
- return 0;
+ goto bad;
}
/* prompt */
if (!arg_count(cmd, yes_ARG) &&
yes_no_prompt(_really_wipe, name, pv_vg_name(pv)) == 'n') {
log_error("%s: physical volume label not removed", name);
- return 0;
+ goto bad;
}
if (arg_count(cmd, force_ARG)) {
@@ -84,7 +87,12 @@
!is_orphan(pv) ? "\"" : "");
}
+ free_pv_fid(pv);
return 1;
+
+bad:
+ free_pv_fid(pv);
+ return 0;
}
static int pvremove_single(struct cmd_context *cmd, const char *pv_name,
--- LVM2/tools/pvresize.c 2011/02/28 17:08:09 1.43
+++ LVM2/tools/pvresize.c 2011/03/11 14:56:56 1.44
@@ -126,6 +126,8 @@
log_error("Use pvcreate and vgcfgrestore "
"to repair from archived metadata.");
unlock_vg(cmd, vg_name);
+ if (is_orphan_vg(vg_name))
+ free_pv_fid(pv);
if (!old_vg)
free_vg(vg);
return r;
--- LVM2/tools/pvscan.c 2010/07/09 15:34:48 1.52
+++ LVM2/tools/pvscan.c 2011/03/11 14:56:56 1.53
@@ -183,8 +183,10 @@
pv_max_name_len += 2;
vg_max_name_len += 2;
- dm_list_iterate_items(pvl, pvslist)
+ dm_list_iterate_items(pvl, pvslist) {
_pvscan_display_single(cmd, pvl->pv, NULL);
+ free_pv_fid(pvl->pv);
+ }
if (!pvs_found) {
log_print("No matching physical volumes found");
--- LVM2/tools/toollib.c 2011/03/02 20:00:09 1.224
+++ LVM2/tools/toollib.c 2011/03/11 14:56:56 1.225
@@ -658,6 +658,9 @@
pv = &pv_dummy;
}
ret = process_single_pv(cmd, NULL, pv, handle);
+
+ free_pv_fid(pv);
+
if (ret > ret_max)
ret_max = ret;
if (sigint_caught())
@@ -757,6 +760,7 @@
continue;
}
scanned = 1;
+ free_pv_fid(pv);
if (!(pv = pv_read(cmd, argv[opt],
NULL, 1,
scan_label_only))) {
@@ -770,6 +774,14 @@
}
ret = process_single_pv(cmd, vg, pv, handle);
+
+ /*
+ * Free PV only if we called pv_read before,
+ * otherwise the PV structure is part of the VG.
+ */
+ if (!vg)
+ free_pv_fid(pv);
+
if (ret > ret_max)
ret_max = ret;
if (sigint_caught())
@@ -823,6 +835,7 @@
dm_list_iterate_items(pvl, pvslist) {
ret = process_single_pv(cmd, NULL, pvl->pv,
handle);
+ free_pv_fid(pvl->pv);
if (ret > ret_max)
ret_max = ret;
if (sigint_caught())
--- LVM2/tools/vgconvert.c 2011/02/28 13:19:03 1.50
+++ LVM2/tools/vgconvert.c 2011/03/11 14:56:56 1.51
@@ -146,6 +146,7 @@
pv_dev_name(pv));
log_error("Use pvcreate and vgcfgrestore to repair "
"from archived metadata.");
+ free_pv_fid(pv);
return ECMD_FAILED;
}
@@ -156,11 +157,13 @@
pv_dev_name(pv));
log_error("Use pvcreate and vgcfgrestore to repair "
"from archived metadata.");
+ free_pv_fid(pv);
return ECMD_FAILED;
}
log_verbose("Physical volume \"%s\" successfully created",
pv_dev_name(pv));
+ free_pv_fid(pv);
}
log_verbose("Deleting existing metadata for VG %s", vg_name);
--- LVM2/tools/vgreduce.c 2011/02/28 13:19:03 1.108
+++ LVM2/tools/vgreduce.c 2011/03/11 14:56:56 1.109
@@ -40,6 +40,7 @@
vg->free_count -= pvl->pv->pe_count;
vg->extent_count -= pvl->pv->pe_count;
del_pvl_from_vgs(vg, pvl);
+ free_pv_fid(pvl->pv);
return 1;
}
@@ -450,6 +451,8 @@
log_print("Removed \"%s\" from volume group \"%s\"", name, vg->name);
r = ECMD_PROCESSED;
bad:
+ if (pvl)
+ free_pv_fid(pvl->pv);
unlock_and_free_vg(cmd, orphan_vg, VG_ORPHANS);
return r;
}
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2011-03-02 20:00 mbroz
0 siblings, 0 replies; 31+ messages in thread
From: mbroz @ 2011-03-02 20:00 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz@sourceware.org 2011-03-02 20:00:09
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h
tools : toollib.c vgchange.c
Log message:
PE size overflows, on most architectures it is catch by "PE cannot be 0"
but s390x unfortunately return something usable.
Always use unit64 in inital parameter check.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1932&r2=1.1933
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.184&r2=1.185
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.223&r2=1.224
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.119&r2=1.120
--- LVM2/WHATS_NEW 2011/03/02 16:56:06 1.1932
+++ LVM2/WHATS_NEW 2011/03/02 20:00:09 1.1933
@@ -1,6 +1,6 @@
Version 2.02.85 -
===================================
- Fix possible overwlow in maximum stripe size.
+ Fix possible overflow in maximum stripe size and physical extent size.
Add test for failed allocation from dm_task_set_uuid() in dmeventd.
Improve pvremove error message when PV belongs to a VG.
Extend normal policy to allow mirror logs on same PVs as images if necessary.
--- LVM2/lib/metadata/metadata-exported.h 2011/02/28 13:19:02 1.184
+++ LVM2/lib/metadata/metadata-exported.h 2011/03/02 20:00:09 1.185
@@ -34,6 +34,7 @@
#define STRIPE_SIZE_MAX ( 512L * 1024L >> SECTOR_SHIFT) /* 512 KB in sectors */
#define STRIPE_SIZE_LIMIT ((UINT_MAX >> 2) + 1)
#define MAX_RESTRICTED_LVS 255 /* Used by FMT_RESTRICTED_LVIDS */
+#define MAX_EXTENT_SIZE ((uint32_t) -1)
/* Layer suffix */
#define MIRROR_SYNC_LAYER "_mimagetmp"
--- LVM2/tools/toollib.c 2011/03/02 16:56:07 1.223
+++ LVM2/tools/toollib.c 2011/03/02 20:00:09 1.224
@@ -1238,6 +1238,12 @@
return 1;
}
+ if (arg_uint64_value(cmd, physicalextentsize_ARG, 0) > MAX_EXTENT_SIZE) {
+ log_error("Physical extent size cannot be larger than %s",
+ display_size(cmd, (uint64_t) MAX_EXTENT_SIZE));
+ return 1;
+ }
+
if (arg_sign_value(cmd, maxlogicalvolumes_ARG, 0) == SIGN_MINUS) {
log_error("Max Logical Volumes may not be negative");
return 1;
--- LVM2/tools/vgchange.c 2011/02/04 20:30:19 1.119
+++ LVM2/tools/vgchange.c 2011/03/02 20:00:09 1.120
@@ -356,6 +356,12 @@
{
uint32_t extent_size;
+ if (arg_uint64_value(cmd, physicalextentsize_ARG, 0) > MAX_EXTENT_SIZE) {
+ log_error("Physical extent size cannot be larger than %s",
+ display_size(cmd, (uint64_t) MAX_EXTENT_SIZE));
+ return 1;
+ }
+
extent_size = arg_uint_value(cmd, physicalextentsize_ARG, 0);
/* FIXME: remove check - redundant with vg_change_pesize */
if (extent_size == vg->extent_size) {
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2011-02-25 14:02 prajnoha
0 siblings, 0 replies; 31+ messages in thread
From: prajnoha @ 2011-02-25 14:02 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2011-02-25 14:02:55
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c
tools : vgconvert.c
Log message:
Revert the patch for vgconvert to work with recent changes in metadata area handling.
This should work now with the help of the patch from previous commit.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1924&r2=1.1925
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.182&r2=1.183
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.434&r2=1.435
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgconvert.c.diff?cvsroot=lvm2&r1=1.48&r2=1.49
--- LVM2/WHATS_NEW 2011/02/21 12:40:46 1.1924
+++ LVM2/WHATS_NEW 2011/02/25 14:02:53 1.1925
@@ -2,7 +2,6 @@
===================================
Fix metadata balance code to work with recent changes in metadata handling.
Add old_uuid field to physical_volume and fix pvchange -u for recent changes.
- Fix vgconvert to work with recent changes in metadata handling.
Allow pvresize on a PV with two metadata areas.
Change pvcreate to use new metadata handling interface.
Restructure existing pv_setup and pv_write fn, add pv_initialise fn.
--- LVM2/lib/metadata/metadata-exported.h 2011/02/21 12:29:21 1.182
+++ LVM2/lib/metadata/metadata-exported.h 2011/02/25 14:02:54 1.183
@@ -442,9 +442,6 @@
int vg_remove(struct volume_group *vg);
int vg_rename(struct cmd_context *cmd, struct volume_group *vg,
const char *new_name);
-int vg_convert(struct cmd_context *cmd, struct volume_group *vg,
- const struct format_type *target_fmt, int64_t label_sector,
- int pvmetadatacopies, uint64_t pvmetadatasize);
int vg_extend(struct volume_group *vg, int pv_count, const char *const *pv_names,
struct pvcreate_params *pp);
int vg_reduce(struct volume_group *vg, const char *pv_name);
--- LVM2/lib/metadata/metadata.c 2011/02/25 13:59:47 1.434
+++ LVM2/lib/metadata/metadata.c 2011/02/25 14:02:54 1.435
@@ -496,109 +496,6 @@
return 1;
}
-int vg_convert(struct cmd_context *cmd, struct volume_group *vg,
- const struct format_type *target_fmt, int64_t label_sector,
- int pvmetadatacopies, uint64_t pvmetadatasize)
-{
- struct physical_volume *pv, *existing_pv;
- struct format_instance_ctx fic;
- uint64_t pe_start = 0;
- struct pv_list *pvl;
- int change_made = 0;
- const char *vg_name = vg->name;
-
- /* Replace an old format instance with a new empty one. */
- vg->fid->fmt->ops->destroy_instance(vg->fid);
- fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_AUX_MDAS;
- fic.context.vg_ref.vg_name = vg_name;
- fic.context.vg_ref.vg_id = NULL;
- if (!(vg->fid = target_fmt->ops->create_instance(target_fmt, &fic))) {
- log_error("Couldn't create target format instance "
- "for VG %s.", vg_name);
- return 0;
- }
-
- /*
- * Create new PVs in target format taking original PVs as coimage.
- * Write the new PVs out and replace the old PVs in VG structure
- * with the new PVs.
- */
- dm_list_iterate_items(pvl, &vg->pvs) {
- existing_pv = pvl->pv;
- pe_start = pv_pe_start(existing_pv);
-
- if (!(pv = pv_create(cmd, pv_dev(existing_pv),
- &existing_pv->id,
- 0, 0, 0, pe_start,
- pv_pe_count(existing_pv),
- pv_pe_size(existing_pv),
- label_sector, pvmetadatacopies,
- pvmetadatasize, 0))) {
- log_error("Failed to setup physical volume \"%s\"",
- pv_dev_name(existing_pv));
- if (change_made)
- goto revert;
- return 0;
- }
-
- /* Need to revert manually if it fails after this point */
- change_made = 1;
-
- log_verbose("Set up physical volume for \"%s\" with %" PRIu64
- " available sectors", pv_dev_name(pv), pv_size(pv));
-
- /* Wipe existing label first */
- if (!label_remove(pv_dev(pv))) {
- log_error("Failed to wipe existing label on %s",
- pv_dev_name(pv));
- }
-
- log_very_verbose("Writing physical volume data to disk \"%s\"",
- pv_dev_name(pv));
- /* FIXME: This pv_write will change the VG assignment for the
- * PV info in the cache to orphan VG! We should just change
- * the existing VG format information in the cache or throw
- * the cache away after this pv_write. */
- if (!(pv_write(cmd, pv))) {
- log_error("Failed to write physical volume \"%s\"",
- pv_dev_name(pv));
- goto revert;
- }
- log_verbose("Physical volume \"%s\" successfully created",
- pv_dev_name(pv));
-
- if (!vg->fid->fmt->ops->pv_setup(vg->fid->fmt, pv, vg)) {
- log_error("Failed to setup PV %s in new format for VG %s.",
- pv_dev_name(pv), vg_name);
- goto revert;
- }
-
- /* FIXME: Free the mem used by the old PV structure? */
-
- /* Copy relevant fields from old PV and further initialise new PV. */
- pv->vg = vg;
- if (!(pv->vg_name = dm_pool_strdup(vg->vgmem, vg_name))) {
- log_error("vg->name allocation failed for %s",pv_dev_name(pv));
- goto revert;
- }
- memcpy(&pv->vgid, &vg->id, sizeof(vg->id));
- if (!alloc_pv_segment_whole_pv(vg->vgmem, pv)) {
- log_error("pv->segments allocation failed for %s", pv_dev_name(pv));
- goto revert;
- }
-
- pvl->pv = pv;
- }
-
-
- return 1;
-
-revert:
- log_error("Use pvcreate and vgcfgrestore to repair "
- "from archived metadata.");
- return 0;
-}
-
int remove_lvs_in_vg(struct cmd_context *cmd,
struct volume_group *vg,
force_t force)
--- LVM2/tools/vgconvert.c 2011/02/21 12:29:21 1.48
+++ LVM2/tools/vgconvert.c 2011/02/25 14:02:54 1.49
@@ -19,11 +19,14 @@
struct volume_group *vg,
void *handle __attribute__((unused)))
{
- const struct format_type *target_fmt = cmd->fmt;
+ struct physical_volume *pv, *existing_pv;
struct logical_volume *lv;
struct lv_list *lvl;
int pvmetadatacopies = 0;
uint64_t pvmetadatasize = 0;
+ uint64_t pe_start = 0;
+ struct pv_list *pvl;
+ int change_made = 0;
struct lvinfo info;
int active = 0;
@@ -32,13 +35,13 @@
return ECMD_FAILED;
}
- if (vg->fid->fmt == target_fmt) {
+ if (vg->fid->fmt == cmd->fmt) {
log_error("Volume group \"%s\" already uses format %s",
vg_name, cmd->fmt->name);
return ECMD_FAILED;
}
- if (target_fmt->features & FMT_MDAS) {
+ if (cmd->fmt->features & FMT_MDAS) {
if (arg_sign_value(cmd, metadatasize_ARG, 0) == SIGN_MINUS) {
log_error("Metadata size may not be negative");
return EINVALID_CMD_LINE;
@@ -67,7 +70,7 @@
/* Set PV/LV limit if converting from unlimited metadata format */
if (vg->fid->fmt->features & FMT_UNLIMITED_VOLS &&
- !(target_fmt->features & FMT_UNLIMITED_VOLS)) {
+ !(cmd->fmt->features & FMT_UNLIMITED_VOLS)) {
if (!vg->max_lv)
vg->max_lv = 255;
if (!vg->max_pv)
@@ -76,7 +79,7 @@
/* If converting to restricted lvid, check if lvid is compatible */
if (!(vg->fid->fmt->features & FMT_RESTRICTED_LVIDS) &&
- target_fmt->features & FMT_RESTRICTED_LVIDS)
+ cmd->fmt->features & FMT_RESTRICTED_LVIDS)
dm_list_iterate_items(lvl, &vg->lvs)
if (!lvid_in_restricted_range(&lvl->lv->lvid)) {
log_error("Logical volume %s lvid format is"
@@ -86,7 +89,7 @@
}
/* Attempt to change any LVIDs that are too big */
- if (target_fmt->features & FMT_RESTRICTED_LVIDS) {
+ if (cmd->fmt->features & FMT_RESTRICTED_LVIDS) {
dm_list_iterate_items(lvl, &vg->lvs) {
lv = lvl->lv;
if (lv->status & SNAPSHOT)
@@ -110,18 +113,65 @@
return ECMD_FAILED;
}
+ dm_list_iterate_items(pvl, &vg->pvs) {
+ existing_pv = pvl->pv;
+
+ pe_start = pv_pe_start(existing_pv);
+ /* pe_end = pv_pe_count(existing_pv) * pv_pe_size(existing_pv) + pe_start - 1; */
+
+ if (!(pv = pv_create(cmd, pv_dev(existing_pv),
+ &existing_pv->id, 0, 0, 0,
+ pe_start, pv_pe_count(existing_pv),
+ pv_pe_size(existing_pv),
+ arg_int64_value(cmd, labelsector_ARG,
+ DEFAULT_LABELSECTOR),
+ pvmetadatacopies, pvmetadatasize, 0))) {
+ log_error("Failed to setup physical volume \"%s\"",
+ pv_dev_name(existing_pv));
+ if (change_made)
+ log_error("Use pvcreate and vgcfgrestore to "
+ "repair from archived metadata.");
+ return ECMD_FAILED;
+ }
+
+ /* Need to revert manually if it fails after this point */
+ change_made = 1;
+
+ log_verbose("Set up physical volume for \"%s\" with %" PRIu64
+ " available sectors", pv_dev_name(pv), pv_size(pv));
+
+ /* Wipe existing label first */
+ if (!label_remove(pv_dev(pv))) {
+ log_error("Failed to wipe existing label on %s",
+ pv_dev_name(pv));
+ log_error("Use pvcreate and vgcfgrestore to repair "
+ "from archived metadata.");
+ return ECMD_FAILED;
+ }
+
+ log_very_verbose("Writing physical volume data to disk \"%s\"",
+ pv_dev_name(pv));
+ if (!(pv_write(cmd, pv))) {
+ log_error("Failed to write physical volume \"%s\"",
+ pv_dev_name(pv));
+ log_error("Use pvcreate and vgcfgrestore to repair "
+ "from archived metadata.");
+ return ECMD_FAILED;
+ }
+ log_verbose("Physical volume \"%s\" successfully created",
+ pv_dev_name(pv));
+
+ }
+
log_verbose("Deleting existing metadata for VG %s", vg_name);
if (!vg_remove_mdas(vg)) {
log_error("Removal of existing metadata for %s failed.",
vg_name);
- goto revert;
+ log_error("Use pvcreate and vgcfgrestore to repair "
+ "from archived metadata.");
+ return ECMD_FAILED;
}
- if (!vg_convert(cmd, vg, target_fmt, arg_int64_value(cmd,
- labelsector_ARG, DEFAULT_LABELSECTOR),
- pvmetadatacopies, pvmetadatasize))
- goto revert;
-
/* FIXME Cache the label format change so we don't have to skip this */
if (test_mode()) {
log_verbose("Test mode: Skipping metadata writing for VG %s in"
@@ -130,21 +180,18 @@
}
log_verbose("Writing metadata for VG %s using format %s", vg_name,
- target_fmt->name);
- if (!vg_write(vg) || !vg_commit(vg)) {
+ cmd->fmt->name);
+ if (!backup_restore_vg(cmd, vg)) {
log_error("Conversion failed for volume group %s.", vg_name);
- goto revert;
+ log_error("Use pvcreate and vgcfgrestore to repair from "
+ "archived metadata.");
+ return ECMD_FAILED;
}
log_print("Volume group %s successfully converted", vg_name);
backup(vg);
return ECMD_PROCESSED;
-
-revert:
- log_error("Use pvcreate and vgcfgrestore to repair "
- "from archived metadata.");
- return ECMD_FAILED;
}
int vgconvert(struct cmd_context *cmd, int argc, char **argv)
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2010-05-21 14:07 zkabelac
0 siblings, 0 replies; 31+ messages in thread
From: zkabelac @ 2010-05-21 14:07 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-05-21 14:07:19
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h replicator_manip.c
Log message:
Replicator: add read and release VGs for rsites
Add functions to read and release remote VGs for replicator sites
in activation context.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1584&r2=1.1585
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.150&r2=1.151
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/replicator_manip.c.diff?cvsroot=lvm2&r1=1.5&r2=1.6
--- LVM2/WHATS_NEW 2010/05/21 12:55:25 1.1584
+++ LVM2/WHATS_NEW 2010/05/21 14:07:16 1.1585
@@ -1,5 +1,6 @@
Version 2.02.67 -
===============================
+ Add functions for read and release VGs list.
Add find_replicator_vgs() to discover all needed VGs for replicator-dev LV.
Add functions for handling cmd_vg structure.
Extend _lv_each_dependency() with Replicator dependencies.
--- LVM2/lib/metadata/metadata-exported.h 2010/05/21 12:55:25 1.150
+++ LVM2/lib/metadata/metadata-exported.h 2010/05/21 14:07:17 1.151
@@ -817,6 +817,9 @@
int find_replicator_vgs(struct logical_volume *lv);
+int lv_read_replicator_vgs(struct logical_volume *lv);
+void lv_release_replicator_vgs(struct logical_volume *lv);
+
struct logical_volume *find_pvmove_lv(struct volume_group *vg,
struct device *dev, uint32_t lv_type);
struct logical_volume *find_pvmove_lv_from_pvname(struct cmd_context *cmd,
--- LVM2/lib/metadata/replicator_manip.c 2010/05/21 13:34:09 1.5
+++ LVM2/lib/metadata/replicator_manip.c 2010/05/21 14:07:19 1.6
@@ -635,3 +635,59 @@
return ret;
}
+
+/**
+ * Read all remote VGs from lv's replicator sites.
+ * Function is used in activation context and needs all VGs already locked.
+ */
+int lv_read_replicator_vgs(struct logical_volume *lv)
+{
+ struct replicator_device *rdev;
+ struct replicator_site *rsite;
+ struct volume_group *vg;
+
+ if (!lv_is_replicator_dev(lv))
+ return 1;
+
+ dm_list_iterate_items(rsite, &first_seg(lv)->replicator->rsites) {
+ if (!rsite->vg_name)
+ continue;
+ vg = vg_read(lv->vg->cmd, rsite->vg_name, 0, 0); // READ_WITHOUT_LOCK
+ if (vg_read_error(vg)) {
+ log_error("Unable to read volume group %s",
+ rsite->vg_name);
+ goto bad;
+ }
+ rsite->vg = vg;
+ /* FIXME: handling missing LVs needs to be better */
+ dm_list_iterate_items(rdev, &rsite->rdevices)
+ if (!(rdev->lv = find_lv(vg, rdev->name))) {
+ log_error("Unable to find %s in volume group %s",
+ rdev->name, rsite->vg_name);
+ goto bad;
+ }
+ }
+
+ return 1;
+bad:
+ lv_release_replicator_vgs(lv);
+ return 0;
+}
+
+/**
+ * Release all VG resources taken by lv's replicator sites.
+ * Function is used in activation context and needs all VGs already locked.
+ */
+void lv_release_replicator_vgs(struct logical_volume *lv)
+{
+ struct replicator_site *rsite;
+
+ if (!lv_is_replicator_dev(lv))
+ return;
+
+ dm_list_iterate_back_items(rsite, &first_seg(lv)->replicator->rsites)
+ if (rsite->vg_name && rsite->vg) {
+ vg_release(rsite->vg);
+ rsite->vg = NULL;
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2010-05-21 12:55 zkabelac
0 siblings, 0 replies; 31+ messages in thread
From: zkabelac @ 2010-05-21 12:55 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-05-21 12:55:25
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h replicator_manip.c
Log message:
Replicator: add find_replicator_vgs
Adding find_replicator_vgs() function to find all needed
VGs for replicator-dev LV.
This function is later called before taking lock_vol().
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1583&r2=1.1584
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.149&r2=1.150
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/replicator_manip.c.diff?cvsroot=lvm2&r1=1.3&r2=1.4
--- LVM2/WHATS_NEW 2010/05/21 12:52:01 1.1583
+++ LVM2/WHATS_NEW 2010/05/21 12:55:25 1.1584
@@ -1,5 +1,6 @@
Version 2.02.67 -
===============================
+ Add find_replicator_vgs() to discover all needed VGs for replicator-dev LV.
Add functions for handling cmd_vg structure.
Extend _lv_each_dependency() with Replicator dependencies.
Add check_replicator_segment() for catching internal Replicator errors.
--- LVM2/lib/metadata/metadata-exported.h 2010/05/21 12:52:01 1.149
+++ LVM2/lib/metadata/metadata-exported.h 2010/05/21 12:55:25 1.150
@@ -815,6 +815,8 @@
int cmd_vg_read(struct cmd_context *cmd, struct dm_list *cmd_vgs);
void cmd_vg_release(struct dm_list *cmd_vgs);
+int find_replicator_vgs(struct logical_volume *lv);
+
struct logical_volume *find_pvmove_lv(struct volume_group *vg,
struct device *dev, uint32_t lv_type);
struct logical_volume *find_pvmove_lv_from_pvname(struct cmd_context *cmd,
--- LVM2/lib/metadata/replicator_manip.c 2010/05/21 12:52:01 1.3
+++ LVM2/lib/metadata/replicator_manip.c 2010/05/21 12:55:25 1.4
@@ -602,3 +602,35 @@
cvl->vg = NULL;
}
}
+
+/**
+ * Find all needed remote VGs for processing given LV.
+ * Missing VGs are added to VG's cmd_vg list and flag cmd_missing_vgs is set.
+ */
+int find_replicator_vgs(struct logical_volume *lv)
+{
+ struct replicator_site *rsite;
+ int ret = 1;
+
+ if (!lv_is_replicator_dev(lv))
+ return 1;
+
+ dm_list_iterate_items(rsite, &first_seg(lv)->replicator->rsites) {
+ if (!rsite->vg_name || !lv->vg->cmd_vgs ||
+ cmd_vg_lookup(lv->vg->cmd_vgs, rsite->vg_name, NULL))
+ continue;
+ ret = 0;
+ /* Using cmd memory pool for cmd_vg list allocation */
+ if (!cmd_vg_add(lv->vg->cmd->mem, lv->vg->cmd_vgs,
+ rsite->vg_name, NULL, 0)) {
+ lv->vg->cmd_missing_vgs = 0; /* do not retry */
+ stack;
+ break;
+ }
+
+ log_debug("VG: %s added as missing.", rsite->vg_name);
+ lv->vg->cmd_missing_vgs++;
+ }
+
+ return ret;
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2010-05-21 12:52 zkabelac
0 siblings, 0 replies; 31+ messages in thread
From: zkabelac @ 2010-05-21 12:52 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-05-21 12:52:01
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h replicator_manip.c
Log message:
Replicator: add sorted cmd_vg list
Introduce struct cmd_vg to store information about needed
volume group name, vgid, flags and the pointer to opened VG.
Keep VGs list in alphabetical order for locking order.
Introduce functions:
cmd_vg_add() add new cmd_vg entry.
cmd_vg_lookup() search cmd_vgs for vg_name.
cmd_vg_read() open VGs in cmd_vgs list.
cmd_vg_release() close VGs in reversed order.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1582&r2=1.1583
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.148&r2=1.149
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/replicator_manip.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3
--- LVM2/WHATS_NEW 2010/05/21 12:45:18 1.1582
+++ LVM2/WHATS_NEW 2010/05/21 12:52:01 1.1583
@@ -1,5 +1,6 @@
Version 2.02.67 -
===============================
+ Add functions for handling cmd_vg structure.
Extend _lv_each_dependency() with Replicator dependencies.
Add check_replicator_segment() for catching internal Replicator errors.
Initial lvm2 support for Replicator metadata handling.
--- LVM2/lib/metadata/metadata-exported.h 2010/05/21 12:47:46 1.148
+++ LVM2/lib/metadata/metadata-exported.h 2010/05/21 12:52:01 1.149
@@ -298,6 +298,15 @@
struct segment_type;
+/* List with vg_name, vgid and flags */
+struct cmd_vg {
+ struct dm_list list;
+ const char *vg_name;
+ const char *vgid;
+ uint32_t flags;
+ struct volume_group *vg;
+};
+
/* ++ Replicator datatypes */
typedef enum {
REPLICATOR_STATE_PASSIVE,
@@ -798,6 +807,13 @@
int lv_is_slog(const struct logical_volume *lv);
struct logical_volume *first_replicator_dev(const struct logical_volume *lv);
/* -- metadata/replicator_manip.c */
+struct cmd_vg *cmd_vg_add(struct dm_pool *mem, struct dm_list *cmd_vgs,
+ const char *vg_name, const char *vgid,
+ uint32_t flags);
+struct cmd_vg *cmd_vg_lookup(struct dm_list *cmd_vgs,
+ const char *vg_name, const char *vgid);
+int cmd_vg_read(struct cmd_context *cmd, struct dm_list *cmd_vgs);
+void cmd_vg_release(struct dm_list *cmd_vgs);
struct logical_volume *find_pvmove_lv(struct volume_group *vg,
struct device *dev, uint32_t lv_type);
--- LVM2/lib/metadata/replicator_manip.c 2010/05/21 12:43:02 1.2
+++ LVM2/lib/metadata/replicator_manip.c 2010/05/21 12:52:01 1.3
@@ -13,6 +13,7 @@
*/
#include "lib.h"
+#include "locking.h"
#include "metadata.h"
#include "segtype.h"
@@ -477,3 +478,127 @@
return NULL;
}
+
+/**
+ * Add VG open parameters to sorted cmd_vg list.
+ *
+ * Maintain the alphabeticaly ordered list, avoid duplications.
+ *
+ * \return Returns newly created or already present cmd_vg entry,
+ * or NULL in error case.
+ */
+struct cmd_vg *cmd_vg_add(struct dm_pool *mem, struct dm_list *cmd_vgs,
+ const char *vg_name, const char *vgid,
+ uint32_t flags)
+{
+ struct cmd_vg *cvl, *ins;
+
+ if (!vg_name && !vgid) {
+ log_error("Either vg_name or vgid must be set.");
+ return NULL;
+ }
+
+ /* Is it already in the list ? */
+ if ((cvl = cmd_vg_lookup(cmd_vgs, vg_name, vgid)))
+ return cvl;
+
+ if (!(cvl = dm_pool_zalloc(mem, sizeof(*cvl)))) {
+ log_error("Allocation of cmd_vg failed.");
+ return NULL;
+ }
+
+ if (vg_name && !(cvl->vg_name = dm_pool_strdup(mem, vg_name))) {
+ dm_pool_free(mem, cvl);
+ log_error("Allocation of vg_name failed.");
+ return NULL;
+ }
+
+ if (vgid && !(cvl->vgid = dm_pool_strdup(mem, vgid))) {
+ dm_pool_free(mem, cvl);
+ log_error("Allocation of vgid failed.");
+ return NULL;
+ }
+
+ cvl->flags = flags;
+
+ if (vg_name)
+ dm_list_iterate_items(ins, cmd_vgs)
+ if (strcmp(vg_name, ins->vg_name) < 0) {
+ cmd_vgs = &ins->list; /* new position */
+ break;
+ }
+
+ dm_list_add(cmd_vgs, &cvl->list);
+
+ return cvl;
+}
+
+/**
+ * Find cmd_vg with given vg_name in cmd_vgs list.
+ *
+ * \param cmd_vgs List of cmd_vg entries.
+ *
+ * \param vg_name Name of VG to be found.
+
+ * \param vgid UUID of VG to be found.
+ *
+ * \return Returns cmd_vg entry if vg_name or vgid is found,
+ * NULL otherwise.
+ */
+struct cmd_vg *cmd_vg_lookup(struct dm_list *cmd_vgs,
+ const char *vg_name, const char *vgid)
+{
+ struct cmd_vg *cvl;
+
+ dm_list_iterate_items(cvl, cmd_vgs)
+ if ((vgid && cvl->vgid && !strcmp(vgid, cvl->vgid)) ||
+ (vg_name && cvl->vg_name && !strcmp(vg_name, cvl->vg_name)))
+ return cvl;
+ return NULL;
+}
+
+/**
+ * Read and lock multiple VGs stored in cmd_vgs list alphabeticaly.
+ * On the success list head pointer is set to VGs' cmd_vgs.
+ * (supports FAILED_INCONSISTENT)
+ *
+ * \param cmd_vg Contains list of cmd_vg entries.
+ *
+ * \return Returns 1 if all VG in cmd_vgs list are correctly
+ * openned and locked, 0 otherwise.
+ */
+int cmd_vg_read(struct cmd_context *cmd, struct dm_list *cmd_vgs)
+{
+ struct cmd_vg *cvl;
+
+ /* Iterate through alphabeticaly ordered cmd_vg list */
+ dm_list_iterate_items(cvl, cmd_vgs) {
+ cvl->vg = vg_read(cmd, cvl->vg_name, cvl->vgid, cvl->flags);
+ if (vg_read_error(cvl->vg)) {
+ log_debug("Failed to vg_read %s", cvl->vg_name);
+ return 0;
+ }
+ cvl->vg->cmd_vgs = cmd_vgs; /* Make it usable in VG */
+ }
+
+ return 1;
+}
+
+/**
+ * Release opened and locked VGs from list.
+ *
+ * \param cmd_vgs Contains list of cmd_vg entries.
+ */
+void cmd_vg_release(struct dm_list *cmd_vgs)
+{
+ struct cmd_vg *cvl;
+
+ /* Backward iterate cmd_vg list */
+ dm_list_iterate_back_items(cvl, cmd_vgs) {
+ if (vg_read_error(cvl->vg))
+ vg_release(cvl->vg);
+ else
+ unlock_and_release_vg(cvl->vg->cmd, cvl->vg, cvl->vg_name);
+ cvl->vg = NULL;
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2010-05-14 15:19 jbrassow
0 siblings, 0 replies; 31+ messages in thread
From: jbrassow @ 2010-05-14 15:19 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: jbrassow@sourceware.org 2010-05-14 15:19:43
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c mirror.c
Log message:
Disallow toggling the cluster attribute of a volume group if there
are active mirrors or snapshots.
We don't have the mechanisms in place to change the device-mapper
tables for those targets that have behavioral differences between
cluster and single machine instances. Allowing users to change
the attribute but not changing the target's behavior can lead to
data corruption.
The following bugs are fixed/avoided by this patch:
235123 - vgchange -c [ny] do not change target types when necessary
289331 - RFE: switching from cluster domain to local domain needs to deactivate volume somehow
289541 - when changing from local to cluster, volumes can not appear to be deactivated
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1558&r2=1.1559
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.143&r2=1.144
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.338&r2=1.339
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.116&r2=1.117
--- LVM2/WHATS_NEW 2010/05/14 11:33:20 1.1558
+++ LVM2/WHATS_NEW 2010/05/14 15:19:42 1.1559
@@ -1,5 +1,6 @@
Version 2.02.65 -
=================================
+ Disallow cluster attr toggling if there are active mirrors or snapshots.
Use /bin/bash for scripts with bashisms.
Skip internal lvm devices in scan if ignore suspended devices is requested.
Do not merge old device cache after we run full scan. (2.02.56)
--- LVM2/lib/metadata/metadata-exported.h 2010/04/23 19:27:10 1.143
+++ LVM2/lib/metadata/metadata-exported.h 2010/05/14 15:19:43 1.144
@@ -691,6 +691,7 @@
int is_temporary_mirror_layer(const struct logical_volume *lv);
struct logical_volume * find_temporary_mirror(const struct logical_volume *lv);
+int lv_is_mirrored(const struct logical_volume *lv);
uint32_t lv_mirror_count(const struct logical_volume *lv);
uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
uint32_t region_size);
--- LVM2/lib/metadata/metadata.c 2010/04/23 19:27:10 1.338
+++ LVM2/lib/metadata/metadata.c 2010/05/14 15:19:43 1.339
@@ -1208,8 +1208,19 @@
int vg_set_clustered(struct volume_group *vg, int clustered)
{
struct lv_list *lvl;
- if (clustered) {
- dm_list_iterate_items(lvl, &vg->lvs) {
+
+ /*
+ * We do not currently support switching the cluster attribute
+ * on active mirrors or snapshots.
+ */
+ dm_list_iterate_items(lvl, &vg->lvs) {
+ if (lv_is_mirrored(lvl->lv) && lv_is_active(lvl->lv)) {
+ log_error("Mirror logical volumes must be inactive "
+ "when changing the cluster attribute.");
+ return 0;
+ }
+
+ if (clustered) {
if (lv_is_origin(lvl->lv) || lv_is_cow(lvl->lv)) {
log_error("Volume group %s contains snapshots "
"that are not yet supported.",
@@ -1217,6 +1228,13 @@
return 0;
}
}
+
+ if ((lv_is_origin(lvl->lv) || lv_is_cow(lvl->lv)) &&
+ lv_is_active(lvl->lv)) {
+ log_error("Snapshot logical volumes must be inactive "
+ "when changing the cluster attribute.");
+ return 0;
+ }
}
if (clustered)
--- LVM2/lib/metadata/mirror.c 2010/04/27 15:26:59 1.116
+++ LVM2/lib/metadata/mirror.c 2010/05/14 15:19:43 1.117
@@ -72,6 +72,14 @@
return NULL;
}
+int lv_is_mirrored(const struct logical_volume *lv)
+{
+ if (lv->status & MIRRORED)
+ return 1;
+
+ return 0;
+}
+
/*
* Returns the number of mirrors of the LV
*/
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2010-03-16 15:30 agk
0 siblings, 0 replies; 31+ messages in thread
From: agk @ 2010-03-16 15:30 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2010-03-16 15:30:49
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c
tools : pvcreate.c reporter.c
Log message:
Look up missing PVs by uuid not dev_name in _pvs_single to avoid invalid stat.
Make find_pv_in_vg_by_uuid() return same type as related functions.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1461&r2=1.1462
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.134&r2=1.135
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.319&r2=1.320
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvcreate.c.diff?cvsroot=lvm2&r1=1.88&r2=1.89
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/reporter.c.diff?cvsroot=lvm2&r1=1.58&r2=1.59
--- LVM2/WHATS_NEW 2010/03/16 14:37:38 1.1461
+++ LVM2/WHATS_NEW 2010/03/16 15:30:48 1.1462
@@ -1,5 +1,7 @@
Version 2.02.63 -
================================
+ Look up missing PVs by uuid not dev_name in _pvs_single to avoid invalid stat.
+ Make find_pv_in_vg_by_uuid() return same type as related functions.
Introduce is_missing_pv().
Fix clvmd Makefile to not overwrite LIBS from template definition.
--- LVM2/lib/metadata/metadata-exported.h 2010/03/16 14:37:38 1.134
+++ LVM2/lib/metadata/metadata-exported.h 2010/03/16 15:30:49 1.135
@@ -597,8 +597,8 @@
/* Find a PV within a given VG */
struct pv_list *find_pv_in_vg(const struct volume_group *vg,
const char *pv_name);
-struct physical_volume *find_pv_in_vg_by_uuid(const struct volume_group *vg,
- const struct id *id);
+struct pv_list *find_pv_in_vg_by_uuid(const struct volume_group *vg,
+ const struct id *id);
/* Find an LV within a given VG */
struct lv_list *find_lv_in_vg(const struct volume_group *vg,
--- LVM2/lib/metadata/metadata.c 2010/03/16 14:37:38 1.319
+++ LVM2/lib/metadata/metadata.c 2010/03/16 15:30:49 1.320
@@ -52,9 +52,6 @@
static struct pv_list *_find_pv_in_vg(const struct volume_group *vg,
const char *pv_name);
-static struct physical_volume *_find_pv_in_vg_by_uuid(const struct volume_group *vg,
- const struct id *id);
-
static uint32_t _vg_bad_status_bits(const struct volume_group *vg,
uint64_t status);
@@ -1656,37 +1653,36 @@
return 0;
}
+static struct pv_list *_find_pv_in_vg_by_uuid(const struct volume_group *vg,
+ const struct id *id)
+{
+ struct pv_list *pvl;
+
+ dm_list_iterate_items(pvl, &vg->pvs)
+ if (id_equal(&pvl->pv->id, id))
+ return pvl;
+
+ return NULL;
+}
+
/**
* find_pv_in_vg_by_uuid - Find PV in VG by PV UUID
* @vg: volume group to search
* @id: UUID of the PV to match
*
* Returns:
- * PV handle - if UUID of PV found in VG
+ * struct pv_list within owning struct volume_group - if UUID of PV found in VG
* NULL - invalid parameter or UUID of PV not found in VG
*
* Note
* FIXME - liblvm todo - make into function that takes VG handle
*/
-struct physical_volume *find_pv_in_vg_by_uuid(const struct volume_group *vg,
- const struct id *id)
+struct pv_list *find_pv_in_vg_by_uuid(const struct volume_group *vg,
+ const struct id *id)
{
return _find_pv_in_vg_by_uuid(vg, id);
}
-
-static struct physical_volume *_find_pv_in_vg_by_uuid(const struct volume_group *vg,
- const struct id *id)
-{
- struct pv_list *pvl;
-
- dm_list_iterate_items(pvl, &vg->pvs)
- if (id_equal(&pvl->pv->id, id))
- return pvl->pv;
-
- return NULL;
-}
-
struct lv_list *find_lv_in_vg(const struct volume_group *vg,
const char *lv_name)
{
--- LVM2/tools/pvcreate.c 2009/11/01 19:51:55 1.88
+++ LVM2/tools/pvcreate.c 2010/03/16 15:30:49 1.89
@@ -56,7 +56,7 @@
pp->restorefile);
return 0;
}
- if (!(existing_pv = find_pv_in_vg_by_uuid(vg, pp->idp))) {
+ if (!(existing_pv = find_pv_in_vg_by_uuid(vg, pp->idp)->pv)) {
log_error("Can't find uuid %s in backup file %s",
uuid, pp->restorefile);
return 0;
--- LVM2/tools/reporter.c 2009/11/24 17:07:09 1.58
+++ LVM2/tools/reporter.c 2010/03/16 15:30:49 1.59
@@ -70,29 +70,29 @@
struct logical_volume _free_logical_volume = {
.vg = vg ?: &_free_vg,
.name = (char *) "",
- .snapshot = NULL,
+ .snapshot = NULL,
.status = VISIBLE_LV,
.major = -1,
.minor = -1,
};
struct lv_segment _free_lv_segment = {
- .lv = &_free_logical_volume,
- .le = 0,
- .status = 0,
- .stripe_size = 0,
- .area_count = 0,
- .area_len = 0,
- .origin = NULL,
- .cow = NULL,
- .chunk_size = 0,
- .region_size = 0,
- .extents_copied = 0,
- .log_lv = NULL,
- .areas = NULL,
+ .lv = &_free_logical_volume,
+ .le = 0,
+ .status = 0,
+ .stripe_size = 0,
+ .area_count = 0,
+ .area_len = 0,
+ .origin = NULL,
+ .cow = NULL,
+ .chunk_size = 0,
+ .region_size = 0,
+ .extents_copied = 0,
+ .log_lv = NULL,
+ .areas = NULL,
};
- _free_lv_segment.segtype = get_segtype_from_string(cmd, "free");
+ _free_lv_segment.segtype = get_segtype_from_string(cmd, "free");
_free_lv_segment.len = pvseg->len;
dm_list_init(&_free_vg.pvs);
dm_list_init(&_free_vg.lvs);
@@ -136,6 +136,7 @@
int ret = ECMD_PROCESSED;
const char *vg_name = NULL;
struct volume_group *old_vg = vg;
+ char uuid[64] __attribute((aligned(8)));
if (is_pv(pv) && !is_orphan(pv) && !vg) {
vg_name = pv_vg_name(pv);
@@ -149,16 +150,28 @@
/*
* Replace possibly incomplete PV structure with new one
- * allocated in vg_read_internal() path.
+ * allocated in vg_read.
*/
- if (!(pvl = find_pv_in_vg(vg, pv_dev_name(pv)))) {
- log_error("Unable to find \"%s\" in volume group \"%s\"",
- pv_dev_name(pv), vg->name);
+ if (!is_missing_pv(pv)) {
+ if (!(pvl = find_pv_in_vg(vg, pv_dev_name(pv)))) {
+ log_error("Unable to find \"%s\" in volume group \"%s\"",
+ pv_dev_name(pv), vg->name);
+ ret = ECMD_FAILED;
+ goto out;
+ }
+ } else if (!(pvl = find_pv_in_vg_by_uuid(vg, &pv->id))) {
+ if (!id_write_format(&pv->id, uuid, sizeof(uuid))) {
+ stack;
+ uuid[0] = '\0';
+ }
+
+ log_error("Unable to find missing PV %s in volume group %s",
+ uuid, vg->name);
ret = ECMD_FAILED;
goto out;
}
- pv = pvl->pv;
+ pv = pvl->pv;
}
if (!report_object(handle, vg, NULL, pv, NULL, NULL)) {
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2010-03-16 14:37 agk
0 siblings, 0 replies; 31+ messages in thread
From: agk @ 2010-03-16 14:37 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2010-03-16 14:37:39
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c pv_map.c
tools : lvconvert.c toollib.c vgreduce.c
Log message:
Introduce is_missing_pv().
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1460&r2=1.1461
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.133&r2=1.134
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.318&r2=1.319
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/pv_map.c.diff?cvsroot=lvm2&r1=1.34&r2=1.35
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.121&r2=1.122
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.185&r2=1.186
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.99&r2=1.100
--- LVM2/WHATS_NEW 2010/03/16 08:47:46 1.1460
+++ LVM2/WHATS_NEW 2010/03/16 14:37:38 1.1461
@@ -1,5 +1,6 @@
Version 2.02.63 -
================================
+ Introduce is_missing_pv().
Fix clvmd Makefile to not overwrite LIBS from template definition.
Version 2.02.62 - 9th March 2010
--- LVM2/lib/metadata/metadata-exported.h 2010/02/24 18:15:49 1.133
+++ LVM2/lib/metadata/metadata-exported.h 2010/03/16 14:37:38 1.134
@@ -415,6 +415,7 @@
const char *lv_name);
int is_orphan_vg(const char *vg_name);
int is_orphan(const struct physical_volume *pv);
+int is_missing_pv(const struct physical_volume *pv);
int vgs_are_compatible(struct cmd_context *cmd,
struct volume_group *vg_from,
struct volume_group *vg_to);
--- LVM2/lib/metadata/metadata.c 2010/03/02 21:56:14 1.318
+++ LVM2/lib/metadata/metadata.c 2010/03/16 14:37:38 1.319
@@ -2068,7 +2068,7 @@
dm_list_iterate_items(lvseg, &lv->segments) {
for (s = 0; s < lvseg->area_count; ++s) {
if (seg_type(lvseg, s) == AREA_PV) {
- if (seg_pv(lvseg, s)->status & MISSING_PV)
+ if (is_missing_pv(seg_pv(lvseg, s)))
lv->status |= PARTIAL_LV;
}
}
@@ -2513,7 +2513,7 @@
int ret = 0;
struct pv_list *pvl;
dm_list_iterate_items(pvl, &vg->pvs) {
- if (pvl->pv->status & MISSING_PV)
+ if (is_missing_pv(pvl->pv))
++ ret;
}
return ret;
@@ -2525,7 +2525,7 @@
struct pv_list *pvl;
dm_list_iterate_items(pvl, &correct_vg->pvs)
- if (pv->dev == pvl->pv->dev && pvl->pv->status & MISSING_PV) {
+ if (pv->dev == pvl->pv->dev && is_missing_pv(pvl->pv)) {
log_warn("Missing device %s reappeared, updating "
"metadata for VG %s to version %u.",
pv_dev_name(pvl->pv), pv_vg_name(pvl->pv),
@@ -2705,7 +2705,7 @@
correct_vg = NULL;
}
} else dm_list_iterate_items(pvl, &correct_vg->pvs) {
- if (pvl->pv->status & MISSING_PV)
+ if (is_missing_pv(pvl->pv))
continue;
if (!str_list_match_item(pvids, pvl->pv->dev->pvid)) {
log_debug("Cached VG %s had incorrect PV list",
@@ -3275,6 +3275,11 @@
{
return (pv_field(pv, vg_name) ? 1 : 0);
}
+
+int is_missing_pv(const struct physical_volume *pv)
+{
+ return pv_field(pv, status) & MISSING_PV ? 1 : 0;
+}
/*
* Returns:
--- LVM2/lib/metadata/pv_map.c 2009/04/23 16:41:27 1.34
+++ LVM2/lib/metadata/pv_map.c 2010/03/16 14:37:38 1.35
@@ -129,7 +129,7 @@
dm_list_iterate_items(pvl, pvs) {
if (!(pvl->pv->status & ALLOCATABLE_PV))
continue;
- if (pvl->pv->status & MISSING_PV)
+ if (is_missing_pv(pvl->pv))
continue;
assert(pvl->pv->dev);
--- LVM2/tools/lvconvert.c 2010/02/17 22:59:46 1.121
+++ LVM2/tools/lvconvert.c 2010/03/16 14:37:39 1.122
@@ -527,7 +527,7 @@
if (seg_lv(lvseg, s)->status & PARTIAL_LV)
return 1;
} else if ((seg_type(lvseg, s) == AREA_PV) &&
- (seg_pv(lvseg, s)->status & MISSING_PV))
+ (is_missing_pv(seg_pv(lvseg, s))))
return 1;
return 0;
@@ -564,7 +564,7 @@
dm_list_init(failed_pvs);
dm_list_iterate_items(pvl, &vg->pvs) {
- if (!(pvl->pv->status & MISSING_PV))
+ if (!is_missing_pv(pvl->pv))
continue;
/*
@@ -688,7 +688,7 @@
dm_list_iterate_items(pvl, remove_pvs) {
dm_list_iterate_items_safe(pvl_vg, pvlt, &vg->pvs) {
if (!id_equal(&pvl->pv->id, &pvl_vg->pv->id) ||
- !(pvl_vg->pv->status & MISSING_PV) ||
+ !is_missing_pv(pvl_vg->pv) ||
pvl_vg->pv->pe_alloc_count != 0)
continue;
--- LVM2/tools/toollib.c 2010/02/03 14:08:40 1.185
+++ LVM2/tools/toollib.c 2010/03/16 14:37:39 1.186
@@ -1001,7 +1001,7 @@
return 1;
}
- if (allocatable_only && (pvl->pv->status & MISSING_PV)) {
+ if (allocatable_only && is_missing_pv(pvl->pv)) {
log_error("Physical volume %s is missing", pvname);
return 1;
}
--- LVM2/tools/vgreduce.c 2009/12/17 13:54:46 1.99
+++ LVM2/tools/vgreduce.c 2010/03/16 14:37:39 1.100
@@ -152,7 +152,7 @@
}
dm_list_iterate_items(pvl, &vg->pvs) {
- if (pvl->pv->dev && !(pvl->pv->status & MISSING_PV))
+ if (pvl->pv->dev && !is_missing_pv(pvl->pv))
continue;
if (r && !_remove_pv(vg, pvl, 0))
return_0;
@@ -193,7 +193,7 @@
pv = seg_pv(seg, s);
if (!pv || !pv_dev(pv) ||
- (pv->status & MISSING_PV)) {
+ is_missing_pv(pv)) {
if (arg_count(cmd, mirrorsonly_ARG) &&
!(lv->status & MIRROR_IMAGE)) {
log_error("Non-mirror-image LV %s found: can't remove.", lv->name);
@@ -224,7 +224,7 @@
*/
dm_list_iterate_safe(pvh, pvht, &vg->pvs) {
pvl = dm_list_item(pvh, struct pv_list);
- if (pvl->pv->dev && !(pvl->pv->status & MISSING_PV))
+ if (pvl->pv->dev && !is_missing_pv(pvl->pv))
continue;
if (!_remove_pv(vg, pvl, 0))
return_0;
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2009-07-14 2:19 wysochanski
0 siblings, 0 replies; 31+ messages in thread
From: wysochanski @ 2009-07-14 2:19 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski@sourceware.org 2009-07-14 02:19:19
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c
Log message:
Remove READ_REQUIRE_RESIZEABLE flag from vg_read() interface - no users.
The checks for RESIZEABLE_VG should now be inside the various functions that
have to do such operations.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Acked-by: Alasdair G Kergon <agk@redhat.com>
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1179&r2=1.1180
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.91&r2=1.92
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.249&r2=1.250
--- LVM2/WHATS_NEW 2009/07/13 23:16:17 1.1179
+++ LVM2/WHATS_NEW 2009/07/14 02:19:19 1.1180
@@ -1,5 +1,6 @@
Version 2.02.49 -
================================
+ Refactor vgsplit and vgextend to remove READ_REQUIRE_RESIZEABLE flag.
Changed exit() to _exit() after fork(); avoid flushing libc buffers twice.
Fixed invalid type being passed as printf argument on Sparc64.
Make cmd->cmd_line const.
--- LVM2/lib/metadata/metadata-exported.h 2009/07/14 02:15:21 1.91
+++ LVM2/lib/metadata/metadata-exported.h 2009/07/14 02:19:19 1.92
@@ -104,7 +104,6 @@
/* vg_read and vg_read_for_update flags */
#define READ_ALLOW_INCONSISTENT 0x00010000U
#define READ_ALLOW_EXPORTED 0x00020000U
-#define READ_REQUIRE_RESIZEABLE 0x00040000U
/* A meta-flag, useful with toollib for_each_* functions. */
#define READ_FOR_UPDATE 0x00100000U
--- LVM2/lib/metadata/metadata.c 2009/07/14 02:16:05 1.249
+++ LVM2/lib/metadata/metadata.c 2009/07/14 02:19:19 1.250
@@ -2994,9 +2994,6 @@
if (flags & READ_ALLOW_EXPORTED)
status &= ~EXPORTED_VG;
- if (flags & READ_REQUIRE_RESIZEABLE)
- status |= RESIZEABLE_VG;
-
return _vg_lock_and_read(cmd, vg_name, vgid, lock_flags, status, flags);
}
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2009-06-05 20:00 mbroz
0 siblings, 0 replies; 31+ messages in thread
From: mbroz @ 2009-06-05 20:00 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz@sourceware.org 2009-06-05 20:00:53
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h
test : t-inconsistent-metadata.sh
tools : polldaemon.c reporter.c toollib.c toollib.h
vgcfgbackup.c vgchange.c vgck.c vgconvert.c
vgdisplay.c vgexport.c vgimport.c vgremove.c
vgscan.c
Log message:
Fix double releasing of vg when repairing of vg is requested.
Several commands calls process_each_vg() and in provided
callback it explicitly recovers VG if inconsistent.
(vgchange, vgconvert, vgscan)
It means that old VG is released and reread but the function
above (process_one_vg) tries to unlock and release old VG.
Patch moves the repair logic into _process_one_vg() function.
It always tries to read vg (even inconsistent) and then decides
what to do according new defined parameter.
Also patch unifies inconsistent error messages.
The only slight change if for vgremove command, where
it now tries to repair VG before it removes if force arg is given.
(It works similar way before, just the order of operation changed).
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1141&r2=1.1142
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.75&r2=1.76
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-inconsistent-metadata.sh.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/polldaemon.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/reporter.c.diff?cvsroot=lvm2&r1=1.48&r2=1.49
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.155&r2=1.156
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.h.diff?cvsroot=lvm2&r1=1.61&r2=1.62
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcfgbackup.c.diff?cvsroot=lvm2&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgck.c.diff?cvsroot=lvm2&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgconvert.c.diff?cvsroot=lvm2&r1=1.34&r2=1.35
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgdisplay.c.diff?cvsroot=lvm2&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgexport.c.diff?cvsroot=lvm2&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgimport.c.diff?cvsroot=lvm2&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgremove.c.diff?cvsroot=lvm2&r1=1.47&r2=1.48
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgscan.c.diff?cvsroot=lvm2&r1=1.32&r2=1.33
--- LVM2/WHATS_NEW 2009/06/04 12:01:15 1.1141
+++ LVM2/WHATS_NEW 2009/06/05 20:00:52 1.1142
@@ -1,5 +1,9 @@
Version 2.02.48 -
===============================
+ Try to repair vg before actual vgremove when force flag provided.
+ Fix possible double release of VG after recovery.
+ Add parameter to process_each_vg specifying what to do with inconsistent VG.
+ Unify error messages when procesing inconsistent volume group.
Use lvconvert --repair instead of vgreduce in mirror dmeventd DSO.
Introduce lvconvert --use_policies (repair policy according to lvm.conf).
Fix clvmd-corosync to match new corosync API.
--- LVM2/lib/metadata/metadata-exported.h 2009/06/01 14:43:28 1.75
+++ LVM2/lib/metadata/metadata-exported.h 2009/06/05 20:00:52 1.76
@@ -153,6 +153,16 @@
DONT_PROMPT_OVERRIDE = 2 /* Skip prompt + override a second condition */
} force_t;
+/*
+ * What to do if VG is inconsistent
+ * FIXME: remove this after vg_read changes
+ */
+typedef enum {
+ VG_INCONSISTENT_ABORT = 0, /* Abort operation */
+ VG_INCONSISTENT_CONTINUE = 1, /* Process operation but do not try repair */
+ VG_INCONSISTENT_REPAIR = 2 /* Try to repair VG before processing */
+} inconsistent_t;
+
struct cmd_context;
struct format_handler;
struct labeller;
--- LVM2/test/t-inconsistent-metadata.sh 2009/01/09 10:16:57 1.1
+++ LVM2/test/t-inconsistent-metadata.sh 2009/06/05 20:00:52 1.2
@@ -26,7 +26,7 @@
lvresize -L 8192K $vg/resized
restore_dev $dev1
}
-
+
check() {
lvs -o lv_name,lv_size --units k $vg | tee lvs.out
grep resized lvs.out | grep 8192
@@ -43,20 +43,20 @@
# vgdisplay doesn't change anything
init
vgdisplay 2>&1 | tee cmd.out
-grep "Volume group \"$vg\" inconsistent" cmd.out
+grep "Volume group $vg inconsistent" cmd.out
vgdisplay 2>&1 | tee cmd.out
-grep "Volume group \"$vg\" inconsistent" cmd.out
+grep "Volume group $vg inconsistent" cmd.out
# lvs fixes up
init
lvs 2>&1 | tee cmd.out
grep "Inconsistent metadata found for VG $vg - updating" cmd.out
vgdisplay 2>&1 | tee cmd.out
-not grep "Volume group \"$vg\" inconsistent" cmd.out
+not grep "Volume group $vg inconsistent" cmd.out
check
# vgs doesn't fix up... (why?)
init
vgs 2>&1 | tee cmd.out
vgdisplay 2>&1 | tee cmd.out
-grep "Volume group \"$vg\" inconsistent" cmd.out
+grep "Volume group $vg inconsistent" cmd.out
--- LVM2/tools/polldaemon.c 2009/06/01 14:43:28 1.14
+++ LVM2/tools/polldaemon.c 2009/06/05 20:00:52 1.15
@@ -182,17 +182,6 @@
const char *name;
int finished;
- if (!vg) {
- log_error("Couldn't read volume group %s", vgname);
- return ECMD_FAILED;
- }
-
- if (!consistent) {
- log_error("Volume Group %s inconsistent - skipping", vgname);
- /* FIXME Should we silently recover it here or not? */
- return ECMD_FAILED;
- }
-
if (!vg_check_status(vg, EXPORTED_VG))
return ECMD_FAILED;
@@ -218,7 +207,9 @@
{
while (1) {
parms->outstanding_count = 0;
- process_each_vg(cmd, 0, NULL, LCK_VG_WRITE, 1, parms, _poll_vg);
+ /* FIXME Should we silently recover it here or not? */
+ process_each_vg(cmd, 0, NULL, LCK_VG_WRITE,
+ VG_INCONSISTENT_ABORT, parms, _poll_vg);
if (!parms->outstanding_count)
break;
sleep(parms->interval);
--- LVM2/tools/reporter.c 2009/05/13 21:27:44 1.48
+++ LVM2/tools/reporter.c 2009/06/05 20:00:52 1.49
@@ -20,11 +20,6 @@
const char *vg_name, struct volume_group *vg,
int consistent __attribute((unused)), void *handle)
{
- if (!vg) {
- log_error("Volume group %s not found", vg_name);
- return ECMD_FAILED;
- }
-
if (!report_object(handle, vg, NULL, NULL, NULL, NULL))
return ECMD_FAILED;
@@ -184,11 +179,6 @@
int consistent __attribute((unused)),
void *handle)
{
- if (!vg) {
- log_error("Volume group %s not found", vg_name);
- return ECMD_FAILED;
- }
-
return process_each_pv_in_vg(cmd, vg, NULL, handle, &_pvs_single);
}
@@ -197,11 +187,6 @@
int consistent __attribute((unused)),
void *handle)
{
- if (!vg) {
- log_error("Volume group %s not found", vg_name);
- return ECMD_FAILED;
- }
-
return process_each_pv_in_vg(cmd, vg, NULL, handle, &_pvsegs_single);
}
@@ -382,7 +367,8 @@
&_lvs_single);
break;
case VGS:
- r = process_each_vg(cmd, argc, argv, LCK_VG_READ, 0,
+ r = process_each_vg(cmd, argc, argv, LCK_VG_READ,
+ VG_INCONSISTENT_CONTINUE,
report_handle, &_vgs_single);
break;
case LABEL:
@@ -394,7 +380,8 @@
r = process_each_pv(cmd, argc, argv, NULL, LCK_VG_READ,
0, report_handle, &_pvs_single);
else
- r = process_each_vg(cmd, argc, argv, LCK_VG_READ, 0,
+ r = process_each_vg(cmd, argc, argv, LCK_VG_READ,
+ VG_INCONSISTENT_CONTINUE,
report_handle, &_pvs_in_vg);
break;
case SEGS:
@@ -406,7 +393,8 @@
r = process_each_pv(cmd, argc, argv, NULL, LCK_VG_READ,
0, report_handle, &_pvsegs_single);
else
- r = process_each_vg(cmd, argc, argv, LCK_VG_READ, 0,
+ r = process_each_vg(cmd, argc, argv, LCK_VG_READ,
+ VG_INCONSISTENT_CONTINUE,
report_handle, &_pvsegs_in_vg);
break;
}
--- LVM2/tools/toollib.c 2009/05/27 18:19:21 1.155
+++ LVM2/tools/toollib.c 2009/06/05 20:00:52 1.156
@@ -449,7 +449,7 @@
static int _process_one_vg(struct cmd_context *cmd, const char *vg_name,
const char *vgid,
struct dm_list *tags, struct dm_list *arg_vgnames,
- uint32_t lock_type, int consistent, void *handle,
+ uint32_t lock_type, inconsistent_t repair_vg, void *handle,
int ret_max,
int (*process_single) (struct cmd_context * cmd,
const char *vg_name,
@@ -457,6 +457,7 @@
int consistent, void *handle))
{
struct volume_group *vg;
+ int consistent = 0;
int ret = 0;
if (!lock_vol(cmd, vg_name, lock_type)) {
@@ -472,31 +473,48 @@
}
if (!vg_check_status(vg, CLUSTERED)) {
- unlock_and_release_vg(cmd, vg, vg_name);
- return ECMD_FAILED;
+ ret_max = ECMD_FAILED;
+ goto out;
}
if (!dm_list_empty(tags)) {
/* Only process if a tag matches or it's on arg_vgnames */
if (!str_list_match_item(arg_vgnames, vg_name) &&
- !str_list_match_list(tags, &vg->tags)) {
+ !str_list_match_list(tags, &vg->tags))
+ goto out;
+ }
+
+ if (!consistent)
+ switch (repair_vg) {
+ case VG_INCONSISTENT_ABORT:
+ log_error("Volume group %s inconsistent - skipping", vg_name);
+ ret_max = ECMD_FAILED;
+ goto out;
+ case VG_INCONSISTENT_CONTINUE:
+ log_error("Volume group %s inconsistent", vg_name);
+ break;
+ case VG_INCONSISTENT_REPAIR:
unlock_and_release_vg(cmd, vg, vg_name);
- return ret_max;
+ dev_close_all();
+ log_error("Volume group %s inconsistent", vg_name);
+ if (!(vg = recover_vg(cmd, vg_name, LCK_VG_WRITE)))
+ return ECMD_FAILED;
+ consistent = 1;
+ break;
}
- }
if ((ret = process_single(cmd, vg_name, vg, consistent,
handle)) > ret_max) {
ret_max = ret;
}
+out:
unlock_and_release_vg(cmd, vg, vg_name);
-
return ret_max;
}
int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
- uint32_t lock_type, int consistent, void *handle,
+ uint32_t lock_type, inconsistent_t repair_vg, void *handle,
int (*process_single) (struct cmd_context * cmd,
const char *vg_name,
struct volume_group * vg,
@@ -563,7 +581,7 @@
continue;
ret_max = _process_one_vg(cmd, vg_name, vgid, &tags,
&arg_vgnames,
- lock_type, consistent, handle,
+ lock_type, repair_vg, handle,
ret_max, process_single);
if (sigint_caught())
return ret_max;
@@ -575,7 +593,7 @@
continue; /* FIXME Unnecessary? */
ret_max = _process_one_vg(cmd, vg_name, NULL, &tags,
&arg_vgnames,
- lock_type, consistent, handle,
+ lock_type, repair_vg, handle,
ret_max, process_single);
if (sigint_caught())
return ret_max;
--- LVM2/tools/toollib.h 2009/02/09 09:45:49 1.61
+++ LVM2/tools/toollib.h 2009/06/05 20:00:52 1.62
@@ -27,7 +27,7 @@
uint32_t lock_type);
int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
- uint32_t lock_type, int consistent, void *handle,
+ uint32_t lock_type, inconsistent_t repair_vg, void *handle,
int (*process_single) (struct cmd_context * cmd,
const char *vg_name,
struct volume_group * vg,
--- LVM2/tools/vgcfgbackup.c 2008/09/19 06:42:00 1.26
+++ LVM2/tools/vgcfgbackup.c 2009/06/05 20:00:52 1.27
@@ -54,14 +54,6 @@
char **last_filename = (char **)handle;
char *filename;
- if (!vg) {
- log_error("Volume group \"%s\" not found", vg_name);
- return ECMD_FAILED;
- }
-
- if (!consistent)
- log_error("WARNING: Volume group \"%s\" inconsistent", vg_name);
-
if (arg_count(cmd, file_ARG)) {
if (!(filename = _expand_filename(arg_value(cmd, file_ARG),
vg->name, last_filename))) {
@@ -98,8 +90,9 @@
init_pvmove(1);
- ret = process_each_vg(cmd, argc, argv, LCK_VG_READ, 0, &last_filename,
- &vg_backup_single);
+ ret = process_each_vg(cmd, argc, argv, LCK_VG_READ,
+ VG_INCONSISTENT_CONTINUE,
+ &last_filename, &vg_backup_single);
dm_free(last_filename);
--- LVM2/tools/vgchange.c 2009/05/21 03:04:53 1.72
+++ LVM2/tools/vgchange.c 2009/06/05 20:00:52 1.73
@@ -526,19 +526,6 @@
{
int r = ECMD_FAILED;
- if (!vg) {
- log_error("Unable to find volume group \"%s\"", vg_name);
- return ECMD_FAILED;
- }
-
- if (!consistent) {
- unlock_and_release_vg(cmd, vg, vg_name);
- dev_close_all();
- log_error("Volume group \"%s\" inconsistent", vg_name);
- if (!(vg = recover_vg(cmd, vg_name, LCK_VG_WRITE)))
- return ECMD_FAILED;
- }
-
if (!(vg_status(vg) & LVM_WRITE) && !arg_count(cmd, available_ARG)) {
log_error("Volume group \"%s\" is read-only", vg->name);
return ECMD_FAILED;
@@ -633,6 +620,7 @@
return process_each_vg(cmd, argc, argv,
(arg_count(cmd, available_ARG)) ?
- LCK_VG_READ : LCK_VG_WRITE, 0, NULL,
+ LCK_VG_READ : LCK_VG_WRITE,
+ VG_INCONSISTENT_REPAIR, NULL,
&vgchange_single);
}
--- LVM2/tools/vgck.c 2009/03/16 15:19:29 1.20
+++ LVM2/tools/vgck.c 2009/06/05 20:00:52 1.21
@@ -21,16 +21,6 @@
struct volume_group *vg, int consistent,
void *handle __attribute((unused)))
{
- if (!vg) {
- log_error("Volume group \"%s\" not found", vg_name);
- return ECMD_FAILED;
- }
-
- if (!consistent) {
- log_error("Volume group \"%s\" inconsistent", vg_name);
- return ECMD_FAILED;
- }
-
if (!vg_check_status(vg, EXPORTED_VG))
return ECMD_FAILED;
@@ -42,6 +32,7 @@
int vgck(struct cmd_context *cmd, int argc, char **argv)
{
- return process_each_vg(cmd, argc, argv, LCK_VG_READ, 0, NULL,
+ return process_each_vg(cmd, argc, argv, LCK_VG_READ,
+ VG_INCONSISTENT_ABORT, NULL,
&vgck_single);
}
--- LVM2/tools/vgconvert.c 2009/05/21 03:04:53 1.34
+++ LVM2/tools/vgconvert.c 2009/06/05 20:00:52 1.35
@@ -32,19 +32,6 @@
struct lvinfo info;
int active = 0;
- if (!vg) {
- log_error("Unable to find volume group \"%s\"", vg_name);
- return ECMD_FAILED;
- }
-
- if (!consistent) {
- unlock_and_release_vg(cmd, vg, vg_name);
- dev_close_all();
- log_error("Volume group \"%s\" inconsistent", vg_name);
- if (!(vg = recover_vg(cmd, vg_name, LCK_VG_WRITE)))
- return ECMD_FAILED;
- }
-
if (!vg_check_status(vg, LVM_WRITE | EXPORTED_VG))
return ECMD_FAILED;
@@ -233,6 +220,7 @@
return EINVALID_CMD_LINE;
}
- return process_each_vg(cmd, argc, argv, LCK_VG_WRITE, 0, NULL,
+ return process_each_vg(cmd, argc, argv, LCK_VG_WRITE,
+ VG_INCONSISTENT_REPAIR, NULL,
&vgconvert_single);
}
--- LVM2/tools/vgdisplay.c 2008/11/07 19:02:47 1.22
+++ LVM2/tools/vgdisplay.c 2009/06/05 20:00:52 1.23
@@ -20,13 +20,6 @@
void *handle __attribute((unused)))
{
/* FIXME Do the active check here if activevolumegroups_ARG ? */
- if (!vg) {
- log_error("Volume group \"%s\" doesn't exist", vg_name);
- return ECMD_FAILED;
- }
-
- if (!consistent)
- log_error("WARNING: Volume group \"%s\" inconsistent", vg_name);
vg_check_status(vg, EXPORTED_VG);
@@ -98,7 +91,8 @@
}
**********/
- return process_each_vg(cmd, argc, argv, LCK_VG_READ, 0, NULL,
+ return process_each_vg(cmd, argc, argv, LCK_VG_READ,
+ VG_INCONSISTENT_CONTINUE, NULL,
vgdisplay_single);
/******** FIXME Need to count number processed
--- LVM2/tools/vgexport.c 2008/11/03 22:14:30 1.19
+++ LVM2/tools/vgexport.c 2009/06/05 20:00:52 1.20
@@ -23,16 +23,6 @@
struct pv_list *pvl;
struct physical_volume *pv;
- if (!vg) {
- log_error("Unable to find volume group \"%s\"", vg_name);
- goto error;
- }
-
- if (!consistent) {
- log_error("Volume group %s inconsistent", vg_name);
- goto error;
- }
-
if (!vg_check_status(vg, EXPORTED_VG | LVM_WRITE)) {
goto error;
}
@@ -78,6 +68,7 @@
return ECMD_FAILED;
}
- return process_each_vg(cmd, argc, argv, LCK_VG_WRITE, 1, NULL,
+ return process_each_vg(cmd, argc, argv, LCK_VG_WRITE,
+ VG_INCONSISTENT_ABORT, NULL,
&vgexport_single);
}
--- LVM2/tools/vgimport.c 2008/11/03 22:14:30 1.18
+++ LVM2/tools/vgimport.c 2009/06/05 20:00:52 1.19
@@ -23,12 +23,6 @@
struct pv_list *pvl;
struct physical_volume *pv;
- if (!vg || !consistent) {
- log_error("Unable to find exported volume group \"%s\"",
- vg_name);
- goto error;
- }
-
if (!(vg_status(vg) & EXPORTED_VG)) {
log_error("Volume group \"%s\" is not exported", vg_name);
goto error;
@@ -74,6 +68,7 @@
return ECMD_FAILED;
}
- return process_each_vg(cmd, argc, argv, LCK_VG_WRITE, 1, NULL,
+ return process_each_vg(cmd, argc, argv, LCK_VG_WRITE,
+ VG_INCONSISTENT_ABORT, NULL,
&vgimport_single);
}
--- LVM2/tools/vgremove.c 2009/05/13 13:02:56 1.47
+++ LVM2/tools/vgremove.c 2009/06/05 20:00:52 1.48
@@ -40,8 +40,10 @@
return ECMD_FAILED;
}
- ret = process_each_vg(cmd, argc, argv,
- LCK_VG_WRITE, 1,
+ ret = process_each_vg(cmd, argc, argv, LCK_VG_WRITE,
+ arg_count(cmd, force_ARG) ?
+ VG_INCONSISTENT_REPAIR :
+ VG_INCONSISTENT_ABORT,
NULL, &vgremove_single);
unlock_vg(cmd, VG_ORPHANS);
--- LVM2/tools/vgscan.c 2009/05/21 03:04:54 1.32
+++ LVM2/tools/vgscan.c 2009/06/05 20:00:52 1.33
@@ -19,20 +19,6 @@
struct volume_group *vg, int consistent,
void *handle __attribute((unused)))
{
- if (!vg) {
- log_error("Volume group \"%s\" not found", vg_name);
- return ECMD_FAILED;
- }
-
- if (!consistent) {
- unlock_and_release_vg(cmd, vg, vg_name);
- dev_close_all();
- log_error("Volume group \"%s\" inconsistent", vg_name);
- /* Don't allow partial switch to this program */
- if (!(vg = recover_vg(cmd, vg_name, LCK_VG_WRITE)))
- return ECMD_FAILED;
- }
-
log_print("Found %svolume group \"%s\" using metadata type %s",
(vg_status(vg) & EXPORTED_VG) ? "exported " : "", vg_name,
vg->fid->fmt->name);
@@ -61,7 +47,8 @@
log_print("Reading all physical volumes. This may take a while...");
- maxret = process_each_vg(cmd, argc, argv, LCK_VG_READ, 0, NULL,
+ maxret = process_each_vg(cmd, argc, argv, LCK_VG_READ,
+ VG_INCONSISTENT_REPAIR, NULL,
&vgscan_single);
if (arg_count(cmd, mknodes_ARG)) {
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2009-06-01 14:43 mbroz
0 siblings, 0 replies; 31+ messages in thread
From: mbroz @ 2009-06-01 14:43 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz@sourceware.org 2009-06-01 14:43:28
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h mirror.c
test : t-mirror-lvconvert.sh
tools : lvchange.c lvconvert.c polldaemon.c
polldaemon.h pvmove.c tools.h
Log message:
Fix convert polling to ignore LV with different UUID.
When mirror convert polling is started (mainly as backgound process,
in lvchange -a y or in lvconvert itself) it tries to read VG
and LV identified by its name.
Unfortunatelly, the VG can have already different LV under the same name,
and various more or less funny things can happen (note that
_finish_lvconvert_mirror suspends the volume for example).
(the typical example is our testing script which continuously recreates
LVs under the same name in the same VG.)
This patch adds optional uuid parameter which helps to properly
select the monitoring object. For lvconvert polling it is set to LV UUID
and both _get_lvconvert_vg and _get_lvconvert_lv uses it to read proper VG/LV.
(In the pvmove case it is NULL, here we poll for physical volume name).
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1136&r2=1.1137
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.74&r2=1.75
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.88&r2=1.89
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-mirror-lvconvert.sh.diff?cvsroot=lvm2&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.102&r2=1.103
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.76&r2=1.77
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/polldaemon.c.diff?cvsroot=lvm2&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/polldaemon.h.diff?cvsroot=lvm2&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.60&r2=1.61
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/tools.h.diff?cvsroot=lvm2&r1=1.63&r2=1.64
--- LVM2/WHATS_NEW 2009/06/01 12:43:31 1.1136
+++ LVM2/WHATS_NEW 2009/06/01 14:43:27 1.1137
@@ -1,5 +1,6 @@
Version 2.02.48 -
===============================
+ Fix convert polling to ignore LV with different UUID.
Cache underlying device readahead only before activation calls.
Fix segfault when calculating readahead on missing device in vgreduce.
Remove verbose 'visited' messages.
--- LVM2/lib/metadata/metadata-exported.h 2009/05/21 03:04:53 1.74
+++ LVM2/lib/metadata/metadata-exported.h 2009/06/01 14:43:28 1.75
@@ -621,6 +621,7 @@
struct logical_volume *find_pvmove_lv_from_pvname(struct cmd_context *cmd,
struct volume_group *vg,
const char *name,
+ const char *uuid,
uint32_t lv_type);
const char *get_pvmove_pvname_from_lv(struct logical_volume *lv);
const char *get_pvmove_pvname_from_lv_mirr(struct logical_volume *lv_mirr);
--- LVM2/lib/metadata/mirror.c 2009/05/21 03:04:53 1.88
+++ LVM2/lib/metadata/mirror.c 2009/06/01 14:43:28 1.89
@@ -1058,9 +1058,10 @@
}
struct logical_volume *find_pvmove_lv_from_pvname(struct cmd_context *cmd,
- struct volume_group *vg,
- const char *name,
- uint32_t lv_type)
+ struct volume_group *vg,
+ const char *name,
+ const char *uuid __attribute((unused)),
+ uint32_t lv_type)
{
struct physical_volume *pv;
--- LVM2/test/t-mirror-lvconvert.sh 2009/05/22 14:56:17 1.9
+++ LVM2/test/t-mirror-lvconvert.sh 2009/06/01 14:43:28 1.10
@@ -280,20 +280,19 @@
check_and_cleanup_lvs_
# "remove from original mirror (the original becomes linear)"
-# FIXME: enable this test later
-#prepare_lvs_
-#lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0-1
-#check_mirror_count_ $vg/$lv1 2
-#check_mirror_log_ $vg/$lv1
-#lvconvert -m+1 -b $vg/$lv1 $dev4
-#lvconvert -m-1 $vg/$lv1 $dev2
-#lvconvert -i1 $vg/$lv1
-#wait_conversion_ $vg/$lv1
-#check_no_tmplvs_ $vg/$lv1
-#check_mirror_count_ $vg/$lv1 2
-#mimages_are_redundant_ $vg $lv1
-#mirrorlog_is_on_ $vg/$lv1 $dev3
-#check_and_cleanup_lvs_
+prepare_lvs_
+lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0-1
+check_mirror_count_ $vg/$lv1 2
+check_mirror_log_ $vg/$lv1
+lvconvert -m+1 -b $vg/$lv1 $dev4
+lvconvert -m-1 $vg/$lv1 $dev2
+lvconvert -i1 $vg/$lv1
+wait_conversion_ $vg/$lv1
+check_no_tmplvs_ $vg/$lv1
+check_mirror_count_ $vg/$lv1 2
+mimages_are_redundant_ $vg $lv1
+mirrorlog_is_on_ $vg/$lv1 $dev3
+check_and_cleanup_lvs_
# ---------------------------------------------------------------------
--- LVM2/tools/lvchange.c 2009/05/27 18:19:21 1.102
+++ LVM2/tools/lvchange.c 2009/06/01 14:43:28 1.103
@@ -106,8 +106,6 @@
{
int activate;
const char *pvname;
- char *lv_full_name;
- uint32_t len;
activate = arg_uint_value(cmd, available_ARG, 0);
@@ -152,15 +150,9 @@
}
if (lv->status & CONVERTING) {
- len = strlen(lv->vg->name) + strlen(lv->name) + 2;
- if (!(lv_full_name = alloca(len)))
- return_0;
- if (!dm_snprintf(lv_full_name, len, "%s/%s",
- lv->vg->name, lv->name))
- return_0;
log_verbose("Spawning background lvconvert process for %s",
lv->name);
- lvconvert_poll(cmd, lv_full_name, 1);
+ lvconvert_poll(cmd, lv, 1);
}
}
--- LVM2/tools/lvconvert.c 2009/05/21 03:04:53 1.76
+++ LVM2/tools/lvconvert.c 2009/06/01 14:43:28 1.77
@@ -234,14 +234,16 @@
return 1;
}
-
static struct volume_group *_get_lvconvert_vg(struct cmd_context *cmd,
- const char *lv_name)
+ const char *lv_name, const char *uuid)
{
dev_close_all();
+ /*
+ * uuid is here LV uuid, but vg_read will use only first part.
+ */
return vg_lock_and_read(cmd, extract_vgname(cmd, lv_name),
- NULL, LCK_VG_WRITE,
+ uuid, LCK_VG_WRITE,
CLUSTERED | EXPORTED_VG | LVM_WRITE,
CORRECT_INCONSISTENT | FAIL_INCONSISTENT);
}
@@ -249,9 +251,15 @@
static struct logical_volume *_get_lvconvert_lv(struct cmd_context *cmd __attribute((unused)),
struct volume_group *vg,
const char *name,
+ const char *uuid,
uint32_t lv_type __attribute((unused)))
{
- return find_lv(vg, name);
+ struct logical_volume *lv = find_lv(vg, name);
+
+ if (!lv || (uuid && strcmp(uuid, (char *)&lv->lvid)))
+ return NULL;
+
+ return lv;
}
static int _update_lvconvert_mirror(struct cmd_context *cmd __attribute((unused)),
@@ -315,11 +323,24 @@
.finish_copy = _finish_lvconvert_mirror,
};
-int lvconvert_poll(struct cmd_context *cmd, const char *lv_name,
+int lvconvert_poll(struct cmd_context *cmd, struct logical_volume *lv,
unsigned background)
{
- return poll_daemon(cmd, lv_name, background, 0, &_lvconvert_mirror_fns,
- "Converted");
+ int len = strlen(lv->vg->name) + strlen(lv->name) + 2;
+ char *uuid = alloca(sizeof(lv->lvid));
+ char *lv_full_name = alloca(len);
+
+
+ if (!uuid || !lv_full_name)
+ return_0;
+
+ if (!dm_snprintf(lv_full_name, len, "%s/%s", lv->vg->name, lv->name))
+ return_0;
+
+ memcpy(uuid, &lv->lvid, sizeof(lv->lvid));
+
+ return poll_daemon(cmd, lv_full_name, uuid, background, 0,
+ &_lvconvert_mirror_fns, "Converted");
}
static int _insert_lvconvert_layer(struct cmd_context *cmd,
@@ -883,7 +904,7 @@
log_print("Conversion starts after activation");
goto out;
}
- ret = lvconvert_poll(cmd, lp.lv_name_full,
+ ret = lvconvert_poll(cmd, lvl->lv,
lp.wait_completion ? 0 : 1U);
}
out:
--- LVM2/tools/polldaemon.c 2009/05/21 03:04:53 1.13
+++ LVM2/tools/polldaemon.c 2009/06/01 14:43:28 1.14
@@ -129,7 +129,7 @@
return 1;
}
-static int _wait_for_single_mirror(struct cmd_context *cmd, const char *name,
+static int _wait_for_single_mirror(struct cmd_context *cmd, const char *name, const char *uuid,
struct daemon_parms *parms)
{
struct volume_group *vg;
@@ -147,13 +147,13 @@
}
/* Locks the (possibly renamed) VG again */
- if (!(vg = parms->poll_fns->get_copy_vg(cmd, name))) {
+ if (!(vg = parms->poll_fns->get_copy_vg(cmd, name, uuid))) {
log_error("ABORTING: Can't reread VG for %s", name);
/* What more could we do here? */
return 0;
}
- if (!(lv_mirr = parms->poll_fns->get_copy_lv(cmd, vg, name,
+ if (!(lv_mirr = parms->poll_fns->get_copy_lv(cmd, vg, name, uuid,
parms->lv_type))) {
log_error("ABORTING: Can't find mirror LV in %s for %s",
vg->name, name);
@@ -225,7 +225,8 @@
}
}
-int poll_daemon(struct cmd_context *cmd, const char *name, unsigned background,
+int poll_daemon(struct cmd_context *cmd, const char *name, const char *uuid,
+ unsigned background,
uint32_t lv_type, struct poll_functions *poll_fns,
const char *progress_title)
{
@@ -260,7 +261,7 @@
}
if (name) {
- if (!_wait_for_single_mirror(cmd, name, &parms))
+ if (!_wait_for_single_mirror(cmd, name, uuid, &parms))
return ECMD_FAILED;
} else
_poll_for_all_vgs(cmd, &parms);
--- LVM2/tools/polldaemon.h 2008/11/03 22:14:30 1.7
+++ LVM2/tools/polldaemon.h 2009/06/01 14:43:28 1.8
@@ -21,10 +21,12 @@
struct poll_functions {
const char *(*get_copy_name_from_lv) (struct logical_volume *lv_mirr);
struct volume_group *(*get_copy_vg) (struct cmd_context *cmd,
- const char *name);
+ const char *name,
+ const char *uuid);
struct logical_volume *(*get_copy_lv) (struct cmd_context *cmd,
struct volume_group *vg,
const char *name,
+ const char *uuid,
uint32_t lv_type);
int (*update_metadata) (struct cmd_context *cmd,
struct volume_group *vg,
@@ -47,7 +49,8 @@
struct poll_functions *poll_fns;
};
-int poll_daemon(struct cmd_context *cmd, const char *name, unsigned background,
+int poll_daemon(struct cmd_context *cmd, const char *name, const char *uuid,
+ unsigned background,
uint32_t lv_type, struct poll_functions *poll_fns,
const char *progress_title);
--- LVM2/tools/pvmove.c 2009/05/21 03:04:53 1.60
+++ LVM2/tools/pvmove.c 2009/06/01 14:43:28 1.61
@@ -551,7 +551,7 @@
}
static struct volume_group *_get_move_vg(struct cmd_context *cmd,
- const char *name)
+ const char *name, const char *uuid)
{
struct physical_volume *pv;
@@ -576,7 +576,7 @@
int pvmove_poll(struct cmd_context *cmd, const char *pv_name,
unsigned background)
{
- return poll_daemon(cmd, pv_name, background, PVMOVE, &_pvmove_fns,
+ return poll_daemon(cmd, pv_name, NULL, background, PVMOVE, &_pvmove_fns,
"Moved");
}
--- LVM2/tools/tools.h 2008/11/04 14:57:06 1.63
+++ LVM2/tools/tools.h 2009/06/01 14:43:28 1.64
@@ -168,6 +168,6 @@
const char *command_name(struct cmd_context *cmd);
int pvmove_poll(struct cmd_context *cmd, const char *pv, unsigned background);
-int lvconvert_poll(struct cmd_context *cmd, const char *lv_name, unsigned background);
+int lvconvert_poll(struct cmd_context *cmd, struct logical_volume *lv, unsigned background);
#endif
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2009-02-03 16:19 wysochanski
0 siblings, 0 replies; 31+ messages in thread
From: wysochanski @ 2009-02-03 16:19 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski@sourceware.org 2009-02-03 16:19:26
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c
tools : toollib.c
Log message:
Rename get_vgs() to get_vgnames() and clarify related error messages.
get_vgs() really returns a list of vgnames. In the future we will use
get_vgs() to return a list of vg structures, similar to get_pvs().
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1032&r2=1.1033
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.60&r2=1.61
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.202&r2=1.203
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.141&r2=1.142
--- LVM2/WHATS_NEW 2009/02/02 14:34:24 1.1032
+++ LVM2/WHATS_NEW 2009/02/03 16:19:25 1.1033
@@ -1,5 +1,6 @@
Version 2.02.45 -
===================================
+ Rename get_vgs() to get_vgnames() and clarify related error messages.
Allow clvmd to be built with all cluster managers & select one on cmdline.
Mention --with-clvmd=corosync in ./configure.
Replace internal vg_check_status() implementation.
--- LVM2/lib/metadata/metadata-exported.h 2009/01/27 01:48:47 1.60
+++ LVM2/lib/metadata/metadata-exported.h 2009/02/03 16:19:26 1.61
@@ -370,7 +370,7 @@
struct dm_list *get_pvs(struct cmd_context *cmd);
/* Set full_scan to 1 to re-read every (filtered) device label */
-struct dm_list *get_vgs(struct cmd_context *cmd, int full_scan);
+struct dm_list *get_vgnames(struct cmd_context *cmd, int full_scan);
struct dm_list *get_vgids(struct cmd_context *cmd, int full_scan);
int scan_vgs_for_pvs(struct cmd_context *cmd);
--- LVM2/lib/metadata/metadata.c 2009/01/27 01:48:47 1.202
+++ LVM2/lib/metadata/metadata.c 2009/02/03 16:19:26 1.203
@@ -2039,8 +2039,8 @@
* allowed to do a full scan here any more. */
// The slow way - full scan required to cope with vgrename
- if (!(vgnames = get_vgs(cmd, 2))) {
- log_error("vg_read_by_vgid: get_vgs failed");
+ if (!(vgnames = get_vgnames(cmd, 2))) {
+ log_error("vg_read_by_vgid: get_vgnames failed");
return NULL;
}
@@ -2167,7 +2167,7 @@
}
/* May return empty list */
-struct dm_list *get_vgs(struct cmd_context *cmd, int full_scan)
+struct dm_list *get_vgnames(struct cmd_context *cmd, int full_scan)
{
return lvmcache_get_vgnames(cmd, full_scan);
}
@@ -2201,7 +2201,7 @@
/* Get list of VGs */
if (!(vgids = get_vgids(cmd, 0))) {
- log_error("get_pvs: get_vgs failed");
+ log_error("get_pvs: get_vgids failed");
return 0;
}
--- LVM2/tools/toollib.c 2009/01/26 19:01:32 1.141
+++ LVM2/tools/toollib.c 2009/02/03 16:19:26 1.142
@@ -273,7 +273,7 @@
if (!argc || !dm_list_empty(&tags)) {
log_verbose("Finding all logical volumes");
- if (!(vgnames = get_vgs(cmd, 0)) || dm_list_empty(vgnames)) {
+ if (!(vgnames = get_vgnames(cmd, 0)) || dm_list_empty(vgnames)) {
log_error("No volume groups found");
return ret_max;
}
@@ -713,7 +713,7 @@
if (sigint_caught())
return ret_max;
}
- if (!dm_list_empty(&tags) && (vgnames = get_vgs(cmd, 0)) &&
+ if (!dm_list_empty(&tags) && (vgnames = get_vgnames(cmd, 0)) &&
!dm_list_empty(vgnames)) {
dm_list_iterate_items(sll, vgnames) {
if (!lock_vol(cmd, sll->str, lock_type)) {
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2008-04-23 14:33 wysochanski
0 siblings, 0 replies; 31+ messages in thread
From: wysochanski @ 2008-04-23 14:33 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski@sourceware.org 2008-04-23 14:33:06
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h
tools : vgsplit.c
Log message:
Fix vgsplit internal counting of snapshot LVs.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.859&r2=1.860
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.47&r2=1.48
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.66&r2=1.67
--- LVM2/WHATS_NEW 2008/04/23 12:53:10 1.859
+++ LVM2/WHATS_NEW 2008/04/23 14:33:05 1.860
@@ -1,5 +1,6 @@
Version 2.02.36 -
=================================
+ Fix vgsplit internal counting of snapshot LVs.
Fix internal snapshot_count when vgmerge with snapshots in source VG.
Simply clvmd-openais by using non-async saLckResourceLock.
Check lv_count in vg_validate.
--- LVM2/lib/metadata/metadata-exported.h 2008/04/10 17:09:31 1.47
+++ LVM2/lib/metadata/metadata-exported.h 2008/04/23 14:33:05 1.48
@@ -202,7 +202,23 @@
uint32_t pv_count;
struct list pvs;
- /* logical volumes */
+ /*
+ * logical volumes
+ * The following relationship should always hold:
+ * list_size(lvs) = lv_count + 2 * snapshot_count
+ *
+ * Snapshots consist of 2 instances of "struct logical_volume":
+ * - cow (lv_name is visible to the user)
+ * - snapshot (lv_name is 'snapshotN')
+ * Neither of these instances is reflected in lv_count, but we
+ * multiply the snapshot_count by 2.
+ *
+ * Mirrors consist of multiple instances of "struct logical_volume":
+ * - one for the mirror log
+ * - one for each mirror leg
+ * - one for the user-visible mirror LV
+ * all of the instances are reflected in lv_count.
+ */
uint32_t lv_count;
uint32_t snapshot_count;
struct list lvs;
--- LVM2/tools/vgsplit.c 2008/04/15 14:57:12 1.66
+++ LVM2/tools/vgsplit.c 2008/04/23 14:33:06 1.67
@@ -109,7 +109,7 @@
if (lv->status & SNAPSHOT) {
vg_from->snapshot_count--;
vg_to->snapshot_count++;
- } else {
+ } else if (!lv_is_cow(lv)) {
vg_from->lv_count--;
vg_to->lv_count++;
}
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2008-02-13 20:01 meyering
0 siblings, 0 replies; 31+ messages in thread
From: meyering @ 2008-02-13 20:01 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: meyering@sourceware.org 2008-02-13 20:01:48
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c
Log message:
is_orphan: make parameter "const" to avoid compiler warning
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.793&r2=1.794
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.43&r2=1.44
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.157&r2=1.158
--- LVM2/WHATS_NEW 2008/02/12 13:29:08 1.793
+++ LVM2/WHATS_NEW 2008/02/13 20:01:48 1.794
@@ -1,5 +1,6 @@
Version 2.02.34 -
===================================
+ Avoid a compiler warning: make is_orphan's parameter "const".
Fix lvconvert detection of mirror conversion in progress. (2.02.30)
Avoid automatic lvconvert polldaemon invocation when -R specified. (2.02.30)
Fix 'pvs -a' to detect VGs of PVs without metadata areas.
--- LVM2/lib/metadata/metadata-exported.h 2008/02/06 15:47:28 1.43
+++ LVM2/lib/metadata/metadata-exported.h 2008/02/13 20:01:48 1.44
@@ -318,7 +318,7 @@
struct list *mdas, int64_t label_sector);
int is_pv(pv_t *pv);
int is_orphan_vg(const char *vg_name);
-int is_orphan(pv_t *pv);
+int is_orphan(const pv_t *pv);
int vgs_are_compatible(struct cmd_context *cmd,
struct volume_group *vg_from,
struct volume_group *vg_to);
--- LVM2/lib/metadata/metadata.c 2008/02/06 15:47:28 1.157
+++ LVM2/lib/metadata/metadata.c 2008/02/13 20:01:48 1.158
@@ -1975,7 +1975,7 @@
* is_orphan - Determine whether a pv is an orphan based on its vg_name
* @pv: handle to the physical volume
*/
-int is_orphan(pv_t *pv)
+int is_orphan(const pv_t *pv)
{
return is_orphan_vg(pv_field(pv, vg_name));
}
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2008-01-18 22:02 agk
0 siblings, 0 replies; 31+ messages in thread
From: agk @ 2008-01-18 22:02 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2008-01-18 22:02:37
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h mirror.c
tools : lvcreate.c
Log message:
Fix lvcreate --nosync not to wait for non-happening sync.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.769&r2=1.770
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.64&r2=1.65
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.169&r2=1.170
--- LVM2/WHATS_NEW 2008/01/18 22:00:46 1.769
+++ LVM2/WHATS_NEW 2008/01/18 22:02:37 1.770
@@ -1,5 +1,6 @@
Version 2.02.31 -
===================================
+ Fix lvcreate --nosync not to wait for non-happening sync. (2.02.30)
Add very_verbose lvconvert messages.
Avoid error message when using default setting of lvcreate -M1. (2.02.30)
--- LVM2/lib/metadata/metadata-exported.h 2008/01/17 17:17:09 1.40
+++ LVM2/lib/metadata/metadata-exported.h 2008/01/18 22:02:37 1.41
@@ -95,6 +95,7 @@
/* Mirror conversion type flags */
#define MIRROR_BY_SEG 0x00000001U /* segment-by-segment mirror */
#define MIRROR_BY_LV 0x00000002U /* mirror using whole mimage LVs */
+#define MIRROR_SKIP_INIT_SYNC 0x00000010U /* skip initial sync */
/* Ordered list - see lv_manip.c */
typedef enum {
--- LVM2/lib/metadata/mirror.c 2008/01/18 22:00:46 1.64
+++ LVM2/lib/metadata/mirror.c 2008/01/18 22:02:37 1.65
@@ -1356,8 +1356,8 @@
* create and initialize mirror log
*/
if (log_count &&
- !(log_lv = _set_up_mirror_log(cmd, ah, lv, log_count,
- region_size, alloc, 0)))
+ !(log_lv = _set_up_mirror_log(cmd, ah, lv, log_count, region_size,
+ alloc, mirror_in_sync())))
return_0;
/* The log initialization involves vg metadata commit.
@@ -1427,7 +1427,10 @@
* the global mirror_in_sync status. As we are adding
* a new mirror, it should be set as 'out-of-sync'
* so that the sync starts. */
- if (!log_count)
+ /* However, MIRROR_SKIP_INIT_SYNC even overrides it. */
+ if (flags & MIRROR_SKIP_INIT_SYNC)
+ init_mirror_in_sync(1);
+ else if (!log_count)
init_mirror_in_sync(0);
if (flags & MIRROR_BY_SEG) {
--- LVM2/tools/lvcreate.c 2008/01/18 21:56:39 1.169
+++ LVM2/tools/lvcreate.c 2008/01/18 22:02:37 1.170
@@ -789,7 +789,8 @@
lv->le_count,
lp->region_size),
lp->corelog ? 0U : 1U, pvh, lp->alloc,
- MIRROR_BY_LV)) {
+ MIRROR_BY_LV |
+ (lp->nosync ? MIRROR_SKIP_INIT_SYNC : 0))) {
stack;
goto revert_new_lv;
}
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2008-01-16 18:15 agk
0 siblings, 0 replies; 31+ messages in thread
From: agk @ 2008-01-16 18:15 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2008-01-16 18:15:26
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c
tools : lvmcmdline.c pvcreate.c pvdisplay.c toollib.c
Log message:
use scan_vgs_for_pvs to detect non-orphans without MDAs
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.762&r2=1.763
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.33&r2=1.34
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.148&r2=1.149
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.58&r2=1.59
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvcreate.c.diff?cvsroot=lvm2&r1=1.59&r2=1.60
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvdisplay.c.diff?cvsroot=lvm2&r1=1.44&r2=1.45
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.125&r2=1.126
--- LVM2/WHATS_NEW 2008/01/16 15:25:10 1.762
+++ LVM2/WHATS_NEW 2008/01/16 18:15:26 1.763
@@ -1,5 +1,6 @@
Version 2.02.30 -
===================================
+ Fix process_all_pvs to detect non-orphans with no MDAs correctly.
Don't use block_on_error with mirror targets version 1.12 and above.
Update vgsplit to include vgcreate-style options when new VG is destination.
Update vgsplit to accept existing VG as destination.
--- LVM2/lib/metadata/metadata-exported.h 2008/01/15 22:56:30 1.33
+++ LVM2/lib/metadata/metadata-exported.h 2008/01/16 18:15:26 1.34
@@ -310,6 +310,7 @@
/* Set full_scan to 1 to re-read every (filtered) device label */
struct list *get_vgs(struct cmd_context *cmd, int full_scan);
struct list *get_vgids(struct cmd_context *cmd, int full_scan);
+int scan_vgs_for_pvs(struct cmd_context *cmd);
int pv_write(struct cmd_context *cmd, struct physical_volume *pv,
struct list *mdas, int64_t label_sector);
--- LVM2/lib/metadata/metadata.c 2008/01/15 22:56:30 1.148
+++ LVM2/lib/metadata/metadata.c 2008/01/16 18:15:26 1.149
@@ -1015,7 +1015,16 @@
return NULL;
}
- /* FIXME Can fail when no PV mda */
+ if (is_orphan_vg(pv->vg_name)) {
+ /* If a PV has no MDAs - need to search all VGs for it */
+ if (!scan_vgs_for_pvs(cmd))
+ return_NULL;
+ if (!(pv = _pv_read(cmd, pv_name, NULL, NULL, 1))) {
+ log_error("Physical volume %s not found", pv_name);
+ return NULL;
+ }
+ }
+
if (is_orphan_vg(pv->vg_name)) {
log_error("Physical volume %s not in a volume group", pv_name);
return NULL;
@@ -1788,7 +1797,7 @@
return lvmcache_get_vgids(cmd, full_scan);
}
-struct list *get_pvs(struct cmd_context *cmd)
+static int _get_pvs(struct cmd_context *cmd, struct list **pvslist)
{
struct str_list *strl;
struct list *results;
@@ -1802,17 +1811,19 @@
lvmcache_label_scan(cmd, 0);
- if (!(results = dm_pool_alloc(cmd->mem, sizeof(*results)))) {
- log_error("PV list allocation failed");
- return NULL;
- }
+ if (pvslist) {
+ if (!(results = dm_pool_alloc(cmd->mem, sizeof(*results)))) {
+ log_error("PV list allocation failed");
+ return NULL;
+ }
- list_init(results);
+ list_init(results);
+ }
/* Get list of VGs */
if (!(vgids = get_vgids(cmd, 0))) {
log_error("get_pvs: get_vgs failed");
- return NULL;
+ return 0;
}
/* Read every VG to ensure cache consistency */
@@ -1839,16 +1850,36 @@
vgname);
/* Move PVs onto results list */
- list_iterate_safe(pvh, tmp, &vg->pvs) {
- list_add(results, pvh);
- }
+ if (pvslist)
+ list_iterate_safe(pvh, tmp, &vg->pvs)
+ list_add(results, pvh);
}
init_pvmove(old_pvmove);
init_partial(old_partial);
+ if (pvslist)
+ *pvslist = results;
+ else
+ dm_pool_free(cmd->mem, vgids);
+
+ return 1;
+}
+
+struct list *get_pvs(struct cmd_context *cmd)
+{
+ struct list *results;
+
+ if (!_get_pvs(cmd, &results))
+ return NULL;
+
return results;
}
+int scan_vgs_for_pvs(struct cmd_context *cmd)
+{
+ return _get_pvs(cmd, NULL);
+}
+
/* FIXME: liblvm todo - make into function that takes handle */
int pv_write(struct cmd_context *cmd __attribute((unused)),
struct physical_volume *pv,
--- LVM2/tools/lvmcmdline.c 2008/01/16 17:14:56 1.58
+++ LVM2/tools/lvmcmdline.c 2008/01/16 18:15:26 1.59
@@ -584,7 +584,6 @@
a->ui64_value = 0;
}
- memset(str, 0, sizeof(str));
/* fill in the short and long opts */
for (i = 0; i < cmd->command->num_args; i++)
_add_getopt_arg(cmd->command->valid_args[i], &ptr, &o);
--- LVM2/tools/pvcreate.c 2008/01/09 00:18:36 1.59
+++ LVM2/tools/pvcreate.c 2008/01/16 18:15:26 1.60
@@ -51,7 +51,8 @@
* system.
*/
if (pv && is_orphan(pv)) {
- (void) get_vgs(cmd, 1);
+ if (!scan_vgs_for_pvs(cmd))
+ return_0;
pv = pv_read(cmd, name, NULL, NULL, 0);
}
--- LVM2/tools/pvdisplay.c 2007/11/15 21:30:52 1.44
+++ LVM2/tools/pvdisplay.c 2008/01/16 18:15:26 1.45
@@ -26,7 +26,7 @@
const char *pv_name = pv_dev_name(pv);
const char *vg_name = NULL;
- if (!is_orphan(pv) && !vg) {
+ if (!is_orphan(pv) && !vg) {
vg_name = pv_vg_name(pv);
if (!(vg = vg_lock_and_read(cmd, vg_name, (char *)&pv->vgid,
LCK_VG_READ, CLUSTERED, 0))) {
--- LVM2/tools/toollib.c 2008/01/15 22:56:30 1.125
+++ LVM2/tools/toollib.c 2008/01/16 18:15:26 1.126
@@ -696,6 +696,7 @@
struct str_list *sll;
char *tagname;
int consistent = 1;
+ int scanned = 0;
list_init(&tags);
@@ -738,6 +739,30 @@
ret_max = ECMD_FAILED;
continue;
}
+
+ /*
+ * If a PV has no MDAs it may appear to be an
+ * orphan until the metadata is read off
+ * another PV in the same VG. Detecting this
+ * means checking every VG by scanning every
+ * PV on the system.
+ */
+ if (!scanned && is_orphan(pv)) {
+ if (!scan_vgs_for_pvs(cmd)) {
+ stack;
+ ret_max = ECMD_FAILED;
+ continue;
+ }
+ scanned = 1;
+ if (!(pv = pv_read(cmd, argv[opt],
+ NULL, NULL, 1))) {
+ log_error("Failed to read "
+ "physical volume "
+ "\"%s\"", argv[opt]);
+ ret_max = ECMD_FAILED;
+ continue;
+ }
+ }
}
ret = process_single(cmd, vg, pv, handle);
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2008-01-07 20:42 mbroz
0 siblings, 0 replies; 31+ messages in thread
From: mbroz @ 2008-01-07 20:42 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz@sourceware.org 2008-01-07 20:42:57
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c
tools : reporter.c
Log message:
Fix a segfault if using pvs with --all argument. (2.02.29)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.751&r2=1.752
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.145&r2=1.146
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/reporter.c.diff?cvsroot=lvm2&r1=1.32&r2=1.33
--- LVM2/WHATS_NEW 2008/01/04 11:48:40 1.751
+++ LVM2/WHATS_NEW 2008/01/07 20:42:56 1.752
@@ -1,5 +1,6 @@
Version 2.02.30 -
===================================
+ Fix a segfault if using pvs with --all argument. (2.02.29)
Update --uuid argument description in man pages.
Fix vgreduce PV list processing not to process every PV in the VG. (2.02.29)
Extend lvconvert to use polldaemon.
--- LVM2/lib/metadata/metadata-exported.h 2007/12/22 02:12:59 1.29
+++ LVM2/lib/metadata/metadata-exported.h 2008/01/07 20:42:57 1.30
@@ -312,6 +312,7 @@
int pv_write(struct cmd_context *cmd, struct physical_volume *pv,
struct list *mdas, int64_t label_sector);
+int is_pv(pv_t *pv);
int is_orphan_vg(const char *vg_name);
int is_orphan(pv_t *pv);
vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name,
--- LVM2/lib/metadata/metadata.c 2007/12/20 18:55:46 1.145
+++ LVM2/lib/metadata/metadata.c 2008/01/07 20:42:57 1.146
@@ -1832,6 +1832,15 @@
return is_orphan_vg(pv_field(pv, vg_name));
}
+/**
+ * is_pv - Determine whether a pv is a real pv or dummy one
+ * @pv: handle to device
+ */
+int is_pv(pv_t *pv)
+{
+ return (pv_field(pv, vg_name) ? 1 : 0);
+}
+
/*
* Returns:
* 0 - fail
--- LVM2/tools/reporter.c 2007/12/20 16:49:37 1.32
+++ LVM2/tools/reporter.c 2008/01/07 20:42:57 1.33
@@ -91,7 +91,7 @@
int ret = ECMD_PROCESSED;
const char *vg_name = NULL;
- if (!is_orphan(pv) && !vg) {
+ if (is_pv(pv) && !is_orphan(pv) && !vg) {
vg_name = pv_vg_name(pv);
if (!(vg = vg_lock_and_read(cmd, vg_name, (char *)&pv->vgid,
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2007-11-15 2:20 agk
0 siblings, 0 replies; 31+ messages in thread
From: agk @ 2007-11-15 2:20 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2007-11-15 02:20:04
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c
tools : lvconvert.c lvcreate.c lvrename.c lvresize.c
pvchange.c pvdisplay.c pvmove.c reporter.c
toollib.c vgextend.c vgmerge.c vgsplit.c
Log message:
Convert some vg_reads into vg_lock_and_reads
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.735&r2=1.736
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.143&r2=1.144
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.44&r2=1.45
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.159&r2=1.160
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvrename.c.diff?cvsroot=lvm2&r1=1.46&r2=1.47
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.88&r2=1.89
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvchange.c.diff?cvsroot=lvm2&r1=1.55&r2=1.56
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvdisplay.c.diff?cvsroot=lvm2&r1=1.42&r2=1.43
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.42&r2=1.43
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/reporter.c.diff?cvsroot=lvm2&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.115&r2=1.116
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgextend.c.diff?cvsroot=lvm2&r1=1.35&r2=1.36
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgmerge.c.diff?cvsroot=lvm2&r1=1.41&r2=1.42
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39
--- LVM2/WHATS_NEW 2007/11/14 18:41:05 1.735
+++ LVM2/WHATS_NEW 2007/11/15 02:20:03 1.736
@@ -1,5 +1,6 @@
Version 2.02.29 -
==================================
+ Convert some vg_reads into vg_lock_and_reads.
Avoid nested vg_reads when processing PVs in VGs and fix associated locking.
Accept sizes with --readahead argument.
Store size arguments as sectors internally.
--- LVM2/lib/metadata/metadata-exported.h 2007/11/09 16:51:54 1.23
+++ LVM2/lib/metadata/metadata-exported.h 2007/11/15 02:20:03 1.24
@@ -308,6 +308,7 @@
int is_orphan_vg(const char *vg_name);
int is_orphan(pv_t *pv);
vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name,
+ const char *vgid,
uint32_t lock_flags, uint32_t status_flags,
uint32_t misc_flags);
--- LVM2/lib/metadata/metadata.c 2007/11/05 17:17:55 1.143
+++ LVM2/lib/metadata/metadata.c 2007/11/15 02:20:03 1.144
@@ -1922,6 +1922,7 @@
* non-NULL - success; volume group handle
*/
vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name,
+ const char *vgid,
uint32_t lock_flags, uint32_t status_flags,
uint32_t misc_flags)
{
@@ -1942,7 +1943,7 @@
return NULL;
}
- if (!(vg = vg_read(cmd, vg_name, NULL, &consistent)) ||
+ if (!(vg = vg_read(cmd, vg_name, vgid, &consistent)) ||
((misc_flags & FAIL_INCONSISTENT) && !consistent)) {
log_error("Volume group \"%s\" not found", vg_name);
unlock_vg(cmd, vg_name);
@@ -1953,10 +1954,10 @@
unlock_vg(cmd, vg_name);
return NULL;
}
+
return vg;
}
-
/*
* Gets/Sets for external LVM library
*/
--- LVM2/tools/lvconvert.c 2007/11/14 00:08:25 1.44
+++ LVM2/tools/lvconvert.c 2007/11/15 02:20:03 1.45
@@ -608,7 +608,7 @@
log_verbose("Checking for existing volume group \"%s\"", lp.vg_name);
- if (!(vg = vg_lock_and_read(cmd, lp.vg_name, LCK_VG_WRITE,
+ if (!(vg = vg_lock_and_read(cmd, lp.vg_name, NULL, LCK_VG_WRITE,
CLUSTERED | EXPORTED_VG | LVM_WRITE,
CORRECT_INCONSISTENT)))
return ECMD_FAILED;
--- LVM2/tools/lvcreate.c 2007/11/14 00:08:25 1.159
+++ LVM2/tools/lvcreate.c 2007/11/15 02:20:03 1.160
@@ -508,16 +508,16 @@
return 1;
}
-static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
+static int _lvcreate(struct cmd_context *cmd, struct volume_group *vg,
+ struct lvcreate_params *lp)
{
uint32_t size_rest;
uint32_t status = 0;
uint64_t tmp_size;
- struct volume_group *vg;
struct logical_volume *lv, *org = NULL, *log_lv = NULL;
struct list *pvh, tags;
const char *tag = NULL;
- int consistent = 1, origin_active = 0;
+ int origin_active = 0;
struct alloc_handle *ah = NULL;
char lv_name_buf[128];
const char *lv_name;
@@ -526,17 +526,6 @@
status |= lp->permission | VISIBLE_LV;
- /* does VG exist? */
- log_verbose("Finding volume group \"%s\"", lp->vg_name);
-
- if (!(vg = vg_read(cmd, lp->vg_name, NULL, &consistent))) {
- log_error("Volume group \"%s\" doesn't exist", lp->vg_name);
- return 0;
- }
-
- if (!vg_check_status(vg, CLUSTERED | EXPORTED_VG | LVM_WRITE))
- return 0;
-
if (lp->lv_name && find_lv_in_vg(vg, lp->lv_name)) {
log_error("Logical volume \"%s\" already exists in "
"volume group \"%s\"", lp->lv_name, lp->vg_name);
@@ -926,27 +915,24 @@
int lvcreate(struct cmd_context *cmd, int argc, char **argv)
{
- int r = ECMD_FAILED;
+ int r = ECMD_PROCESSED;
struct lvcreate_params lp;
+ struct volume_group *vg;
memset(&lp, 0, sizeof(lp));
if (!_lvcreate_params(&lp, cmd, argc, argv))
return EINVALID_CMD_LINE;
- if (!lock_vol(cmd, lp.vg_name, LCK_VG_WRITE)) {
- log_error("Can't get lock for %s", lp.vg_name);
+ log_verbose("Finding volume group \"%s\"", lp.vg_name);
+ if (!(vg = vg_lock_and_read(cmd, lp.vg_name, NULL, LCK_VG_WRITE,
+ CLUSTERED | EXPORTED_VG | LVM_WRITE,
+ CORRECT_INCONSISTENT)))
return ECMD_FAILED;
- }
-
- if (!_lvcreate(cmd, &lp)) {
- stack;
- goto out;
- }
- r = ECMD_PROCESSED;
+ if (!_lvcreate(cmd, vg, &lp))
+ r = ECMD_FAILED;
- out:
unlock_vg(cmd, lp.vg_name);
return r;
}
--- LVM2/tools/lvrename.c 2007/08/20 20:55:30 1.46
+++ LVM2/tools/lvrename.c 2007/11/15 02:20:03 1.47
@@ -101,8 +101,7 @@
}
log_verbose("Checking for existing volume group \"%s\"", vg_name);
-
- if (!(vg = vg_lock_and_read(cmd, vg_name, LCK_VG_WRITE,
+ if (!(vg = vg_lock_and_read(cmd, vg_name, NULL, LCK_VG_WRITE,
CLUSTERED | EXPORTED_VG | LVM_WRITE,
CORRECT_INCONSISTENT)))
return ECMD_FAILED;
--- LVM2/tools/lvresize.c 2007/11/14 00:08:25 1.88
+++ LVM2/tools/lvresize.c 2007/11/15 02:20:03 1.89
@@ -254,9 +254,9 @@
return 1;
}
-static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
+static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
+ struct lvresize_params *lp)
{
- struct volume_group *vg;
struct logical_volume *lv;
struct lvinfo info;
uint32_t stripesize_extents = 0;
@@ -268,7 +268,6 @@
alloc_policy_t alloc;
struct logical_volume *lock_lv;
struct lv_list *lvl;
- int consistent = 1;
struct lv_segment *seg;
uint32_t seg_extents;
uint32_t sz, str;
@@ -276,14 +275,6 @@
char size_buf[SIZE_BUF];
char lv_path[PATH_MAX];
- if (!(vg = vg_read(cmd, lp->vg_name, NULL, &consistent))) {
- log_error("Volume group %s doesn't exist", lp->vg_name);
- return ECMD_FAILED;
- }
-
- if (!vg_check_status(vg, CLUSTERED | EXPORTED_VG | LVM_WRITE))
- return ECMD_FAILED;
-
/* does LV exist? */
if (!(lvl = find_lv_in_vg(vg, lp->lv_name))) {
log_error("Logical volume %s not found in volume group %s",
@@ -649,6 +640,7 @@
int lvresize(struct cmd_context *cmd, int argc, char **argv)
{
struct lvresize_params lp;
+ struct volume_group *vg;
int r;
memset(&lp, 0, sizeof(lp));
@@ -657,12 +649,14 @@
return EINVALID_CMD_LINE;
log_verbose("Finding volume group %s", lp.vg_name);
- if (!lock_vol(cmd, lp.vg_name, LCK_VG_WRITE)) {
- log_error("Can't get lock for %s", lp.vg_name);
+ if (!(vg = vg_lock_and_read(cmd, lp.vg_name, NULL, LCK_VG_WRITE,
+ CLUSTERED | EXPORTED_VG | LVM_WRITE,
+ CORRECT_INCONSISTENT))) {
+ log_error("Volume group %s doesn't exist", lp.vg_name);
return ECMD_FAILED;
}
- if (!(r = _lvresize(cmd, &lp)))
+ if (!(r = _lvresize(cmd, vg, &lp)))
stack;
unlock_vg(cmd, lp.vg_name);
--- LVM2/tools/pvchange.c 2007/11/02 20:40:04 1.55
+++ LVM2/tools/pvchange.c 2007/11/15 02:20:03 1.56
@@ -32,7 +32,6 @@
const char *orig_vg_name;
char uuid[64] __attribute((aligned(8)));
- int consistent = 1;
int allocatable = 0;
int tagarg = 0;
@@ -54,27 +53,14 @@
/* If in a VG, must change using volume group. */
/* FIXME: handle PVs with no MDAs */
if (!is_orphan(pv)) {
- log_verbose("Finding volume group of physical volume \"%s\"",
- pv_name);
-
vg_name = pv_vg_name(pv);
- if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) {
- log_error("Can't get lock for %s", vg_name);
- return 0;
- }
-
- if (!(vg = vg_read(cmd, vg_name, NULL, &consistent))) {
- unlock_vg(cmd, vg_name);
- log_error("Unable to find volume group of \"%s\"",
- pv_name);
- return 0;
- }
- if (!vg_check_status(vg,
- CLUSTERED | EXPORTED_VG | LVM_WRITE)) {
- unlock_vg(cmd, vg_name);
- return 0;
- }
+ log_verbose("Finding volume group %s of physical volume %s",
+ vg_name, pv_name);
+ if (!(vg = vg_lock_and_read(cmd, vg_name, NULL, LCK_VG_WRITE,
+ CLUSTERED | EXPORTED_VG | LVM_WRITE,
+ CORRECT_INCONSISTENT)))
+ return_0;
if (!(pvl = find_pv_in_vg(vg, pv_name))) {
unlock_vg(cmd, vg_name);
--- LVM2/tools/pvdisplay.c 2007/11/14 18:41:05 1.42
+++ LVM2/tools/pvdisplay.c 2007/11/15 02:20:03 1.43
@@ -20,7 +20,6 @@
struct physical_volume *pv, void *handle)
{
struct pv_list *pvl;
- int consistent = 0;
int ret = ECMD_PROCESSED;
uint64_t size;
@@ -29,21 +28,12 @@
if (!is_orphan(pv) && !vg) {
vg_name = pv_vg_name(pv);
- if (!lock_vol(cmd, vg_name, LCK_VG_READ)) {
- log_error("Can't lock %s: skipping", vg_name);
+ if (!(vg = vg_lock_and_read(cmd, vg_name, (char *)&pv->vgid,
+ LCK_VG_READ, CLUSTERED, 0))) {
+ log_error("Skipping volume group %s", vg_name);
return ECMD_FAILED;
}
- if (!(vg = vg_read(cmd, vg_name, (char *)&pv->vgid, &consistent))) {
- log_error("Can't read %s: skipping", vg_name);
- goto out;
- }
-
- if (!vg_check_status(vg, CLUSTERED)) {
- ret = ECMD_FAILED;
- goto out;
- }
-
/*
* Replace possibly incomplete PV structure with new one
* allocated in vg_read() path.
--- LVM2/tools/pvmove.c 2007/10/11 19:20:38 1.42
+++ LVM2/tools/pvmove.c 2007/11/15 02:20:03 1.43
@@ -54,7 +54,7 @@
dev_close_all();
- if (!(vg = vg_lock_and_read(cmd, vgname, LCK_VG_WRITE,
+ if (!(vg = vg_lock_and_read(cmd, vgname, NULL, LCK_VG_WRITE,
CLUSTERED | EXPORTED_VG | LVM_WRITE,
CORRECT_INCONSISTENT | FAIL_INCONSISTENT)))
return NULL;
--- LVM2/tools/reporter.c 2007/11/14 18:41:05 1.29
+++ LVM2/tools/reporter.c 2007/11/15 02:20:03 1.30
@@ -86,28 +86,18 @@
struct physical_volume *pv, void *handle)
{
struct pv_list *pvl;
- int consistent = 0;
int ret = ECMD_PROCESSED;
const char *vg_name = NULL;
if (!is_orphan(pv) && !vg) {
vg_name = pv_vg_name(pv);
- if (!lock_vol(cmd, vg_name, LCK_VG_READ)) {
- log_error("Can't lock %s: skipping", vg_name);
+ if (!(vg = vg_lock_and_read(cmd, vg_name, (char *)&pv->vgid,
+ LCK_VG_READ, CLUSTERED, 0))) {
+ log_error("Skipping volume group %s", vg_name);
return ECMD_FAILED;
}
- if (!(vg = vg_read(cmd, vg_name, (char *)&pv->vgid, &consistent))) {
- log_error("Can't read %s: skipping", vg_name);
- goto out;
- }
-
- if (!vg_check_status(vg, CLUSTERED)) {
- ret = ECMD_FAILED;
- goto out;
- }
-
/*
* Replace possibly incomplete PV structure with new one
* allocated in vg_read() path.
--- LVM2/tools/toollib.c 2007/11/14 18:41:05 1.115
+++ LVM2/tools/toollib.c 2007/11/15 02:20:03 1.116
@@ -427,23 +427,14 @@
const char *vg_name = NULL;
int ret_max = 0;
int ret;
- int consistent = 0;
if (!vg) {
vg_name = pv_vg_name(pv);
- if (!lock_vol(cmd, vg_name, LCK_VG_READ)) {
- log_error("Can't lock %s: skipping", vg_name);
- return ECMD_FAILED;
- }
- if (!(vg = vg_read(cmd, vg_name, NULL, &consistent))) {
- log_error("Can't read %s: skipping", vg_name);
- goto out;
- }
-
- if (!vg_check_status(vg, CLUSTERED)) {
- ret = ECMD_FAILED;
- goto out;
+ if (!(vg = vg_lock_and_read(cmd, vg_name, NULL, LCK_VG_READ,
+ CLUSTERED, 0))) {
+ log_error("Skipping volume group %s", vg_name);
+ return ECMD_FAILED;
}
}
--- LVM2/tools/vgextend.c 2007/11/02 20:40:05 1.35
+++ LVM2/tools/vgextend.c 2007/11/15 02:20:03 1.36
@@ -41,7 +41,7 @@
}
log_verbose("Checking for volume group \"%s\"", vg_name);
- if (!(vg = vg_lock_and_read(cmd, vg_name, LCK_VG_WRITE | LCK_NONBLOCK,
+ if (!(vg = vg_lock_and_read(cmd, vg_name, NULL, LCK_VG_WRITE | LCK_NONBLOCK,
CLUSTERED | EXPORTED_VG |
LVM_WRITE | RESIZEABLE_VG,
CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) {
--- LVM2/tools/vgmerge.c 2007/10/12 14:29:32 1.41
+++ LVM2/tools/vgmerge.c 2007/11/15 02:20:03 1.42
@@ -29,13 +29,13 @@
}
log_verbose("Checking for volume group \"%s\"", vg_name_to);
- if (!(vg_to = vg_lock_and_read(cmd, vg_name_to, LCK_VG_WRITE,
+ if (!(vg_to = vg_lock_and_read(cmd, vg_name_to, NULL, LCK_VG_WRITE,
CLUSTERED | EXPORTED_VG | LVM_WRITE,
CORRECT_INCONSISTENT | FAIL_INCONSISTENT)))
return ECMD_FAILED;
log_verbose("Checking for volume group \"%s\"", vg_name_from);
- if (!(vg_from = vg_lock_and_read(cmd, vg_name_from,
+ if (!(vg_from = vg_lock_and_read(cmd, vg_name_from, NULL,
LCK_VG_WRITE | LCK_NONBLOCK,
CLUSTERED | EXPORTED_VG | LVM_WRITE,
CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) {
--- LVM2/tools/vgsplit.c 2007/11/02 20:40:05 1.38
+++ LVM2/tools/vgsplit.c 2007/11/15 02:20:03 1.39
@@ -234,7 +234,7 @@
}
log_verbose("Checking for volume group \"%s\"", vg_name_from);
- if (!(vg_from = vg_lock_and_read(cmd, vg_name_from, LCK_VG_WRITE,
+ if (!(vg_from = vg_lock_and_read(cmd, vg_name_from, NULL, LCK_VG_WRITE,
CLUSTERED | EXPORTED_VG |
RESIZEABLE_VG | LVM_WRITE,
CORRECT_INCONSISTENT | FAIL_INCONSISTENT)))
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2007-10-12 14:08 wysochanski
0 siblings, 0 replies; 31+ messages in thread
From: wysochanski @ 2007-10-12 14:08 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski@sourceware.org 2007-10-12 14:08:10
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c metadata.h
Log message:
Accessor functions for PV will not modify the given PV.
So we can add 'const' to it.
Patch by Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.718&r2=1.719
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.136&r2=1.137
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.171&r2=1.172
--- LVM2/WHATS_NEW 2007/10/10 11:31:21 1.718
+++ LVM2/WHATS_NEW 2007/10/12 14:08:10 1.719
@@ -1,5 +1,7 @@
Version 2.02.29 -
==================================
+ Add const attributes to pv accessor functions.
+ Refactor vg_add_snapshot and lv_create_empty.
Handle new sysfs subsystem/block/devices directory structure.
Tests are run with LVM_SYSTEM_DIR pointing to private root and /dev dirs.
Fix a bug in lvm_dump.sh checks for lvm/dmsetup binaries.
--- LVM2/lib/metadata/metadata-exported.h 2007/10/11 19:20:38 1.18
+++ LVM2/lib/metadata/metadata-exported.h 2007/10/12 14:08:10 1.19
@@ -468,15 +468,15 @@
/*
* Begin skeleton for external LVM library
*/
-struct device *pv_dev(pv_t *pv);
-const char *pv_vg_name(pv_t *pv);
-uint64_t pv_size(pv_t *pv);
-uint32_t pv_status(pv_t *pv);
-uint32_t pv_pe_size(pv_t *pv);
-uint64_t pv_pe_start(pv_t *pv);
-uint32_t pv_pe_count(pv_t *pv);
-uint32_t pv_pe_alloc_count(pv_t *pv);
+struct device *pv_dev(const pv_t *pv);
+const char *pv_vg_name(const pv_t *pv);
+uint64_t pv_size(const pv_t *pv);
+uint32_t pv_status(const pv_t *pv);
+uint32_t pv_pe_size(const pv_t *pv);
+uint64_t pv_pe_start(const pv_t *pv);
+uint32_t pv_pe_count(const pv_t *pv);
+uint32_t pv_pe_alloc_count(const pv_t *pv);
-uint32_t vg_status(vg_t *vg);
+uint32_t vg_status(const vg_t *vg);
#endif
--- LVM2/lib/metadata/metadata.c 2007/09/17 16:02:46 1.136
+++ LVM2/lib/metadata/metadata.c 2007/10/12 14:08:10 1.137
@@ -1927,62 +1927,62 @@
/*
* Gets/Sets for external LVM library
*/
-struct id pv_id(pv_t *pv)
+struct id pv_id(const pv_t *pv)
{
return pv_field(pv, id);
}
-const struct format_type *pv_format_type(pv_t *pv)
+const struct format_type *pv_format_type(const pv_t *pv)
{
return pv_field(pv, fmt);
}
-struct id pv_vgid(pv_t *pv)
+struct id pv_vgid(const pv_t *pv)
{
return pv_field(pv, vgid);
}
-struct device *pv_dev(pv_t *pv)
+struct device *pv_dev(const pv_t *pv)
{
return pv_field(pv, dev);
}
-const char *pv_vg_name(pv_t *pv)
+const char *pv_vg_name(const pv_t *pv)
{
return pv_field(pv, vg_name);
}
-uint64_t pv_size(pv_t *pv)
+uint64_t pv_size(const pv_t *pv)
{
return pv_field(pv, size);
}
-uint32_t pv_status(pv_t *pv)
+uint32_t pv_status(const pv_t *pv)
{
return pv_field(pv, status);
}
-uint32_t pv_pe_size(pv_t *pv)
+uint32_t pv_pe_size(const pv_t *pv)
{
return pv_field(pv, pe_size);
}
-uint64_t pv_pe_start(pv_t *pv)
+uint64_t pv_pe_start(const pv_t *pv)
{
return pv_field(pv, pe_start);
}
-uint32_t pv_pe_count(pv_t *pv)
+uint32_t pv_pe_count(const pv_t *pv)
{
return pv_field(pv, pe_count);
}
-uint32_t pv_pe_alloc_count(pv_t *pv)
+uint32_t pv_pe_alloc_count(const pv_t *pv)
{
return pv_field(pv, pe_alloc_count);
}
-uint32_t vg_status(vg_t *vg)
+uint32_t vg_status(const vg_t *vg)
{
return vg->status;
}
--- LVM2/lib/metadata/metadata.h 2007/08/20 20:55:26 1.171
+++ LVM2/lib/metadata/metadata.h 2007/10/12 14:08:10 1.172
@@ -304,9 +304,9 @@
/*
* Begin skeleton for external LVM library
*/
-struct id pv_id(pv_t *pv);
-const struct format_type *pv_format_type(pv_t *pv);
-struct id pv_vgid(pv_t *pv);
+struct id pv_id(const pv_t *pv);
+const struct format_type *pv_format_type(const pv_t *pv);
+struct id pv_vgid(const pv_t *pv);
pv_t *pv_by_path(struct cmd_context *cmd, const char *pv_name);
int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2007-09-20 21:39 wysochanski
0 siblings, 0 replies; 31+ messages in thread
From: wysochanski @ 2007-09-20 21:39 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski@sourceware.org 2007-09-20 21:39:08
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h pv_manip.c
lib/misc : util.h
man : lvcreate.8 lvextend.8 lvresize.8
tools : commands.h lvcreate.c lvmcmdline.c lvresize.c
tools.h
Log message:
Add %PVS extents option to lvresize, lvextend, and lvcreate.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.710&r2=1.711
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/pv_manip.c.diff?cvsroot=lvm2&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/util.h.diff?cvsroot=lvm2&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvcreate.8.diff?cvsroot=lvm2&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvextend.8.diff?cvsroot=lvm2&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvresize.8.diff?cvsroot=lvm2&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.102&r2=1.103
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.145&r2=1.146
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.48&r2=1.49
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.82&r2=1.83
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/tools.h.diff?cvsroot=lvm2&r1=1.57&r2=1.58
--- LVM2/WHATS_NEW 2007/09/17 19:51:02 1.710
+++ LVM2/WHATS_NEW 2007/09/20 21:39:07 1.711
@@ -1,5 +1,6 @@
Version 2.02.29 -
==================================
+ Add %PVS extents option to lvresize, lvextend, and lvcreate.
Moved the obsolete test subdirectory to old-tests.
Remove no-longer-correct restrictions on PV arg count with stripes/mirrors.
Fix strdup memory leak in str_list_dup().
--- LVM2/lib/metadata/metadata-exported.h 2007/08/30 20:30:41 1.14
+++ LVM2/lib/metadata/metadata-exported.h 2007/09/20 21:39:07 1.15
@@ -329,6 +329,9 @@
int pv_analyze(struct cmd_context *cmd, const char *pv_name,
uint64_t label_sector);
+/* FIXME: move internal to library */
+uint32_t pv_list_extents_free(struct list *pvh);
+
struct volume_group *vg_create(struct cmd_context *cmd, const char *name,
uint32_t extent_size, uint32_t max_pv,
uint32_t max_lv, alloc_policy_t alloc,
--- LVM2/lib/metadata/pv_manip.c 2007/08/30 20:30:41 1.12
+++ LVM2/lib/metadata/pv_manip.c 2007/09/20 21:39:07 1.13
@@ -215,6 +215,46 @@
}
/*
+ * Calculate the overlap, in extents, between a struct pv_segment and
+ * a struct pe_range.
+ */
+static uint32_t _overlap_pe(struct pv_segment *pvseg,
+ struct pe_range *per)
+{
+ uint32_t start;
+ uint32_t end;
+
+ start = max(pvseg->pe, per->start);
+ end = min(pvseg->pe + pvseg->len, per->start + per->count);
+ if (end < start)
+ return 0;
+ else
+ return end - start;
+}
+
+/*
+ * Returns: number of free PEs in a struct pv_list
+ */
+uint32_t pv_list_extents_free(struct list *pvh)
+{
+ struct pv_list *pvl;
+ struct pe_range *per;
+ uint32_t extents = 0;
+ struct pv_segment *pvseg;
+
+ list_iterate_items(pvl, pvh) {
+ list_iterate_items(per, pvl->pe_ranges) {
+ list_iterate_items(pvseg, &pvl->pv->segments) {
+ if (!pvseg->lvseg) /* free space */
+ extents += _overlap_pe(pvseg, per);
+ }
+ }
+ }
+
+ return extents;
+}
+
+/*
* Check all pv_segments in VG for consistency
*/
int check_pv_segments(struct volume_group *vg)
--- LVM2/lib/misc/util.h 2007/08/20 20:55:27 1.2
+++ LVM2/lib/misc/util.h 2007/09/20 21:39:07 1.3
@@ -15,6 +15,16 @@
#ifndef _LVM_UTIL_H
#define _LVM_UTIL_H
+#define min(a, b) ({ typeof(a) _a = (a); \
+ typeof(b) _b = (b); \
+ (void) (&_a == &_b); \
+ _a < _b ? _a : _b; })
+
+#define max(a, b) ({ typeof(a) _a = (a); \
+ typeof(b) _b = (b); \
+ (void) (&_a == &_b); \
+ _a > _b ? _a : _b; })
+
char *last_path_component(char const *name);
#endif
--- LVM2/man/lvcreate.8 2007/08/30 19:34:19 1.18
+++ LVM2/man/lvcreate.8 2007/09/20 21:39:08 1.19
@@ -8,7 +8,7 @@
[\-A/\-\-autobackup y/n] [\-C/\-\-contiguous y/n] [\-d/\-\-debug]
[\-h/\-?/\-\-help]
[\-i/\-\-stripes Stripes [\-I/\-\-stripesize StripeSize]]
-{\-l/\-\-extents LogicalExtentsNumber[%{VG|FREE}] |
+{\-l/\-\-extents LogicalExtentsNumber[%{VG|PVS|FREE}] |
\-L/\-\-size LogicalVolumeSize[kKmMgGtT]}
[\-M/\-\-persistent y/n] [\-\-minor minor]
[\-m/\-\-mirrors Mirrors [\-\-nosync] [\-\-mirrorlog {disk|log}] [\-\-corelog]
@@ -63,12 +63,14 @@
For metadata in LVM2 format, the stripe size may be a larger
power of 2 but must not exceed the physical extent size.
.TP
-.I \-l, \-\-extents LogicalExtentsNumber[%{VG|FREE}]
+.I \-l, \-\-extents LogicalExtentsNumber[%{VG|PVS|FREE}]
Gives the number of logical extents to allocate for the new
logical volume.
This can also be expressed as a percentage of the total space
-in the Volume Group with the suffix %VG or of the remaining free space
-with the suffix %FREE.
+in the Volume Group with the suffix %VG, of the remaining
+free space in the Volume Group with the suffix %FREE, or
+of the remaining free space for the specified PhysicalVolume(s)
+with the suffix %PVS,
.TP
.I \-L, \-\-size LogicalVolumeSize[kKmMgGtTpPeE]
Gives the size to allocate for the new logical volume.
--- LVM2/man/lvextend.8 2007/01/09 21:12:41 1.9
+++ LVM2/man/lvextend.8 2007/09/20 21:39:08 1.10
@@ -6,7 +6,7 @@
[\-\-alloc AllocationPolicy]
[\-A/\-\-autobackup y/n] [\-d/\-\-debug] [\-h/\-?/\-\-help]
[\-i/\-\-stripes Stripes [\-I/\-\-stripesize StripeSize]]
-{\-l/\-\-extents [+]LogicalExtentsNumber[%{VG|LV|FREE}] |
+{\-l/\-\-extents [+]LogicalExtentsNumber[%{VG|LV|PVS|FREE}] |
\-L/\-\-size [+]LogicalVolumeSize[kKmMgGtT]}
[\-t/\-\-test]
[\-v/\-\-verbose] LogicalVolumePath [PhysicalVolumePath...]
@@ -21,14 +21,16 @@
.SH OPTIONS
See \fBlvm\fP for common options.
.TP
-.I \-l, \-\-extents [+]LogicalExtentsNumber[%{VG|LV|FREE}]
+.I \-l, \-\-extents [+]LogicalExtentsNumber[%{VG|LV|PVS|FREE}]
Extend or set the logical volume size in units of logical extents.
With the + sign the value is added to the actual size
of the logical volume and without it, the value is taken as an absolute one.
The number can also be expressed as a percentage of the total space
-in the Volume Group with the suffix %VG or relative to the existing
-size of the Logical Volume with the suffix %LV or as a percentage of the remaining
-free space in the Volume Group with the suffix %FREE.
+in the Volume Group with the suffix %VG, relative to the existing
+size of the Logical Volume with the suffix %LV, of the remaining
+free space for the specified PhysicalVolume(s) with the suffix %PVS,
+or as a percentage of the remaining free space in the Volume Group
+with the suffix %FREE.
.TP
.I \-L, \-\-size [+]LogicalVolumeSize[kKmMgGtTpPeE]
Extend or set the logical volume size in units of megabytes.
@@ -54,6 +56,10 @@
that logical volume by 54MB on physical volume /dev/sdk3.
This is only possible if /dev/sdk3 is a member of volume group vg01 and
there are enough free physical extents in it.
+
+"lvextend /dev/vg01/lvol01 /dev/sdk3" tries to extend the size of that
+logical volume by the amount of free space on physical volume /dev/sdk3.
+This is equivalent to specifying "-l +100%PVS" on the command line.
.SH SEE ALSO
.BR lvm (8),
.BR lvcreate (8),
--- LVM2/man/lvresize.8 2006/11/10 18:24:11 1.5
+++ LVM2/man/lvresize.8 2007/09/20 21:39:08 1.6
@@ -6,7 +6,7 @@
[\-\-alloc AllocationPolicy]
[\-A/\-\-autobackup y/n] [\-d/\-\-debug] [\-h/\-?/\-\-help]
[\-i/\-\-stripes Stripes [\-I/\-\-stripesize StripeSize]]
-{\-l/\-\-extents [+]LogicalExtentsNumber[%{VG|LV|FREE}] |
+{\-l/\-\-extents [+]LogicalExtentsNumber[%{VG|LV|PVS|FREE}] |
\-L/\-\-size [+]LogicalVolumeSize[kKmMgGtT]}
[\-t/\-\-test]
[\-v/\-\-verbose] LogicalVolumePath [PhysicalVolumePath...]
@@ -25,14 +25,16 @@
.SH OPTIONS
See \fBlvm\fP for common options.
.TP
-.I \-l, \-\-extents [+/-]LogicalExtentsNumber[%{VG|LV|FREE}]
+.I \-l, \-\-extents [+/-]LogicalExtentsNumber[%{VG|LV|PVS|FREE}]
Change or set the logical volume size in units of logical extents.
With the + or - sign the value is added to or subtracted from the actual size
of the logical volume and without it, the value is taken as an absolute one.
The number can also be expressed as a percentage of the total space
-in the Volume Group with the suffix %VG or relative to the existing
-size of the Logical Volume with the suffix %LV or as a percentage of the remaining
-free space in the Volume Group with the suffix %FREE.
+in the Volume Group with the suffix %VG, relative to the existing
+size of the Logical Volume with the suffix %LV, as a percentage of
+the remaining free space of the PhysicalVolumes on the command line with the
+suffix %PVS, or as a percentage of the remaining free space in the
+Volume Group with the suffix %FREE.
.TP
.I \-L, \-\-size [+/-]LogicalVolumeSize[kKmMgGtTpPeE]
Change or set the logical volume size in units of megabytes.
--- LVM2/tools/commands.h 2007/08/28 16:14:49 1.102
+++ LVM2/tools/commands.h 2007/09/20 21:39:08 1.103
@@ -144,7 +144,7 @@
"\t[-d|--debug]\n"
"\t[-h|-?|--help]\n"
"\t[-i|--stripes Stripes [-I|--stripesize StripeSize]]\n"
- "\t{-l|--extents LogicalExtentsNumber[%{VG|LV|FREE}] |\n"
+ "\t{-l|--extents LogicalExtentsNumber[%{VG|LV|PVS|FREE}] |\n"
"\t -L|--size LogicalVolumeSize[kKmMgGtTpPeE]}\n"
"\t[-M|--persistent {y|n}] [--major major] [--minor minor]\n"
"\t[-n|--name LogicalVolumeName]\n"
@@ -209,7 +209,7 @@
"\t[-d|--debug]\n"
"\t[-h|--help]\n"
"\t[-i|--stripes Stripes [-I|--stripesize StripeSize]]\n"
- "\t{-l|--extents [+]LogicalExtentsNumber[%{VG|FREE}] |\n"
+ "\t{-l|--extents [+]LogicalExtentsNumber[%{VG|PVS|FREE}] |\n"
"\t -L|--size [+]LogicalVolumeSize[kKmMgGtTpPeE]}\n"
"\t[-m|--mirrors Mirrors]\n"
"\t[-n|--nofsck]\n"
@@ -323,7 +323,7 @@
"\t[-d|--debug]\n"
"\t[-h|--help]\n"
"\t[-i|--stripes Stripes [-I|--stripesize StripeSize]]\n"
- "\t{-l|--extents [+|-]LogicalExtentsNumber[%{VG|LV|FREE}] |\n"
+ "\t{-l|--extents [+|-]LogicalExtentsNumber[%{VG|LV|PVS|FREE}] |\n"
"\t -L|--size [+|-]LogicalVolumeSize[kKmMgGtTpPeE]}\n"
"\t[-n|--nofsck]\n"
"\t[-r|--resizefs]\n"
--- LVM2/tools/lvcreate.c 2007/09/17 17:18:37 1.145
+++ LVM2/tools/lvcreate.c 2007/09/20 21:39:08 1.146
@@ -490,6 +490,7 @@
char lv_name_buf[128];
const char *lv_name;
struct lvinfo info;
+ uint32_t pv_extent_count;
status |= lp->permission | VISIBLE_LV;
@@ -574,8 +575,18 @@
case PERCENT_FREE:
lp->extents = lp->extents * vg->free_count / 100;
break;
+ case PERCENT_PVS:
+ if (!lp->pv_count) {
+ log_error("Please specify physical volume(s) "
+ "with %%PVS");
+ return 0;
+ }
+ pv_extent_count = pv_list_extents_free(pvh);
+ lp->extents = lp->extents * pv_extent_count / 100;
+ break;
case PERCENT_LV:
- log_error("Please express size as %%VG or %%FREE.");
+ log_error("Please express size as %%VG, %%PVS, or "
+ "%%FREE.");
return 0;
case PERCENT_NONE:
break;
--- LVM2/tools/lvmcmdline.c 2007/08/21 19:46:36 1.48
+++ LVM2/tools/lvmcmdline.c 2007/09/20 21:39:08 1.49
@@ -269,6 +269,9 @@
a->percent = PERCENT_VG;
else if (!strcasecmp(ptr, "L") || !strcasecmp(ptr, "LV"))
a->percent = PERCENT_LV;
+ else if (!strcasecmp(ptr, "P") || !strcasecmp(ptr, "PV") ||
+ !strcasecmp(ptr, "PVS"))
+ a->percent = PERCENT_PVS;
else if (!strcasecmp(ptr, "F") || !strcasecmp(ptr, "FR") ||
!strcasecmp(ptr, "FREE"))
a->percent = PERCENT_FREE;
--- LVM2/tools/lvresize.c 2007/09/06 22:35:01 1.82
+++ LVM2/tools/lvresize.c 2007/09/20 21:39:08 1.83
@@ -182,8 +182,20 @@
if (!strcmp(cmd_name, "lvextend"))
lp->resize = LV_EXTEND;
- if (arg_count(cmd, extents_ARG) + arg_count(cmd, size_ARG) != 1) {
- log_error("Please specify either size or extents (not both)");
+ /*
+ * Allow omission of extents and size if the user has given us
+ * one or more PVs. Most likely, the intent was "resize this
+ * LV the best you can with these PVs"
+ */
+ if ((arg_count(cmd, extents_ARG) + arg_count(cmd, size_ARG) == 0) &&
+ (argc >= 2)) {
+ lp->extents = 100;
+ lp->percent = PERCENT_PVS;
+ lp->sign = SIGN_PLUS;
+ } else if ((arg_count(cmd, extents_ARG) +
+ arg_count(cmd, size_ARG) != 1)) {
+ log_error("Please specify either size or extents but not "
+ "both.");
return 0;
}
@@ -246,6 +258,7 @@
uint32_t seg_mirrors = 0;
uint32_t extents_used = 0;
uint32_t size_rest;
+ uint32_t pv_extent_count = 0;
alloc_policy_t alloc;
struct logical_volume *lock_lv;
struct lv_list *lvl;
@@ -319,6 +332,12 @@
lp->extents = lp->size / vg->extent_size;
}
+ if (!(pvh = lp->argc ? create_pv_list(cmd->mem, vg, lp->argc,
+ lp->argv, 1) : &vg->pvs)) {
+ stack;
+ return ECMD_FAILED;
+ }
+
switch(lp->percent) {
case PERCENT_VG:
lp->extents = lp->extents * vg->extent_count / 100;
@@ -329,6 +348,10 @@
case PERCENT_LV:
lp->extents = lp->extents * lv->le_count / 100;
break;
+ case PERCENT_PVS:
+ pv_extent_count = pv_list_extents_free(pvh);
+ lp->extents = lp->extents * pv_extent_count / 100;
+ break;
case PERCENT_NONE:
break;
}
@@ -539,10 +562,6 @@
if (lp->resize == LV_REDUCE) {
if (lp->argc)
log_warn("Ignoring PVs on command line when reducing");
- } else if (!(pvh = lp->argc ? create_pv_list(cmd->mem, vg, lp->argc,
- lp->argv, 1) : &vg->pvs)) {
- stack;
- return ECMD_FAILED;
}
if (lp->resize == LV_REDUCE || lp->resizefs) {
--- LVM2/tools/tools.h 2007/08/21 19:46:36 1.57
+++ LVM2/tools/tools.h 2007/09/20 21:39:08 1.58
@@ -83,7 +83,8 @@
PERCENT_NONE = 0,
PERCENT_VG,
PERCENT_FREE,
- PERCENT_LV
+ PERCENT_LV,
+ PERCENT_PVS
} percent_t;
enum {
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2007-08-30 20:30 wysochanski
0 siblings, 0 replies; 31+ messages in thread
From: wysochanski @ 2007-08-30 20:30 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski@sourceware.org 2007-08-30 20:30:41
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h pv_manip.c
tools : pvresize.c
Log message:
move guts of pvresize into library
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.700&r2=1.701
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/pv_manip.c.diff?cvsroot=lvm2&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvresize.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15
--- LVM2/WHATS_NEW 2007/08/30 19:34:18 1.700
+++ LVM2/WHATS_NEW 2007/08/30 20:30:41 1.701
@@ -1,5 +1,6 @@
Version 2.02.29 -
==================================
+ Move guts of pvresize into library.
Avoid error when --corelog is provided without --mirrorlog. (2.02.28)
Correct --mirrorlog argument name in man pages (not --log).
Clear MIRROR_NOTSYNCED LV flag when converting from mirror to linear.
--- LVM2/lib/metadata/metadata-exported.h 2007/08/22 14:38:17 1.13
+++ LVM2/lib/metadata/metadata-exported.h 2007/08/30 20:30:41 1.14
@@ -322,6 +322,10 @@
uint64_t pvmetadatasize, struct list *mdas);
int pv_resize(struct physical_volume *pv, struct volume_group *vg,
uint32_t new_pe_count);
+int pv_resize_single(struct cmd_context *cmd,
+ struct volume_group *vg,
+ struct physical_volume *pv,
+ uint64_t new_size);
int pv_analyze(struct cmd_context *cmd, const char *pv_name,
uint64_t label_sector);
--- LVM2/lib/metadata/pv_manip.c 2007/08/20 20:55:26 1.11
+++ LVM2/lib/metadata/pv_manip.c 2007/08/30 20:30:41 1.12
@@ -17,6 +17,9 @@
#include "metadata.h"
#include "pv_alloc.h"
#include "toolcontext.h"
+#include "archiver.h"
+#include "locking.h"
+#include "lvmcache.h"
static struct pv_segment *_alloc_pv_segment(struct dm_pool *mem,
struct physical_volume *pv,
@@ -396,3 +399,158 @@
else
return _reduce_pv(pv, vg, new_pe_count);
}
+
+int pv_resize_single(struct cmd_context *cmd,
+ struct volume_group *vg,
+ struct physical_volume *pv,
+ uint64_t new_size)
+{
+ struct pv_list *pvl;
+ int consistent = 1;
+ uint64_t size = 0;
+ uint32_t new_pe_count = 0;
+ struct list mdas;
+ const char *pv_name = dev_name(pv_dev(pv));
+ const char *vg_name;
+
+ list_init(&mdas);
+
+ if (!*pv_vg_name(pv)) {
+ vg_name = ORPHAN;
+
+ if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) {
+ log_error("Can't get lock for orphans");
+ return 0;
+ }
+
+ if (!(pv = pv_read(cmd, pv_name, &mdas, NULL, 1))) {
+ unlock_vg(cmd, vg_name);
+ log_error("Unable to read PV \"%s\"", pv_name);
+ return 0;
+ }
+
+ /* FIXME Create function to test compatibility properly */
+ if (list_size(&mdas) > 1) {
+ log_error("%s: too many metadata areas for pvresize",
+ pv_name);
+ unlock_vg(cmd, vg_name);
+ return 0;
+ }
+ } else {
+ vg_name = pv_vg_name(pv);
+
+ if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) {
+ log_error("Can't get lock for %s", pv_vg_name(pv));
+ return 0;
+ }
+
+ if (!(vg = vg_read(cmd, vg_name, NULL, &consistent))) {
+ unlock_vg(cmd, vg_name);
+ log_error("Unable to find volume group of \"%s\"",
+ pv_name);
+ return 0;
+ }
+
+ if (!vg_check_status(vg, CLUSTERED | EXPORTED_VG | LVM_WRITE)) {
+ unlock_vg(cmd, vg_name);
+ return 0;
+ }
+
+ if (!(pvl = find_pv_in_vg(vg, pv_name))) {
+ unlock_vg(cmd, vg_name);
+ log_error("Unable to find \"%s\" in volume group \"%s\"",
+ pv_name, vg->name);
+ return 0;
+ }
+
+ pv = pvl->pv;
+
+ if (!archive(vg))
+ return 0;
+ }
+
+ if (!(pv->fmt->features & FMT_RESIZE_PV)) {
+ log_error("Physical volume %s format does not support resizing.",
+ pv_name);
+ unlock_vg(cmd, vg_name);
+ return 0;
+ }
+
+ /* Get new size */
+ if (!dev_get_size(pv_dev(pv), &size)) {
+ log_error("%s: Couldn't get size.", pv_name);
+ unlock_vg(cmd, vg_name);
+ return 0;
+ }
+
+ if (new_size) {
+ if (new_size > size)
+ log_warn("WARNING: %s: Overriding real size. "
+ "You could lose data.", pv_name);
+ log_verbose("%s: Pretending size is %" PRIu64 " not %" PRIu64
+ " sectors.", pv_name, new_size, pv_size(pv));
+ size = new_size;
+ }
+
+ if (size < PV_MIN_SIZE) {
+ log_error("%s: Size must exceed minimum of %ld sectors.",
+ pv_name, PV_MIN_SIZE);
+ unlock_vg(cmd, vg_name);
+ return 0;
+ }
+
+ if (size < pv_pe_start(pv)) {
+ log_error("%s: Size must exceed physical extent start of "
+ "%" PRIu64 " sectors.", pv_name, pv_pe_start(pv));
+ unlock_vg(cmd, vg_name);
+ return 0;
+ }
+
+ pv->size = size;
+
+ if (vg) {
+ pv->size -= pv_pe_start(pv);
+ new_pe_count = pv_size(pv) / vg->extent_size;
+
+ if (!new_pe_count) {
+ log_error("%s: Size must leave space for at "
+ "least one physical extent of "
+ "%" PRIu32 " sectors.", pv_name,
+ pv_pe_size(pv));
+ unlock_vg(cmd, vg_name);
+ return 0;
+ }
+
+ if (!pv_resize(pv, vg, new_pe_count)) {
+ stack;
+ unlock_vg(cmd, vg_name);
+ return 0;
+ }
+ }
+
+ log_verbose("Resizing volume \"%s\" to %" PRIu64 " sectors.",
+ pv_name, pv_size(pv));
+
+ log_verbose("Updating physical volume \"%s\"", pv_name);
+ if (*pv_vg_name(pv)) {
+ if (!vg_write(vg) || !vg_commit(vg)) {
+ unlock_vg(cmd, pv_vg_name(pv));
+ log_error("Failed to store physical volume \"%s\" in "
+ "volume group \"%s\"", pv_name, vg->name);
+ return 0;
+ }
+ backup(vg);
+ unlock_vg(cmd, vg_name);
+ } else {
+ if (!(pv_write(cmd, pv, NULL, INT64_C(-1)))) {
+ unlock_vg(cmd, ORPHAN);
+ log_error("Failed to store physical volume \"%s\"",
+ pv_name);
+ return 0;
+ }
+ unlock_vg(cmd, vg_name);
+ }
+
+ log_print("Physical volume \"%s\" changed", pv_name);
+ return 1;
+}
--- LVM2/tools/pvresize.c 2007/08/30 20:16:01 1.14
+++ LVM2/tools/pvresize.c 2007/08/30 20:30:41 1.15
@@ -23,162 +23,6 @@
unsigned total;
};
-static int pv_resize_single(struct cmd_context *cmd,
- struct volume_group *vg,
- struct physical_volume *pv,
- uint64_t new_size)
-{
- struct pv_list *pvl;
- int consistent = 1;
- uint64_t size = 0;
- uint32_t new_pe_count = 0;
- struct list mdas;
- const char *pv_name = dev_name(pv_dev(pv));
- const char *vg_name;
-
- list_init(&mdas);
-
- if (!*pv_vg_name(pv)) {
- vg_name = ORPHAN;
-
- if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) {
- log_error("Can't get lock for orphans");
- return 0;
- }
-
- if (!(pv = pv_read(cmd, pv_name, &mdas, NULL, 1))) {
- unlock_vg(cmd, vg_name);
- log_error("Unable to read PV \"%s\"", pv_name);
- return 0;
- }
-
- /* FIXME Create function to test compatibility properly */
- if (list_size(&mdas) > 1) {
- log_error("%s: too many metadata areas for pvresize",
- pv_name);
- unlock_vg(cmd, vg_name);
- return 0;
- }
- } else {
- vg_name = pv_vg_name(pv);
-
- if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) {
- log_error("Can't get lock for %s", pv_vg_name(pv));
- return 0;
- }
-
- if (!(vg = vg_read(cmd, vg_name, NULL, &consistent))) {
- unlock_vg(cmd, vg_name);
- log_error("Unable to find volume group of \"%s\"",
- pv_name);
- return 0;
- }
-
- if (!vg_check_status(vg, CLUSTERED | EXPORTED_VG | LVM_WRITE)) {
- unlock_vg(cmd, vg_name);
- return 0;
- }
-
- if (!(pvl = find_pv_in_vg(vg, pv_name))) {
- unlock_vg(cmd, vg_name);
- log_error("Unable to find \"%s\" in volume group \"%s\"",
- pv_name, vg->name);
- return 0;
- }
-
- pv = pvl->pv;
-
- if (!archive(vg))
- return 0;
- }
-
- if (!(pv->fmt->features & FMT_RESIZE_PV)) {
- log_error("Physical volume %s format does not support resizing.",
- pv_name);
- unlock_vg(cmd, vg_name);
- return 0;
- }
-
- /* Get new size */
- if (!dev_get_size(pv_dev(pv), &size)) {
- log_error("%s: Couldn't get size.", pv_name);
- unlock_vg(cmd, vg_name);
- return 0;
- }
-
- if (new_size) {
- if (new_size > size)
- log_warn("WARNING: %s: Overriding real size. "
- "You could lose data.", pv_name);
- log_verbose("%s: Pretending size is %" PRIu64 " not %" PRIu64
- " sectors.", pv_name, new_size, pv_size(pv));
- size = new_size;
- }
-
- if (size < PV_MIN_SIZE) {
- log_error("%s: Size must exceed minimum of %ld sectors.",
- pv_name, PV_MIN_SIZE);
- unlock_vg(cmd, vg_name);
- return 0;
- }
-
- if (size < pv_pe_start(pv)) {
- log_error("%s: Size must exceed physical extent start of "
- "%" PRIu64 " sectors.", pv_name, pv_pe_start(pv));
- unlock_vg(cmd, vg_name);
- return 0;
- }
-
- pv->size = size;
-
- if (vg) {
- pv->size -= pv_pe_start(pv);
- new_pe_count = pv_size(pv) / vg->extent_size;
-
- if (!new_pe_count) {
- log_error("%s: Size must leave space for at "
- "least one physical extent of "
- "%" PRIu32 " sectors.", pv_name,
- pv_pe_size(pv));
- unlock_vg(cmd, vg_name);
- return 0;
- }
-
- if (!pv_resize(pv, vg, new_pe_count)) {
- stack;
- unlock_vg(cmd, vg_name);
- return 0;
- }
- }
-
- log_verbose("Resizing volume \"%s\" to %" PRIu64 " sectors.",
- pv_name, pv_size(pv));
-
- log_verbose("Updating physical volume \"%s\"", pv_name);
- if (*pv_vg_name(pv)) {
- if (!vg_write(vg) || !vg_commit(vg)) {
- unlock_vg(cmd, pv_vg_name(pv));
- log_error("Failed to store physical volume \"%s\" in "
- "volume group \"%s\"", pv_name, vg->name);
- return 0;
- }
- backup(vg);
- unlock_vg(cmd, vg_name);
- } else {
- if (!(pv_write(cmd, pv, NULL, INT64_C(-1)))) {
- unlock_vg(cmd, ORPHAN);
- log_error("Failed to store physical volume \"%s\"",
- pv_name);
- return 0;
- }
- unlock_vg(cmd, vg_name);
- }
-
- log_print("Physical volume \"%s\" changed", pv_name);
- return 1;
-}
-
-
static int _pvresize_single(struct cmd_context *cmd,
struct volume_group *vg,
struct physical_volume *pv,
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2007-08-21 17:38 wysochanski
0 siblings, 0 replies; 31+ messages in thread
From: wysochanski @ 2007-08-21 17:38 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski@sourceware.org 2007-08-21 17:38:20
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c
tools : vgremove.c
Log message:
Move guts of vgremove into lvm library.
Include archiver.h in metadata.c as a result of prior move.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.686&r2=1.687
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.132&r2=1.133
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgremove.c.diff?cvsroot=lvm2&r1=1.43&r2=1.44
--- LVM2/WHATS_NEW 2007/08/20 20:55:24 1.686
+++ LVM2/WHATS_NEW 2007/08/21 17:37:34 1.687
@@ -1,5 +1,6 @@
Version 2.02.28 -
================================
+ Move guts of vgremove into library.
Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1.
Move guts of lvremove into library.
Allow clvmd debug to be turned on in a running daemon using clvmd -d
--- LVM2/lib/metadata/metadata-exported.h 2007/08/21 16:40:33 1.11
+++ LVM2/lib/metadata/metadata-exported.h 2007/08/21 17:37:53 1.12
@@ -330,6 +330,9 @@
uint32_t max_lv, alloc_policy_t alloc,
int pv_count, char **pv_names);
int vg_remove(struct volume_group *vg);
+int vg_remove_single(struct cmd_context *cmd, const char *vg_name,
+ struct volume_group *vg, int consistent,
+ force_t force);
int vg_rename(struct cmd_context *cmd, struct volume_group *vg,
const char *new_name);
int vg_extend(struct volume_group *vg, int pv_count, char **pv_names);
--- LVM2/lib/metadata/metadata.c 2007/08/20 20:55:26 1.132
+++ LVM2/lib/metadata/metadata.c 2007/08/21 17:38:08 1.133
@@ -25,6 +25,7 @@
#include "activate.h"
#include "display.h"
#include "locking.h"
+#include "archiver.h"
#include <sys/param.h>
@@ -248,6 +249,72 @@
return 1;
}
+int vg_remove_single(struct cmd_context *cmd, const char *vg_name,
+ struct volume_group *vg, int consistent,
+ force_t force)
+{
+ struct physical_volume *pv;
+ struct pv_list *pvl;
+ int ret = 1;
+
+ if (!vg || !consistent || (vg_status(vg) & PARTIAL_VG)) {
+ log_error("Volume group \"%s\" not found or inconsistent.",
+ vg_name);
+ log_error("Consider vgreduce --removemissing if metadata "
+ "is inconsistent.");
+ return 0;
+ }
+
+ if (!vg_check_status(vg, EXPORTED_VG))
+ return 0;
+
+ if (vg->lv_count) {
+ log_error("Volume group \"%s\" still contains %d "
+ "logical volume(s)", vg_name, vg->lv_count);
+ return 0;
+ }
+
+ if (!archive(vg))
+ return 0;
+
+ if (!vg_remove(vg)) {
+ log_error("vg_remove %s failed", vg_name);
+ return 0;
+ }
+
+ /* init physical volumes */
+ list_iterate_items(pvl, &vg->pvs) {
+ pv = pvl->pv;
+ log_verbose("Removing physical volume \"%s\" from "
+ "volume group \"%s\"", dev_name(pv_dev(pv)), vg_name);
+ pv->vg_name = ORPHAN;
+ pv->status = ALLOCATABLE_PV;
+
+ if (!dev_get_size(pv_dev(pv), &pv->size)) {
+ log_error("%s: Couldn't get size.", dev_name(pv_dev(pv)));
+ ret = 0;
+ continue;
+ }
+
+ /* FIXME Write to same sector label was read from */
+ if (!pv_write(cmd, pv, NULL, INT64_C(-1))) {
+ log_error("Failed to remove physical volume \"%s\""
+ " from volume group \"%s\"",
+ dev_name(pv_dev(pv)), vg_name);
+ ret = 0;
+ }
+ }
+
+ backup_remove(cmd, vg_name);
+
+ if (ret)
+ log_print("Volume group \"%s\" successfully removed", vg_name);
+ else
+ log_error("Volume group \"%s\" not properly removed", vg_name);
+
+ return ret;
+}
+
int vg_extend(struct volume_group *vg, int pv_count, char **pv_names)
{
int i;
--- LVM2/tools/vgremove.c 2007/08/21 16:40:33 1.43
+++ LVM2/tools/vgremove.c 2007/08/21 17:38:20 1.44
@@ -15,71 +15,6 @@
#include "tools.h"
-static int vg_remove_single(struct cmd_context *cmd, const char *vg_name,
- struct volume_group *vg, int consistent,
- force_t force)
-{
- struct physical_volume *pv;
- struct pv_list *pvl;
- int ret = 1;
-
- if (!vg || !consistent || (vg_status(vg) & PARTIAL_VG)) {
- log_error("Volume group \"%s\" not found or inconsistent.",
- vg_name);
- log_error("Consider vgreduce --removemissing if metadata "
- "is inconsistent.");
- return 0;
- }
-
- if (!vg_check_status(vg, EXPORTED_VG))
- return 0;
-
- if (vg->lv_count) {
- log_error("Volume group \"%s\" still contains %d "
- "logical volume(s)", vg_name, vg->lv_count);
- return 0;
- }
-
- if (!archive(vg))
- return 0;
-
- if (!vg_remove(vg)) {
- log_error("vg_remove %s failed", vg_name);
- return 0;
- }
-
- /* init physical volumes */
- list_iterate_items(pvl, &vg->pvs) {
- pv = pvl->pv;
- log_verbose("Removing physical volume \"%s\" from "
- "volume group \"%s\"", dev_name(pv_dev(pv)), vg_name);
- pv->vg_name = ORPHAN;
- pv->status = ALLOCATABLE_PV;
-
- if (!dev_get_size(pv_dev(pv), &pv->size)) {
- log_error("%s: Couldn't get size.", dev_name(pv_dev(pv)));
- ret = 0;
- continue;
- }
-
- /* FIXME Write to same sector label was read from */
- if (!pv_write(cmd, pv, NULL, INT64_C(-1))) {
- log_error("Failed to remove physical volume \"%s\""
- " from volume group \"%s\"",
- dev_name(pv_dev(pv)), vg_name);
- ret = 0;
- }
- }
-
- backup_remove(cmd, vg_name);
-
- if (ret)
- log_print("Volume group \"%s\" successfully removed", vg_name);
- else
- log_error("Volume group \"%s\" not properly removed", vg_name);
-
- return ret;
-}
static int vgremove_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg, int consistent,
void *handle __attribute((unused)))
^ permalink raw reply [flat|nested] 31+ messages in thread
* LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...
@ 2007-07-23 17:27 wysochanski
0 siblings, 0 replies; 31+ messages in thread
From: wysochanski @ 2007-07-23 17:27 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski@sourceware.org 2007-07-23 17:27:55
Modified files:
. : WHATS_NEW
lib/metadata : metadata-exported.h metadata.c
tools : pvmove.c vgextend.c vgmerge.c vgsplit.c
Log message:
Add vg_lock_and_read() external library function.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.667&r2=1.668
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.127&r2=1.128
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgextend.c.diff?cvsroot=lvm2&r1=1.31&r2=1.32
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgmerge.c.diff?cvsroot=lvm2&r1=1.37&r2=1.38
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.31&r2=1.32
--- LVM2/WHATS_NEW 2007/07/23 10:45:49 1.667
+++ LVM2/WHATS_NEW 2007/07/23 17:27:54 1.668
@@ -1,5 +1,6 @@
Version 2.02.28 -
================================
+ Add vg_lock_and_read() external library function.
Fix loading of persistent cache if cache_dir is used. (2.02.23)
Eliminate uses of strdup+basename. Use last_path_component instead.
Use gcc's printf attribute wherever possible.
--- LVM2/lib/metadata/metadata-exported.h 2007/07/18 15:38:58 1.1
+++ LVM2/lib/metadata/metadata-exported.h 2007/07/23 17:27:54 1.2
@@ -292,6 +292,8 @@
int pv_write(struct cmd_context *cmd, struct physical_volume *pv,
struct list *mdas, int64_t label_sector);
int is_orphan(pv_t *pv);
+vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name,
+ uint32_t lock_flags, uint32_t status_flags);
/* pe_start and pe_end relate to any existing data so that new metadata
* areas can avoid overlap */
--- LVM2/lib/metadata/metadata.c 2007/07/12 15:38:53 1.127
+++ LVM2/lib/metadata/metadata.c 2007/07/23 17:27:54 1.128
@@ -1792,6 +1792,41 @@
return 1;
}
+/**
+ * vg_lock_and_read - Attempt to lock a volume group, read, and check status
+ * @cmd - command context
+ * @vg_name - name of the volume group to lock and read
+ * @lock_flags - locking flags to use
+ * @status_flags - status flags to check
+ *
+ * Returns:
+ * NULL - failure
+ * non-NULL - success; volume group handle
+ */
+vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name,
+ uint32_t lock_flags, uint32_t status_flags)
+{
+ struct volume_group *vg;
+ int consistent = 1;
+
+ if (!lock_vol(cmd, vg_name, lock_flags)) {
+ log_error("Can't get lock for %s", vg_name);
+ return NULL;
+ }
+
+ if (!(vg = vg_read(cmd, vg_name, NULL, &consistent)) || !consistent) {
+ log_error("Volume group \"%s\" not found", vg_name);
+ unlock_vg(cmd, vg_name);
+ return NULL;
+ }
+
+ if (!vg_check_status(vg, status_flags)) {
+ unlock_vg(cmd, vg_name);
+ return NULL;
+ }
+ return vg;
+}
+
/*
* Gets/Sets for external LVM library
--- LVM2/tools/pvmove.c 2007/06/15 22:16:55 1.38
+++ LVM2/tools/pvmove.c 2007/07/23 17:27:55 1.39
@@ -50,26 +50,13 @@
static struct volume_group *_get_vg(struct cmd_context *cmd, const char *vgname)
{
- int consistent = 1;
struct volume_group *vg;
dev_close_all();
- if (!lock_vol(cmd, vgname, LCK_VG_WRITE)) {
- log_error("Can't get lock for %s", vgname);
- return NULL;
- }
-
- if (!(vg = vg_read(cmd, vgname, NULL, &consistent)) || !consistent) {
- log_error("Volume group \"%s\" doesn't exist", vgname);
- unlock_vg(cmd, vgname);
- return NULL;
- }
-
- if (!vg_check_status(vg, CLUSTERED | EXPORTED_VG | LVM_WRITE)) {
- unlock_vg(cmd, vgname);
- return NULL;
- }
+ if (!(vg = vg_lock_and_read(cmd, vgname, LCK_VG_WRITE,
+ CLUSTERED | EXPORTED_VG | LVM_WRITE)))
+ return NULL;
return vg;
}
--- LVM2/tools/vgextend.c 2007/06/19 00:33:43 1.31
+++ LVM2/tools/vgextend.c 2007/07/23 17:27:55 1.32
@@ -19,7 +19,6 @@
{
char *vg_name;
struct volume_group *vg = NULL;
- int consistent = 1;
if (!argc) {
log_error("Please enter volume group name and "
@@ -48,21 +47,12 @@
}
log_verbose("Checking for volume group \"%s\"", vg_name);
- if (!lock_vol(cmd, vg_name, LCK_VG_WRITE | LCK_NONBLOCK)) {
- unlock_vg(cmd, ORPHAN);
- log_error("Can't get lock for %s", vg_name);
- goto error;
- }
-
- if (!(vg = vg_read(cmd, vg_name, NULL, &consistent)) || !consistent) {
- log_error("Volume group \"%s\" not found.", vg_name);
- goto error;
- }
-
- if (!vg_check_status(vg, CLUSTERED | EXPORTED_VG |
- LVM_WRITE | RESIZEABLE_VG))
- goto error;
-
+ if (!(vg = vg_lock_and_read(cmd, vg_name, LCK_VG_WRITE | LCK_NONBLOCK,
+ CLUSTERED | EXPORTED_VG |
+ LVM_WRITE | RESIZEABLE_VG))) {
+ unlock_vg(cmd, ORPHAN);
+ return ECMD_FAILED;
+ }
/********** FIXME
log_print("maximum logical volume size is %s",
(dummy = lvm_show_size(LVM_LV_SIZE_MAX(vg) / 2, LONG)));
--- LVM2/tools/vgmerge.c 2007/06/06 19:40:28 1.37
+++ LVM2/tools/vgmerge.c 2007/07/23 17:27:55 1.38
@@ -22,7 +22,6 @@
struct lv_list *lvl1, *lvl2;
struct pv_list *pvl;
int active;
- int consistent = 1;
if (!strcmp(vg_name_to, vg_name_from)) {
log_error("Duplicate volume group name \"%s\"", vg_name_from);
@@ -30,38 +29,18 @@
}
log_verbose("Checking for volume group \"%s\"", vg_name_to);
- if (!lock_vol(cmd, vg_name_to, LCK_VG_WRITE)) {
- log_error("Can't get lock for %s", vg_name_to);
- return ECMD_FAILED;
- }
-
- if (!(vg_to = vg_read(cmd, vg_name_to, NULL, &consistent)) || !consistent) {
- log_error("Volume group \"%s\" doesn't exist", vg_name_to);
- unlock_vg(cmd, vg_name_to);
- return ECMD_FAILED;
- }
-
- if (!vg_check_status(vg_to, CLUSTERED | EXPORTED_VG | LVM_WRITE)) {
- unlock_vg(cmd, vg_name_to);
- return ECMD_FAILED;
- }
+ if (!(vg_to = vg_lock_and_read(cmd, vg_name_to, LCK_VG_WRITE,
+ CLUSTERED | EXPORTED_VG | LVM_WRITE)))
+ return ECMD_FAILED;
log_verbose("Checking for volume group \"%s\"", vg_name_from);
- if (!lock_vol(cmd, vg_name_from, LCK_VG_WRITE | LCK_NONBLOCK)) {
- log_error("Can't get lock for %s", vg_name_from);
+ if (!(vg_from = vg_lock_and_read(cmd, vg_name_from,
+ LCK_VG_WRITE | LCK_NONBLOCK,
+ CLUSTERED | EXPORTED_VG | LVM_WRITE))) {
unlock_vg(cmd, vg_name_to);
return ECMD_FAILED;
}
- consistent = 1;
- if (!(vg_from = vg_read(cmd, vg_name_from, NULL, &consistent)) || !consistent) {
- log_error("Volume group \"%s\" doesn't exist", vg_name_from);
- goto error;
- }
-
- if (!vg_check_status(vg_from, CLUSTERED | EXPORTED_VG | LVM_WRITE))
- goto error;
-
if ((active = lvs_in_vg_activated(vg_from))) {
log_error("Logical volumes in \"%s\" must be inactive",
vg_name_from);
--- LVM2/tools/vgsplit.c 2007/06/28 17:59:34 1.31
+++ LVM2/tools/vgsplit.c 2007/07/23 17:27:55 1.32
@@ -240,22 +240,10 @@
}
log_verbose("Checking for volume group \"%s\"", vg_name_from);
- if (!lock_vol(cmd, vg_name_from, LCK_VG_WRITE)) {
- log_error("Can't get lock for %s", vg_name_from);
- return ECMD_FAILED;
- }
-
- if (!(vg_from = vg_read(cmd, vg_name_from, NULL, &consistent)) || !consistent) {
- log_error("Volume group \"%s\" doesn't exist", vg_name_from);
- unlock_vg(cmd, vg_name_from);
- return ECMD_FAILED;
- }
-
- if (!vg_check_status(vg_from, CLUSTERED | EXPORTED_VG |
- RESIZEABLE_VG | LVM_WRITE)) {
- unlock_vg(cmd, vg_name_from);
- return ECMD_FAILED;
- }
+ if (!(vg_to = vg_lock_and_read(cmd, vg_name_from, LCK_VG_WRITE,
+ CLUSTERED | EXPORTED_VG |
+ RESIZEABLE_VG | LVM_WRITE)))
+ return ECMD_FAILED;
log_verbose("Checking for volume group \"%s\"", vg_name_to);
if (!lock_vol(cmd, vg_name_to, LCK_VG_WRITE | LCK_NONBLOCK)) {
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2011-12-01 0:09 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-07 14:56 LVM2 ./WHATS_NEW lib/metadata/metadata-exporte jbrassow
-- strict thread matches above, loose matches on Subject: below --
2011-12-01 0:09 jbrassow
2011-10-28 20:12 zkabelac
2011-09-14 9:57 zkabelac
2011-09-07 8:34 zkabelac
2011-08-18 19:43 jbrassow
2011-08-18 19:34 jbrassow
2011-03-11 14:56 prajnoha
2011-03-02 20:00 mbroz
2011-02-25 14:02 prajnoha
2010-05-21 14:07 zkabelac
2010-05-21 12:55 zkabelac
2010-05-21 12:52 zkabelac
2010-05-14 15:19 jbrassow
2010-03-16 15:30 agk
2010-03-16 14:37 agk
2009-07-14 2:19 wysochanski
2009-06-05 20:00 mbroz
2009-06-01 14:43 mbroz
2009-02-03 16:19 wysochanski
2008-04-23 14:33 wysochanski
2008-02-13 20:01 meyering
2008-01-18 22:02 agk
2008-01-16 18:15 agk
2008-01-07 20:42 mbroz
2007-11-15 2:20 agk
2007-10-12 14:08 wysochanski
2007-09-20 21:39 wysochanski
2007-08-30 20:30 wysochanski
2007-08-21 17:38 wysochanski
2007-07-23 17:27 wysochanski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).