mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
Convey need for snapshot-merge target in lvconvert error message and man
page. Add ->target_name to segtype_handler to allow a more specific target name to be returned based on the state of the segment. Result of trying to merge a snapshot using a kernel that doesn't have the snapshot-merge target: Before: # lvconvert --merge vg/snap Can't expand LV lv: snapshot target support missing from kernel? Failed to suspend origin lv After: # lvconvert --merge vg/snap Can't process LV lv: snapshot-merge target support missing from kernel? Failed to suspend origin lv Unable to merge LV "snap" into it's origin.
This commit is contained in:
parent
336d41d685
commit
9443b5d4cd
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.75 -
|
Version 2.02.75 -
|
||||||
=====================================
|
=====================================
|
||||||
|
Convey need for snapshot-merge target in lvconvert error message and man page.
|
||||||
Add "devices/disable_after_error_count" to lvm.conf.
|
Add "devices/disable_after_error_count" to lvm.conf.
|
||||||
Give correct error message when creating a too-small snapshot.
|
Give correct error message when creating a too-small snapshot.
|
||||||
Implement vgextend --restoremissing.
|
Implement vgextend --restoremissing.
|
||||||
|
@ -1350,19 +1350,23 @@ static int _add_segment_to_dtree(struct dev_manager *dm,
|
|||||||
uint32_t s;
|
uint32_t s;
|
||||||
struct dm_list *snh;
|
struct dm_list *snh;
|
||||||
struct lv_segment *seg_present;
|
struct lv_segment *seg_present;
|
||||||
|
const char *target_name;
|
||||||
|
|
||||||
/* Ensure required device-mapper targets are loaded */
|
/* Ensure required device-mapper targets are loaded */
|
||||||
seg_present = find_cow(seg->lv) ? : seg;
|
seg_present = find_cow(seg->lv) ? : seg;
|
||||||
|
target_name = (seg_present->segtype->ops->target_name ?
|
||||||
|
seg_present->segtype->ops->target_name(seg_present) :
|
||||||
|
seg_present->segtype->name);
|
||||||
|
|
||||||
log_debug("Checking kernel supports %s segment type for %s%s%s",
|
log_debug("Checking kernel supports %s segment type for %s%s%s",
|
||||||
seg_present->segtype->name, seg->lv->name,
|
target_name, seg->lv->name,
|
||||||
layer ? "-" : "", layer ? : "");
|
layer ? "-" : "", layer ? : "");
|
||||||
|
|
||||||
if (seg_present->segtype->ops->target_present &&
|
if (seg_present->segtype->ops->target_present &&
|
||||||
!seg_present->segtype->ops->target_present(seg_present->lv->vg->cmd,
|
!seg_present->segtype->ops->target_present(seg_present->lv->vg->cmd,
|
||||||
seg_present, NULL)) {
|
seg_present, NULL)) {
|
||||||
log_error("Can't expand LV %s: %s target support missing "
|
log_error("Can't process LV %s: %s target support missing "
|
||||||
"from kernel?", seg->lv->name, seg_present->segtype->name);
|
"from kernel?", seg->lv->name, target_name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ struct segment_type {
|
|||||||
|
|
||||||
struct segtype_handler {
|
struct segtype_handler {
|
||||||
const char *(*name) (const struct lv_segment * seg);
|
const char *(*name) (const struct lv_segment * seg);
|
||||||
|
const char *(*target_name) (const struct lv_segment * seg);
|
||||||
void (*display) (const struct lv_segment * seg);
|
void (*display) (const struct lv_segment * seg);
|
||||||
int (*text_export) (const struct lv_segment * seg,
|
int (*text_export) (const struct lv_segment * seg,
|
||||||
struct formatter * f);
|
struct formatter * f);
|
||||||
|
@ -28,6 +28,14 @@ static const char *_snap_name(const struct lv_segment *seg)
|
|||||||
return seg->segtype->name;
|
return seg->segtype->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *_snap_target_name(const struct lv_segment *seg)
|
||||||
|
{
|
||||||
|
if (seg->status & MERGING)
|
||||||
|
return "snapshot-merge";
|
||||||
|
|
||||||
|
return _snap_name(seg);
|
||||||
|
}
|
||||||
|
|
||||||
static int _snap_text_import(struct lv_segment *seg, const struct config_node *sn,
|
static int _snap_text_import(struct lv_segment *seg, const struct config_node *sn,
|
||||||
struct dm_hash_table *pv_hash __attribute__((unused)))
|
struct dm_hash_table *pv_hash __attribute__((unused)))
|
||||||
{
|
{
|
||||||
@ -217,6 +225,7 @@ static void _snap_destroy(const struct segment_type *segtype)
|
|||||||
|
|
||||||
static struct segtype_handler _snapshot_ops = {
|
static struct segtype_handler _snapshot_ops = {
|
||||||
.name = _snap_name,
|
.name = _snap_name,
|
||||||
|
.target_name = _snap_target_name,
|
||||||
.text_import = _snap_text_import,
|
.text_import = _snap_text_import,
|
||||||
.text_export = _snap_text_export,
|
.text_export = _snap_text_export,
|
||||||
.target_status_compatible = _snap_target_status_compatible,
|
.target_status_compatible = _snap_target_status_compatible,
|
||||||
|
@ -135,8 +135,10 @@ Controls zeroing of the first KB of data in the snapshot.
|
|||||||
If the volume is read-only the snapshot will not be zeroed.
|
If the volume is read-only the snapshot will not be zeroed.
|
||||||
.TP
|
.TP
|
||||||
.I \-\-merge
|
.I \-\-merge
|
||||||
Merges a snapshot into its origin volume. If both the origin and snapshot volume
|
Merges a snapshot into its origin volume. To check if your kernel
|
||||||
are not open the merge will start immediately. Otherwise, the merge will start
|
supports this 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.
|
the first time either the origin or snapshot are activated and both are closed.
|
||||||
Merging a snapshot into an origin that cannot be closed, for example a root
|
Merging a snapshot into an origin that cannot be closed, for example a root
|
||||||
filesystem, is deferred until the next time the origin volume is activated.
|
filesystem, is deferred until the next time the origin volume is activated.
|
||||||
|
@ -1563,7 +1563,7 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
if (!lvconvert_merge(cmd, lv, lp)) {
|
if (!lvconvert_merge(cmd, lv, lp)) {
|
||||||
stack;
|
log_error("Unable to merge LV \"%s\" into it's origin.", lv->name);
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
} else if (lp->snapshot) {
|
} else if (lp->snapshot) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user