mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Test for incompatible format/segtype combinations in lv_extend.
This commit is contained in:
parent
075ab744c5
commit
68eb9e3b1f
@ -1,8 +1,8 @@
|
|||||||
Version 2.00.23 -
|
Version 2.00.23 -
|
||||||
====================================
|
====================================
|
||||||
|
Test for incompatible format/segtype combinations in lv_extend.
|
||||||
Fix lvchange example on man page.
|
Fix lvchange example on man page.
|
||||||
|
|
||||||
|
|
||||||
Version 2.00.22 - 3rd September 2004
|
Version 2.00.22 - 3rd September 2004
|
||||||
====================================
|
====================================
|
||||||
Fix /dev/vgname perms.
|
Fix /dev/vgname perms.
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "lvmcache.h"
|
#include "lvmcache.h"
|
||||||
#include "lvm1-label.h"
|
#include "lvm1-label.h"
|
||||||
#include "format1.h"
|
#include "format1.h"
|
||||||
|
#include "segtypes.h"
|
||||||
|
|
||||||
#define FMT_LVM1_NAME "lvm1"
|
#define FMT_LVM1_NAME "lvm1"
|
||||||
|
|
||||||
@ -492,6 +493,17 @@ static int _vg_setup(struct format_instance *fid, struct volume_group *vg)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int _segtype_supported (struct format_instance *fid,
|
||||||
|
struct segment_type *segtype)
|
||||||
|
{
|
||||||
|
if (!(segtype->flags & SEG_FORMAT1_SUPPORT)) {
|
||||||
|
stack;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static struct metadata_area_ops _metadata_format1_ops = {
|
static struct metadata_area_ops _metadata_format1_ops = {
|
||||||
vg_read:_vg_read,
|
vg_read:_vg_read,
|
||||||
vg_write:_vg_write,
|
vg_write:_vg_write,
|
||||||
@ -542,6 +554,7 @@ static struct format_handler _format1_ops = {
|
|||||||
pv_write:_pv_write,
|
pv_write:_pv_write,
|
||||||
lv_setup:_lv_setup,
|
lv_setup:_lv_setup,
|
||||||
vg_setup:_vg_setup,
|
vg_setup:_vg_setup,
|
||||||
|
segtype_supported:_segtype_supported,
|
||||||
create_instance:_create_instance,
|
create_instance:_create_instance,
|
||||||
destroy_instance:_destroy_instance,
|
destroy_instance:_destroy_instance,
|
||||||
destroy:_destroy,
|
destroy:_destroy,
|
||||||
|
@ -623,6 +623,16 @@ int lv_extend(struct format_instance *fid,
|
|||||||
lv->le_count += extents;
|
lv->le_count += extents;
|
||||||
lv->size += (uint64_t) extents *lv->vg->extent_size;
|
lv->size += (uint64_t) extents *lv->vg->extent_size;
|
||||||
|
|
||||||
|
if (fid->fmt->ops->segtype_supported &&
|
||||||
|
!fid->fmt->ops->segtype_supported(fid, segtype)) {
|
||||||
|
log_error("Metadata format (%s) does not support required "
|
||||||
|
"LV segment type (%s).", fid->fmt->name,
|
||||||
|
segtype->name);
|
||||||
|
log_error("Consider changing the metadata format by running "
|
||||||
|
"vgconvert.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_allocate(lv->vg, lv, allocatable_pvs, old_le_count, alloc,
|
if (!_allocate(lv->vg, lv, allocatable_pvs, old_le_count, alloc,
|
||||||
segtype, stripes, stripe_size, mirrors, mirrored_pv,
|
segtype, stripes, stripe_size, mirrors, mirrored_pv,
|
||||||
mirrored_pe, status)) {
|
mirrored_pe, status)) {
|
||||||
|
@ -341,6 +341,12 @@ struct format_handler {
|
|||||||
*/
|
*/
|
||||||
int (*vg_setup) (struct format_instance * fi, struct volume_group * vg);
|
int (*vg_setup) (struct format_instance * fi, struct volume_group * vg);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check whether particular segment type is supported.
|
||||||
|
*/
|
||||||
|
int (*segtype_supported) (struct format_instance *fid,
|
||||||
|
struct segment_type *segtype);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create format instance with a particular metadata area
|
* Create format instance with a particular metadata area
|
||||||
*/
|
*/
|
||||||
|
@ -149,8 +149,8 @@ int insert_pvmove_mirrors(struct cmd_context *cmd,
|
|||||||
seg->area[s].u.pv.pe,
|
seg->area[s].u.pv.pe,
|
||||||
PVMOVE, allocatable_pvs,
|
PVMOVE, allocatable_pvs,
|
||||||
lv->alloc)) {
|
lv->alloc)) {
|
||||||
log_error("Allocation for temporary "
|
log_error("Unable to allocate "
|
||||||
"pvmove LV failed");
|
"temporary LV for pvmove.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
seg->area[s].type = AREA_LV;
|
seg->area[s].type = AREA_LV;
|
||||||
|
Loading…
Reference in New Issue
Block a user