master - WHATS_NEW: Entry for commit e1917809477c4850cc1094121001d61a2b70ef26
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b873fc54baf128...
Commit: b873fc54baf12891158017cd732e01a7f19b3ac3
Parent: e1917809477c4850cc1094121001d61a2b70ef26
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Oct 23 21:38:37 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Oct 23 21:38:37 2012 -0500
WHATS_NEW: Entry for commit e1917809477c4850cc1094121001d61a2b70ef26
WHATS_NEW commit for 'lvs' output change to add RAID 4/5/6 sync %age
to s/Copy%/Cpy%Sync/ output.
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2c4e516..ffbf4ef 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Change lvs heading Copy% to Cpy%Sync and print RAID4/5/6 sync% there too.
Fix clvmd support for option -d and properly use its argument.
Support use of option --yes for lvchange --persistent.
Fix memory leak on error path for pvcreate with invalid uuid.
11 years, 6 months
master - RAID: Make RAID 4/5/6 display sync status under heading s/Copy%/Cpy%Sync
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e1917809477c48...
Commit: e1917809477c4850cc1094121001d61a2b70ef26
Parent: 6db461e3b0d3fbc394fe2ed2a7d6a3c070453874
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Oct 23 21:19:27 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Oct 23 21:19:27 2012 -0500
RAID: Make RAID 4/5/6 display sync status under heading s/Copy%/Cpy%Sync
The heading 'Copy%' is specific to PVMOVE volumes, but can be generalized
to apply to LVM mirrors also. It is a bit awkward to use 'Copy%' for
RAID 4/5/6, however - 'Sync%' would be more appropriate. This is why
RAID 4/5/6 have not displayed their sync status by any means available to
'lvs' yet.
Example (old):
[root@hayes-02 lvm2]# lvs vg
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sy Convert
lv vg -wi-a---- 1.00g
raid1 vg rwi-a-r-- 1.00g 100.00
raid4 vg rwi-a-r-- 1.01g
raid5 vg rwi-a-r-- 1.01g
raid6 vg rwi-a-r-- 1.01g
This patch changes the heading to 'Cpy%Sync' and allows RAID 4/5/6 to print
their sync percent in this field.
Example (new):
[root@hayes-02 lvm2]# lvs vg
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
lv vg -wi-a---- 1.00g
raid1 vg rwi-a-r-- 1.00g 100.00
raid4 vg rwi-a-r-- 1.01g 100.00
raid5 vg rwi-a-r-- 1.01g 100.00
raid6 vg rwi-a-r-- 1.01g 100.00
---
lib/report/columns.h | 3 ++-
lib/report/properties.c | 2 ++
lib/report/report.c | 20 +++++++++++++-------
man/lvs.8.in | 1 +
4 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/lib/report/columns.h b/lib/report/columns.h
index 6299a2b..c83a086 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -78,7 +78,8 @@ FIELD(LVS, lv, NUM, "OSize", lvid, 5, originsize, origin_size, "For snapshots, t
FIELD(LVS, lv, NUM, "Data%", lvid, 6, datapercent, data_percent, "For snapshot and thin pools and volumes, the percentage full if LV is active.", 0)
FIELD(LVS, lv, NUM, "Snap%", lvid, 6, snpercent, snap_percent, "For snapshots, the percentage full if LV is active.", 0)
FIELD(LVS, lv, NUM, "Meta%", lvid, 6, metadatapercent, metadata_percent, "For thin pools, the percentage of metadata full if LV is active.", 0)
-FIELD(LVS, lv, NUM, "Copy%", lvid, 6, copypercent, copy_percent, "For mirrors and pvmove, current percentage in-sync.", 0)
+FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, copy_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0)
+FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, sync_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0)
FIELD(LVS, lv, STR, "Move", lvid, 4, movepv, move_pv, "For pvmove, Source PV of temporary LV created by pvmove.", 0)
FIELD(LVS, lv, STR, "Convert", lvid, 7, convertlv, convert_lv, "For lvconvert, Name of temporary LV created by lvconvert.", 0)
FIELD(LVS, lv, STR, "Log", lvid, 3, loglv, mirror_log, "For mirrors, the LV holding the synchronisation log.", 0)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index c4f6ab9..fe197f5 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -189,6 +189,8 @@ GET_LV_NUM_PROPERTY_FN(snap_percent, _snap_percent(lv))
#define _snap_percent_set _not_implemented_set
GET_LV_NUM_PROPERTY_FN(copy_percent, _copy_percent(lv))
#define _copy_percent_set _not_implemented_set
+GET_LV_NUM_PROPERTY_FN(sync_percent, _copy_percent(lv))
+#define _sync_percent_set _not_implemented_set
GET_LV_STR_PROPERTY_FN(move_pv, lv_move_pv_dup(lv->vg->vgmem, lv))
#define _move_pv_set _not_implemented_set
GET_LV_STR_PROPERTY_FN(convert_lv, lv_convert_lv_dup(lv->vg->vgmem, lv))
diff --git a/lib/report/report.c b/lib/report/report.c
index b1e2bc1..1833458 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -898,13 +898,14 @@ static int _copypercent_disp(struct dm_report *rh __attribute__((unused)),
return 0;
}
- if ((!(lv->status & PVMOVE) && !(lv->status & MIRRORED)) ||
- !lv_mirror_percent(lv->vg->cmd, lv, 0, &percent,
- NULL) || (percent == PERCENT_INVALID)) {
- *sortval = UINT64_C(0);
- dm_report_field_set_value(field, "", sortval);
- return 1;
- }
+ if (lv->status & RAID) {
+ if (!lv_raid_percent(lv, &percent) ||
+ (percent == PERCENT_INVALID))
+ goto no_copypercent;
+ } else if ((!(lv->status & PVMOVE) && !(lv->status & MIRRORED)) ||
+ !lv_mirror_percent(lv->vg->cmd, lv, 0, &percent, NULL) ||
+ (percent == PERCENT_INVALID))
+ goto no_copypercent;
percent = copy_percent(lv);
@@ -922,6 +923,11 @@ static int _copypercent_disp(struct dm_report *rh __attribute__((unused)),
dm_report_field_set_value(field, repstr, sortval);
return 1;
+
+no_copypercent:
+ *sortval = UINT64_C(0);
+ dm_report_field_set_value(field, "", sortval);
+ return 1;
}
static int _dtpercent_disp(int metadata, struct dm_report *rh,
diff --git a/man/lvs.8.in b/man/lvs.8.in
index f31256c..d4d77b0 100644
--- a/man/lvs.8.in
+++ b/man/lvs.8.in
@@ -113,6 +113,7 @@ seg_tags,
snap_percent,
stripes,
stripe_size,
+sync_percent,
thin_count,
transaction_id,
zero.
11 years, 6 months
master - mirror/raid: Move 'copy_percent' to common code (mirror.c -> lv_manip.c)
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6db461e3b0d3fb...
Commit: 6db461e3b0d3fbc394fe2ed2a7d6a3c070453874
Parent: 8073ce16900def5a200fce44cb69862bfc50d4ce
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Oct 23 20:33:54 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Oct 23 20:33:54 2012 -0500
mirror/raid: Move 'copy_percent' to common code (mirror.c -> lv_manip.c)
The 'copy_percent' function takes the 'extents_copied' field from each
segment in an LV to create the numerator for the ratio that is to
become the copy_percent. (Otherwise known as the 'sync' percent for
non-pvmove uses, like mirror LVs and RAID LVs.) This function safely
works on RAID - not just mirrors - so it is better to have it in
lv_manip.c rather than mirror.c.
There's a lot of different functions that do a lot of different things
in lv_manip.c, so I placed the function near a function in lv_manip.c
that it was close to in metadata-exported.h. Different placement in the
file or a different name for the function may be useful.
---
lib/metadata/lv_manip.c | 18 ++++++++++++++++++
lib/metadata/metadata-exported.h | 2 +-
lib/metadata/mirror.c | 17 -----------------
3 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 32a207d..9f87854 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -199,6 +199,24 @@ uint32_t find_free_lvnum(struct logical_volume *lv)
return i;
}
+percent_t copy_percent(const struct logical_volume *lv)
+{
+ uint32_t numerator = 0u, denominator = 0u;
+ struct lv_segment *seg;
+
+ dm_list_iterate_items(seg, &lv->segments) {
+ denominator += seg->area_len;
+
+ if ((seg_is_raid(seg) || seg_is_mirrored(seg))
+ && (seg->area_count > 1))
+ numerator += seg->extents_copied;
+ else
+ numerator += seg->area_len;
+ }
+
+ return denominator ? make_percent( numerator, denominator ) : 100.0;
+}
+
/*
* All lv_segments get created here.
*/
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index d149f95..00be606 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -831,11 +831,11 @@ struct logical_volume *find_pvmove_lv_from_pvname(struct cmd_context *cmd,
struct logical_volume *find_pvmove_lv_in_lv(struct logical_volume *lv);
const char *get_pvmove_pvname_from_lv(struct logical_volume *lv);
const char *get_pvmove_pvname_from_lv_mirr(struct logical_volume *lv_mirr);
-percent_t copy_percent(const struct logical_volume *lv_mirr);
struct dm_list *lvs_using_lv(struct cmd_context *cmd, struct volume_group *vg,
struct logical_volume *lv);
uint32_t find_free_lvnum(struct logical_volume *lv);
+percent_t copy_percent(const struct logical_volume *lv_mirr);
char *generate_lv_name(struct volume_group *vg, const char *format,
char *buffer, size_t len);
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 084c93a..4fee763 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -1623,23 +1623,6 @@ struct dm_list *lvs_using_lv(struct cmd_context *cmd, struct volume_group *vg,
return lvs;
}
-percent_t copy_percent(const struct logical_volume *lv_mirr)
-{
- uint32_t numerator = 0u, denominator = 0u;
- struct lv_segment *seg;
-
- dm_list_iterate_items(seg, &lv_mirr->segments) {
- denominator += seg->area_len;
-
- if (seg_is_mirrored(seg) && seg->area_count > 1)
- numerator += seg->extents_copied;
- else
- numerator += seg->area_len;
- }
-
- return denominator ? make_percent( numerator, denominator ) : 100.0;
-}
-
/*
* Fixup mirror pointers after single-pass segment import
*/
11 years, 6 months
master - python-lvm: seg. fault in liblvm_lvm_percent_to_float
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8073ce16900def...
Commit: 8073ce16900def5a200fce44cb69862bfc50d4ce
Parent: a820a68619c10108666f8093545837233c954046
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue Oct 23 14:50:14 2012 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Tue Oct 23 14:54:06 2012 -0500
python-lvm: seg. fault in liblvm_lvm_percent_to_float
The first parameter needs to be present even if it isn't being
used, otherwise the one any only parameter we get is null
which causes PyArg_ParseTuple to seg. fault.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
python/liblvm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/python/liblvm.c b/python/liblvm.c
index 024d769..4da2999 100644
--- a/python/liblvm.c
+++ b/python/liblvm.c
@@ -153,7 +153,7 @@ liblvm_lvm_list_vg_uuids(void)
}
static PyObject *
-liblvm_lvm_percent_to_float(PyObject *arg)
+liblvm_lvm_percent_to_float(PyObject *self, PyObject *arg)
{
double converted;
int percent;
11 years, 6 months
master - udev_sync: cookie_set=1 on each dm_task_set_cookie call
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a820a68619c101...
Commit: a820a68619c10108666f8093545837233c954046
Parent: fc849a9eebecf77c75d016fad2b83fd3b2950474
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Oct 23 11:40:53 2012 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Oct 23 13:23:35 2012 +0200
udev_sync: cookie_set=1 on each dm_task_set_cookie call
cookie_set variable found in the struct dm_task should be always
set to 1 after dm_task_set_cookie_call, even if udev_sync is disabled
as the cookie itself carries synchronization informations *as well as*
extra flags to control other aspects of udev support.
For example, one could disable the synchronization itself, but still
direct the libdm code to disable library fallback via
DM_UDEV_DISABLE_LIBRARY_FALLBACK flag. These extra flags still need
to be carried out!
A concrete example:
$ dmsetup create test --table "0 1 zero" --noudevsync
This disables synchronization with udev. As the --verifyudev option is
not used, we don't want to do any corrections. In other words, we
need DM_UDEV_DISABLE_LIBRARY_FALLBACK flag to be used. However,
with --noudevsync this was not the case - the flag was ignored!
This patch fixes the case when noudevsync is used but there are still
some extra flags passed within the cookie flag part. The synchronization
part of the cookie stays zero (which is ok as dm_udev_wait call on such a
cookie is simply a NOOP).
---
WHATS_NEW_DM | 1 +
libdm/libdm-common.c | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 2d0b05c..7c636f0 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.77 - 15th October 2012
===================================
+ Fix dm_task_set_cookie to properly process udev flags if udev_sync disabled.
Support unmount of thin volumes from pool above thin pool threshold.
Update man page to reflect that dm UUIDs are being mangled as well.
Apply 'dmsetup mangle' for dm UUIDs besides dm names.
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index b8533ed..afdac89 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -1838,6 +1838,7 @@ int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie, uint16_t flags)
if (dm_cookie_supported())
dmt->event_nr = flags << DM_UDEV_FLAGS_SHIFT;
*cookie = 0;
+ dmt->cookie_set = 1;
return 1;
}
@@ -2207,6 +2208,7 @@ int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie, uint16_t flags)
if (!dm_udev_get_sync_support()) {
*cookie = 0;
+ dmt->cookie_set = 1;
return 1;
}
11 years, 6 months
master - version: update
by Marian Csontos
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fc849a9eebecf7...
Commit: fc849a9eebecf77c75d016fad2b83fd3b2950474
Parent: 13fe333b54c2dedf91af2f663d6ac9bd883c3b87
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Mon Oct 22 14:16:06 2012 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Mon Oct 22 14:16:06 2012 +0200
version: update
---
VERSION | 2 +-
VERSION_DM | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/VERSION b/VERSION
index 246867e..f8dcbdc 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.98(2)-git (2012-10-15)
+2.02.99(2)-git (2012-10-22)
diff --git a/VERSION_DM b/VERSION_DM
index bb267d5..75d1302 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.77-git (2012-10-15)
+1.02.78-git (2012-10-22)
11 years, 6 months
master - clvmd: fix parsing of -d argument
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=13fe333b54c2de...
Commit: 13fe333b54c2dedf91af2f663d6ac9bd883c3b87
Parent: 5f5a5d1f53d4dac462f447c0db692229f4a501b3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 19 15:18:19 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 19 15:35:56 2012 +0200
clvmd: fix parsing of -d argument
clvmd -d option parsing was not working properly.
clvmd -d 2 (with space) has been ignored because of
'::' used in getopt string, and as failsafe it's been used '1'.
Later this debug_arg has been ignored and debug_opt was used
instead which happend to have value '1'.
Submitted-by: Robert Milasan <rmilasan at suse.com>
Reported-by: Robert Milasan <rmilasan at suse.com>
---
WHATS_NEW | 1 +
daemons/clvmd/clvmd.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 7d3995b..2c4e516 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix clvmd support for option -d and properly use its argument.
Support use of option --yes for lvchange --persistent.
Fix memory leak on error path for pvcreate with invalid uuid.
Use lv_is_active() instead of lv_info() call.
diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c
index ac465d9..eb0bffd 100644
--- a/daemons/clvmd/clvmd.c
+++ b/daemons/clvmd/clvmd.c
@@ -362,7 +362,7 @@ int main(int argc, char *argv[])
/* Deal with command-line arguments */
opterr = 0;
optind = 0;
- while ((opt = getopt_long(argc, argv, "vVhfd::t:RST:CI:E:",
+ while ((opt = getopt_long(argc, argv, "vVhfd:t:RST:CI:E:",
longopts, NULL)) != -1) {
switch (opt) {
case 'h':
@@ -449,7 +449,7 @@ int main(int argc, char *argv[])
return debug_clvmd(debug_arg, clusterwide_opt)==1?0:1;
}
- clvmd_set_debug(debug_opt);
+ clvmd_set_debug(debug_arg);
/* Fork into the background (unless requested not to) */
if (!foreground_mode)
11 years, 6 months
master - lvchange: support --yes option for --persistent
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5f5a5d1f53d4da...
Commit: 5f5a5d1f53d4dac462f447c0db692229f4a501b3
Parent: bc7d3b74f10bae4fd5931346f954601b89ddeee9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 19 14:16:15 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 19 15:33:46 2012 +0200
lvchange: support --yes option for --persistent
Support using command: lvchange --yes --persistent
to skip y|n prompt.
---
WHATS_NEW | 1 +
tools/lvchange.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ad0756a..7d3995b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Support use of option --yes for lvchange --persistent.
Fix memory leak on error path for pvcreate with invalid uuid.
Use lv_is_active() instead of lv_info() call.
Cleanup some log_error message and use log_warn instead.
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 842b2da..8eabbbb 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -660,6 +660,7 @@ static int lvchange_persistent(struct cmd_context *cmd,
return 0;
if (active && !arg_count(cmd, force_ARG) &&
+ !arg_count(cmd, yes_ARG) &&
yes_no_prompt("Logical volume %s will be "
"deactivated temporarily. "
"Continue? [y/n]: ", lv->name) == 'n') {
11 years, 6 months
master - cleanup: fix typo in error message
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bc7d3b74f10bae...
Commit: bc7d3b74f10bae4fd5931346f954601b89ddeee9
Parent: c7c53ad41d5521d5b431e799699c9ad6a07054a4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 19 13:57:22 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 19 15:32:27 2012 +0200
cleanup: fix typo in error message
yes -> yet
---
tools/lvchange.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 04facdd..842b2da 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -53,7 +53,7 @@ static int lvchange_permission(struct cmd_context *cmd,
if (!(lv_access & LVM_WRITE) && lv_is_thin_pool(lv)) {
log_error("Change permissions of thin pool \"%s\" not "
- "yes supported.", lv->name);
+ "yet supported.", lv->name);
return 0;
}
11 years, 6 months
master - pvcreate: fix leak on error path
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c7c53ad41d5521...
Commit: c7c53ad41d5521d5b431e799699c9ad6a07054a4
Parent: 0e47639a44e1630250ea10643f5a440281edfdce
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 18 14:32:56 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 19 15:32:21 2012 +0200
pvcreate: fix leak on error path
Missing vg release on error path.
Add tests for few more error cases.
---
WHATS_NEW | 1 +
test/shell/pvcreate-operation.sh | 11 ++++++++++-
tools/pvcreate.c | 1 +
3 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 8ba9f2d..ad0756a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix memory leak on error path for pvcreate with invalid uuid.
Use lv_is_active() instead of lv_info() call.
Cleanup some log_error message and use log_warn instead.
diff --git a/test/shell/pvcreate-operation.sh b/test/shell/pvcreate-operation.sh
index 55fff4e..ddcf94c 100644
--- a/test/shell/pvcreate-operation.sh
+++ b/test/shell/pvcreate-operation.sh
@@ -1,4 +1,4 @@
-# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2008-2012 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
@@ -121,6 +121,15 @@ vgcfgrestore -f $backupfile $vg1
vgremove -f $vg1
pvremove -f $dev1
+# pvcreate rejects non-existent uuid given with restorefile
+not pvcreate --uuid $uuid1 --restorefile $backupfile "$dev1"
+
+# pvcreate rejects restorefile without uuid
+not pvcreate --restorefile $backupfile "$dev1"
+
+# pvcreate rejects uuid restore with multiple volumes specified
+not pvcreate --uuid $uuid1 --restorefile $backupfile "$dev1" "$dev2"
+
# pvcreate wipes swap signature when forced
dd if=/dev/zero of="$dev1" bs=1024 count=64
mkswap "$dev1"
diff --git a/tools/pvcreate.c b/tools/pvcreate.c
index 5c12acb..c75f561 100644
--- a/tools/pvcreate.c
+++ b/tools/pvcreate.c
@@ -68,6 +68,7 @@ static int pvcreate_restore_params_validate(struct cmd_context *cmd,
return 0;
}
if (!(existing_pvl = find_pv_in_vg_by_uuid(vg, pp->idp))) {
+ release_vg(vg);
log_error("Can't find uuid %s in backup file %s",
uuid, pp->restorefile);
return 0;
11 years, 6 months