1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

split orphan VG by format type

This commit is contained in:
Alasdair Kergon 2008-02-06 15:47:28 +00:00
parent 17dd04ca1f
commit bb097a97ea
19 changed files with 71 additions and 53 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.34 - Version 2.02.34 -
=================================== ===================================
Divide up internal orphan volume group by format type.
Update usage message for clvmd. Update usage message for clvmd.
Fix clvmd man page printing <br>, clarified debug options. Fix clvmd man page printing <br>, clarified debug options.
Fix lvresize to support /dev/mapper prefix in the lvname Fix lvresize to support /dev/mapper prefix in the lvname

29
lib/cache/lvmcache.c vendored
View File

@ -208,9 +208,6 @@ const char *vgname_from_vgid(struct dm_pool *mem, const char *vgid)
struct lvmcache_vginfo *vginfo; struct lvmcache_vginfo *vginfo;
const char *vgname = NULL; const char *vgname = NULL;
if (!*vgid)
vgname = ORPHAN;
if ((vginfo = vginfo_from_vgid(vgid))) if ((vginfo = vginfo_from_vgid(vgid)))
vgname = vginfo->vgname; vgname = vginfo->vgname;
@ -530,8 +527,10 @@ static int _lvmcache_update_vgid(struct lvmcache_info *info, const char *vgid)
return 0; return 0;
} }
log_debug("lvmcache: %s: setting %s VGID to %s", dev_name(info->dev), if (!is_orphan_vg(info->vginfo->vgname))
info->vginfo->vgname, info->vginfo->vgid); log_debug("lvmcache: %s: setting %s VGID to %s",
dev_name(info->dev), info->vginfo->vgname,
info->vginfo->vgid);
return 1; return 1;
} }
@ -627,15 +626,6 @@ static int _lvmcache_update_vgname(struct lvmcache_info *info,
struct lvmcache_vginfo *vginfo, *primary_vginfo; struct lvmcache_vginfo *vginfo, *primary_vginfo;
// struct lvmcache_vginfo *old_vginfo, *next; // struct lvmcache_vginfo *old_vginfo, *next;
/* If vgname is NULL and we don't already have a vgname,
* assume ORPHAN - we want every entry to have a vginfo
* attached for scanning reasons.
*/
if (!vgname && !info->vginfo) {
vgname = ORPHAN;
vgid = ORPHAN;
}
if (!vgname || (info->vginfo && !strcmp(info->vginfo->vgname, vgname))) if (!vgname || (info->vginfo && !strcmp(info->vginfo->vgname, vgname)))
return 1; return 1;
@ -716,9 +706,8 @@ static int _lvmcache_update_vgname(struct lvmcache_info *info,
/* FIXME Check consistency of list! */ /* FIXME Check consistency of list! */
vginfo->fmt = info->fmt; vginfo->fmt = info->fmt;
log_debug("lvmcache: %s: now %s%s%s%s%s", dev_name(info->dev), log_debug("lvmcache: %s: now in VG %s%s%s%s", dev_name(info->dev),
!is_orphan_vg(vgname) ? "in VG " : "orphaned", vgname, vgname, vginfo->vgid[0] ? " (" : "",
vginfo->vgid[0] ? " (" : "",
vginfo->vgid[0] ? vginfo->vgid : "", vginfo->vgid[0] ? vginfo->vgid : "",
vginfo->vgid[0] ? ")" : ""); vginfo->vgid[0] ? ")" : "");
@ -764,6 +753,12 @@ int lvmcache_update_vgname_and_id(struct lvmcache_info *info,
const char *vgname, const char *vgid, const char *vgname, const char *vgid,
uint32_t vgstatus, const char *creation_host) uint32_t vgstatus, const char *creation_host)
{ {
if (!vgname && !info->vginfo) {
log_error("Internal error: NULL vgname handed to cache");
/* FIXME Remove this */
vgname = info->fmt->orphan_vg_name;
vgid = vgname;
}
if (!_lvmcache_update_vgname(info, vgname, vgid, vgstatus, if (!_lvmcache_update_vgname(info, vgname, vgid, vgstatus,
creation_host) || creation_host) ||
!_lvmcache_update_vgid(info, vgid) || !_lvmcache_update_vgid(info, vgid) ||

View File

@ -20,7 +20,8 @@
#include "uuid.h" #include "uuid.h"
#include "label.h" #include "label.h"
#define ORPHAN "" #define ORPHAN_PREFIX "#"
#define ORPHAN_VG_NAME(fmt) ORPHAN_PREFIX "orphans_" fmt
#define CACHE_INVALID 0x00000001 #define CACHE_INVALID 0x00000001
#define CACHE_LOCKED 0x00000002 #define CACHE_LOCKED 0x00000002

View File

@ -307,7 +307,8 @@ void pvdisplay_full(const struct cmd_context *cmd,
log_print("--- %sPhysical volume ---", pv->pe_size ? "" : "NEW "); log_print("--- %sPhysical volume ---", pv->pe_size ? "" : "NEW ");
log_print("PV Name %s", pv_dev_name(pv)); log_print("PV Name %s", pv_dev_name(pv));
log_print("VG Name %s%s", pv->vg_name, log_print("VG Name %s%s",
is_orphan(pv) ? "" : pv->vg_name,
pv->status & EXPORTED_VG ? " (exported)" : ""); pv->status & EXPORTED_VG ? " (exported)" : "");
data_size = (uint64_t) pv->pe_count * pv->pe_size; data_size = (uint64_t) pv->pe_count * pv->pe_size;

View File

@ -326,10 +326,11 @@ static void __update_lvmcache(const struct format_type *fmt,
unsigned exported) unsigned exported)
{ {
struct lvmcache_info *info; struct lvmcache_info *info;
const char *vgname = *((char *)dl->pvd.vg_name) ?
(char *)dl->pvd.vg_name : fmt->orphan_vg_name;
if (!(info = lvmcache_add(fmt->labeller, (char *)dl->pvd.pv_uuid, dev, if (!(info = lvmcache_add(fmt->labeller, (char *)dl->pvd.pv_uuid, dev,
(char *)dl->pvd.vg_name, vgid, vgname, vgid, exported ? EXPORTED_VG : 0))) {
exported ? EXPORTED_VG : 0))) {
stack; stack;
return; return;
} }
@ -363,20 +364,20 @@ static struct disk_list *__read_disk(const struct format_type *fmt,
if (!*dl->pvd.vg_name) { if (!*dl->pvd.vg_name) {
log_very_verbose("%s is not a member of any format1 VG", name); log_very_verbose("%s is not a member of any format1 VG", name);
__update_lvmcache(fmt, dl, dev, NULL, 0); __update_lvmcache(fmt, dl, dev, fmt->orphan_vg_name, 0);
return (vg_name) ? NULL : dl; return (vg_name) ? NULL : dl;
} }
if (!read_vgd(dl->dev, &dl->vgd, &dl->pvd)) { if (!read_vgd(dl->dev, &dl->vgd, &dl->pvd)) {
log_error("Failed to read VG data from PV (%s)", name); log_error("Failed to read VG data from PV (%s)", name);
__update_lvmcache(fmt, dl, dev, NULL, 0); __update_lvmcache(fmt, dl, dev, fmt->orphan_vg_name, 0);
goto bad; goto bad;
} }
if (vg_name && strcmp(vg_name, (char *)dl->pvd.vg_name)) { if (vg_name && strcmp(vg_name, (char *)dl->pvd.vg_name)) {
log_very_verbose("%s is not a member of the VG %s", log_very_verbose("%s is not a member of the VG %s",
name, vg_name); name, vg_name);
__update_lvmcache(fmt, dl, dev, NULL, 0); __update_lvmcache(fmt, dl, dev, fmt->orphan_vg_name, 0);
goto bad; goto bad;
} }

View File

@ -18,13 +18,10 @@
#include "limits.h" #include "limits.h"
#include "display.h" #include "display.h"
#include "toolcontext.h" #include "toolcontext.h"
#include "lvmcache.h"
#include "lvm1-label.h" #include "lvm1-label.h"
#include "format1.h" #include "format1.h"
#include "segtype.h" #include "segtype.h"
#define FMT_LVM1_NAME "lvm1"
/* VG consistency checks */ /* VG consistency checks */
static int _check_vgs(struct list *pvs, int *partial) static int _check_vgs(struct list *pvs, int *partial)
{ {
@ -523,6 +520,7 @@ struct format_type *init_format(struct cmd_context *cmd)
fmt->ops = &_format1_ops; fmt->ops = &_format1_ops;
fmt->name = FMT_LVM1_NAME; fmt->name = FMT_LVM1_NAME;
fmt->alias = NULL; fmt->alias = NULL;
fmt->orphan_vg_name = FMT_LVM1_ORPHAN_VG_NAME;
fmt->features = FMT_RESTRICTED_LVIDS | FMT_ORPHAN_ALLOCATABLE | fmt->features = FMT_RESTRICTED_LVIDS | FMT_ORPHAN_ALLOCATABLE |
FMT_RESTRICTED_READAHEAD; FMT_RESTRICTED_READAHEAD;
fmt->private = NULL; fmt->private = NULL;

View File

@ -17,6 +17,10 @@
#define _LVM_FORMAT1_H #define _LVM_FORMAT1_H
#include "metadata.h" #include "metadata.h"
#include "lvmcache.h"
#define FMT_LVM1_NAME "lvm1"
#define FMT_LVM1_ORPHAN_VG_NAME ORPHAN_VG_NAME(FMT_LVM1_NAME)
#ifdef LVM1_INTERNAL #ifdef LVM1_INTERNAL
struct format_type *init_lvm1_format(struct cmd_context *cmd); struct format_type *init_lvm1_format(struct cmd_context *cmd);

View File

@ -26,6 +26,7 @@
#include "pv_alloc.h" #include "pv_alloc.h"
#include "display.h" #include "display.h"
#include "lvmcache.h" #include "lvmcache.h"
#include "metadata.h"
#include <time.h> #include <time.h>
@ -61,7 +62,7 @@ int import_pv(const struct format_type *fmt, struct dm_pool *mem,
pv->dev = dev; pv->dev = dev;
if (!*pvd->vg_name) if (!*pvd->vg_name)
pv->vg_name = ORPHAN; pv->vg_name = fmt->orphan_vg_name;
else if (!(pv->vg_name = dm_pool_strdup(mem, (char *)pvd->vg_name))) { else if (!(pv->vg_name = dm_pool_strdup(mem, (char *)pvd->vg_name))) {
log_error("Volume Group name allocation failed."); log_error("Volume Group name allocation failed.");
return 0; return 0;
@ -147,7 +148,7 @@ int export_pv(struct cmd_context *cmd, struct dm_pool *mem __attribute((unused))
memcpy(pvd->pv_uuid, pv->id.uuid, ID_LEN); memcpy(pvd->pv_uuid, pv->id.uuid, ID_LEN);
if (pv->vg_name) { if (pv->vg_name && !is_orphan(pv)) {
if (!_check_vg_name(pv->vg_name)) if (!_check_vg_name(pv->vg_name))
return_0; return_0;
strncpy((char *)pvd->vg_name, pv->vg_name, sizeof(pvd->vg_name)); strncpy((char *)pvd->vg_name, pv->vg_name, sizeof(pvd->vg_name));

View File

@ -19,7 +19,7 @@
#include "label.h" #include "label.h"
#include "metadata.h" #include "metadata.h"
#include "xlate.h" #include "xlate.h"
#include "lvmcache.h" #include "format1.h"
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
@ -60,17 +60,21 @@ static int _lvm1_read(struct labeller *l, struct device *dev, void *buf,
struct pv_disk *pvd = (struct pv_disk *) buf; struct pv_disk *pvd = (struct pv_disk *) buf;
struct vg_disk vgd; struct vg_disk vgd;
struct lvmcache_info *info; struct lvmcache_info *info;
const char *vgid = NULL; const char *vgid = FMT_LVM1_ORPHAN_VG_NAME;
const char *vgname = FMT_LVM1_ORPHAN_VG_NAME;
unsigned exported = 0; unsigned exported = 0;
munge_pvd(dev, pvd); munge_pvd(dev, pvd);
if (*pvd->vg_name && read_vgd(dev, &vgd, pvd)) { if (*pvd->vg_name) {
if (!read_vgd(dev, &vgd, pvd))
return_0;
vgid = (char *) vgd.vg_uuid; vgid = (char *) vgd.vg_uuid;
vgname = (char *) pvd->vg_name;
exported = pvd->pv_status & VG_EXPORTED; exported = pvd->pv_status & VG_EXPORTED;
} }
if (!(info = lvmcache_add(l, (char *)pvd->pv_uuid, dev, (char *)pvd->vg_name, vgid, if (!(info = lvmcache_add(l, (char *)pvd->pv_uuid, dev, vgname, vgid,
exported))) exported)))
return_0; return_0;
*label = info->label; *label = info->label;

View File

@ -316,6 +316,7 @@ struct format_type *init_format(struct cmd_context *cmd)
fmt->ops = &_format_pool_ops; fmt->ops = &_format_pool_ops;
fmt->name = FMT_POOL_NAME; fmt->name = FMT_POOL_NAME;
fmt->alias = NULL; fmt->alias = NULL;
fmt->orphan_vg_name = ORPHAN_VG_NAME(FMT_POOL_NAME);
fmt->features = 0; fmt->features = 0;
fmt->private = NULL; fmt->private = NULL;

View File

@ -36,9 +36,6 @@
#include <dirent.h> #include <dirent.h>
#include <ctype.h> #include <ctype.h>
#define FMT_TEXT_NAME "lvm2"
#define FMT_TEXT_ALIAS "text"
static struct mda_header *_raw_read_mda_header(const struct format_type *fmt, static struct mda_header *_raw_read_mda_header(const struct format_type *fmt,
struct device_area *dev_area); struct device_area *dev_area);
@ -387,7 +384,8 @@ static struct raw_locn *_find_vg_rlocn(struct device_area *dev_area,
bad: bad:
if ((info = info_from_pvid(dev_area->dev->pvid, 0))) if ((info = info_from_pvid(dev_area->dev->pvid, 0)))
lvmcache_update_vgname_and_id(info, ORPHAN, ORPHAN, 0, NULL); lvmcache_update_vgname_and_id(info, FMT_TEXT_ORPHAN_VG_NAME,
FMT_TEXT_ORPHAN_VG_NAME, 0, NULL);
return NULL; return NULL;
} }
@ -1293,7 +1291,7 @@ static int _text_pv_write(const struct format_type *fmt, struct physical_volume
/* FIXME Test mode don't update cache? */ /* FIXME Test mode don't update cache? */
if (!(info = lvmcache_add(fmt->labeller, (char *) &pv->id, pv->dev, if (!(info = lvmcache_add(fmt->labeller, (char *) &pv->id, pv->dev,
ORPHAN, NULL, 0))) FMT_TEXT_ORPHAN_VG_NAME, NULL, 0)))
return_0; return_0;
label = info->label; label = info->label;
@ -1438,7 +1436,7 @@ static int _text_pv_read(const struct format_type *fmt, const char *pv_name,
pv->dev = info->dev; pv->dev = info->dev;
pv->fmt = info->fmt; pv->fmt = info->fmt;
pv->size = info->device_size >> SECTOR_SHIFT; pv->size = info->device_size >> SECTOR_SHIFT;
pv->vg_name = ORPHAN; pv->vg_name = FMT_TEXT_ORPHAN_VG_NAME;
memcpy(&pv->id, &info->dev->pvid, sizeof(pv->id)); memcpy(&pv->id, &info->dev->pvid, sizeof(pv->id));
/* Currently only support exactly one data area */ /* Currently only support exactly one data area */
@ -1887,6 +1885,7 @@ struct format_type *create_text_format(struct cmd_context *cmd)
fmt->ops = &_text_handler; fmt->ops = &_text_handler;
fmt->name = FMT_TEXT_NAME; fmt->name = FMT_TEXT_NAME;
fmt->alias = FMT_TEXT_ALIAS; fmt->alias = FMT_TEXT_ALIAS;
fmt->orphan_vg_name = ORPHAN_VG_NAME(FMT_TEXT_NAME);
fmt->features = FMT_SEGMENTS | FMT_MDAS | FMT_TAGS | FMT_PRECOMMIT | fmt->features = FMT_SEGMENTS | FMT_MDAS | FMT_TAGS | FMT_PRECOMMIT |
FMT_UNLIMITED_VOLS | FMT_RESIZE_PV | FMT_UNLIMITED_VOLS | FMT_RESIZE_PV |
FMT_UNLIMITED_STRIPESIZE; FMT_UNLIMITED_STRIPESIZE;

View File

@ -19,6 +19,10 @@
#include "lvm-types.h" #include "lvm-types.h"
#include "metadata.h" #include "metadata.h"
#define FMT_TEXT_NAME "lvm2"
#define FMT_TEXT_ALIAS "text"
#define FMT_TEXT_ORPHAN_VG_NAME ORPHAN_VG_NAME(FMT_TEXT_NAME)
/* /*
* Archives a vg config. 'retain_days' is the minimum number of * Archives a vg config. 'retain_days' is the minimum number of
* days that an archive file must be held for. 'min_archives' is * days that an archive file must be held for. 'min_archives' is

View File

@ -207,7 +207,9 @@ static int _text_read(struct labeller *l, struct device *dev, void *buf,
pvhdr = (struct pv_header *) ((void *) buf + xlate32(lh->offset_xl)); pvhdr = (struct pv_header *) ((void *) buf + xlate32(lh->offset_xl));
if (!(info = lvmcache_add(l, (char *)pvhdr->pv_uuid, dev, NULL, NULL, 0))) if (!(info = lvmcache_add(l, (char *)pvhdr->pv_uuid, dev,
FMT_TEXT_ORPHAN_VG_NAME,
FMT_TEXT_ORPHAN_VG_NAME, 0)))
return_0; return_0;
*label = info->label; *label = info->label;

View File

@ -178,7 +178,8 @@ static struct labeller *_find_labeller(struct device *dev, char *buf,
out: out:
if (!found) { if (!found) {
if ((info = info_from_pvid(dev->pvid, 0))) if ((info = info_from_pvid(dev->pvid, 0)))
lvmcache_update_vgname_and_id(info, ORPHAN, ORPHAN, lvmcache_update_vgname_and_id(info, info->fmt->orphan_vg_name,
info->fmt->orphan_vg_name,
0, NULL); 0, NULL);
log_very_verbose("%s: No label detected", dev_name(dev)); log_very_verbose("%s: No label detected", dev_name(dev));
} }
@ -275,7 +276,8 @@ int label_read(struct device *dev, struct label **result,
stack; stack;
if ((info = info_from_pvid(dev->pvid, 0))) if ((info = info_from_pvid(dev->pvid, 0)))
lvmcache_update_vgname_and_id(info, ORPHAN, ORPHAN, lvmcache_update_vgname_and_id(info, info->fmt->orphan_vg_name,
info->fmt->orphan_vg_name,
0, NULL); 0, NULL);
return r; return r;
@ -351,7 +353,8 @@ int label_verify(struct device *dev)
if (!dev_open(dev)) { if (!dev_open(dev)) {
if ((info = info_from_pvid(dev->pvid, 0))) if ((info = info_from_pvid(dev->pvid, 0)))
lvmcache_update_vgname_and_id(info, ORPHAN, ORPHAN, lvmcache_update_vgname_and_id(info, info->fmt->orphan_vg_name,
info->fmt->orphan_vg_name,
0, NULL); 0, NULL);
return_0; return_0;

View File

@ -133,6 +133,7 @@ struct format_type {
struct labeller *labeller; struct labeller *labeller;
const char *name; const char *name;
const char *alias; const char *alias;
const char *orphan_vg_name;
uint32_t features; uint32_t features;
void *library; void *library;
void *private; void *private;

View File

@ -356,7 +356,7 @@ int vg_remove_single(struct cmd_context *cmd, const char *vg_name,
pv = pvl->pv; pv = pvl->pv;
log_verbose("Removing physical volume \"%s\" from " log_verbose("Removing physical volume \"%s\" from "
"volume group \"%s\"", pv_dev_name(pv), vg_name); "volume group \"%s\"", pv_dev_name(pv), vg_name);
pv->vg_name = ORPHAN; pv->vg_name = vg->fid->fmt->orphan_vg_name;
pv->status = ALLOCATABLE_PV; pv->status = ALLOCATABLE_PV;
if (!dev_get_size(pv_dev(pv), &pv->size)) { if (!dev_get_size(pv_dev(pv), &pv->size)) {
@ -833,6 +833,7 @@ static struct physical_volume *_pv_create(const struct format_type *fmt,
} }
pv->fmt = fmt; pv->fmt = fmt;
pv->vg_name = fmt->orphan_vg_name;
if (!fmt->ops->pv_setup(fmt, pe_start, existing_extent_count, if (!fmt->ops->pv_setup(fmt, pe_start, existing_extent_count,
existing_extent_size, existing_extent_size,
@ -1324,7 +1325,8 @@ int vg_revert(struct volume_group *vg)
} }
/* Make orphan PVs look like a VG */ /* Make orphan PVs look like a VG */
static struct volume_group *_vg_read_orphans(struct cmd_context *cmd) static struct volume_group *_vg_read_orphans(struct cmd_context *cmd,
const char *orphan_vgname)
{ {
struct lvmcache_vginfo *vginfo; struct lvmcache_vginfo *vginfo;
struct lvmcache_info *info; struct lvmcache_info *info;
@ -1332,7 +1334,7 @@ static struct volume_group *_vg_read_orphans(struct cmd_context *cmd)
struct volume_group *vg; struct volume_group *vg;
struct physical_volume *pv; struct physical_volume *pv;
if (!(vginfo = vginfo_from_vgname(ORPHAN, NULL))) if (!(vginfo = vginfo_from_vgname(orphan_vgname, NULL)))
return_NULL; return_NULL;
if (!(vg = dm_pool_zalloc(cmd->mem, sizeof(*vg)))) { if (!(vg = dm_pool_zalloc(cmd->mem, sizeof(*vg)))) {
@ -1343,7 +1345,7 @@ static struct volume_group *_vg_read_orphans(struct cmd_context *cmd)
list_init(&vg->lvs); list_init(&vg->lvs);
list_init(&vg->tags); list_init(&vg->tags);
vg->cmd = cmd; vg->cmd = cmd;
if (!(vg->name = dm_pool_strdup(cmd->mem, ORPHAN))) { if (!(vg->name = dm_pool_strdup(cmd->mem, orphan_vgname))) {
log_error("vg name allocation failed"); log_error("vg name allocation failed");
return NULL; return NULL;
} }
@ -1421,7 +1423,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
return NULL; return NULL;
} }
*consistent = 1; *consistent = 1;
return _vg_read_orphans(cmd); return _vg_read_orphans(cmd, vgname);
} }
/* Find the vgname in the cache */ /* Find the vgname in the cache */
@ -1942,7 +1944,7 @@ int pv_write_orphan(struct cmd_context *cmd, struct physical_volume *pv)
{ {
const char *old_vg_name = pv->vg_name; const char *old_vg_name = pv->vg_name;
pv->vg_name = ORPHAN; pv->vg_name = cmd->fmt->orphan_vg_name;
pv->status = ALLOCATABLE_PV; pv->status = ALLOCATABLE_PV;
if (!dev_get_size(pv->dev, &pv->size)) { if (!dev_get_size(pv->dev, &pv->size)) {
@ -1966,7 +1968,7 @@ int pv_write_orphan(struct cmd_context *cmd, struct physical_volume *pv)
*/ */
int is_orphan_vg(const char *vg_name) int is_orphan_vg(const char *vg_name)
{ {
return (!strcmp(vg_name, ORPHAN) ? 1 : 0); return (vg_name && vg_name[0] == ORPHAN_PREFIX[0]) ? 1 : 0;
} }
/** /**

View File

@ -1004,7 +1004,7 @@ static int _copypercent_disp(struct dm_report *rh __attribute((unused)), struct
/* necessary for displaying something for PVs not belonging to VG */ /* necessary for displaying something for PVs not belonging to VG */
static struct volume_group _dummy_vg = { static struct volume_group _dummy_vg = {
.name = (char *) ORPHAN, .name = (char *) "",
}; };
static void *_obj_get_vg(void *obj) static void *_obj_get_vg(void *obj)

View File

@ -171,7 +171,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv,
if (!is_orphan(pv)) { if (!is_orphan(pv)) {
orig_vg_name = pv_vg_name(pv); orig_vg_name = pv_vg_name(pv);
orig_pe_alloc_count = pv_pe_alloc_count(pv); orig_pe_alloc_count = pv_pe_alloc_count(pv);
pv->vg_name = ORPHAN; pv->vg_name = pv->fmt->orphan_vg_name;
pv->pe_alloc_count = 0; pv->pe_alloc_count = 0;
if (!(pv_write(cmd, pv, NULL, INT64_C(-1)))) { if (!(pv_write(cmd, pv, NULL, INT64_C(-1)))) {
log_error("pv_write with new uuid failed " log_error("pv_write with new uuid failed "

View File

@ -376,7 +376,7 @@ static int _vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
if (pvl) if (pvl)
list_del(&pvl->list); list_del(&pvl->list);
pv->vg_name = ORPHAN; pv->vg_name = vg->fid->fmt->orphan_vg_name;
pv->status = ALLOCATABLE_PV; pv->status = ALLOCATABLE_PV;
if (!dev_get_size(pv_dev(pv), &pv->size)) { if (!dev_get_size(pv_dev(pv), &pv->size)) {