mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Fix non-orphan pvchange -u.
This commit is contained in:
parent
3f910647c3
commit
bd236f658d
@ -1,5 +1,6 @@
|
||||
Version 2.01.11 -
|
||||
==============================
|
||||
Fix non-orphan pvchange -u.
|
||||
Fix vgmerge to handle duplicate LVIDs.
|
||||
Move archiver code from tools into library.
|
||||
vgscan/change/display/vgs automatically create metadata backups if needed.
|
||||
|
@ -24,9 +24,12 @@ static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv,
|
||||
struct pv_list *pvl;
|
||||
struct list mdas;
|
||||
uint64_t sector;
|
||||
uint32_t orig_pe_alloc_count;
|
||||
|
||||
const char *pv_name = dev_name(pv->dev);
|
||||
const char *tag = NULL;
|
||||
const char *orig_vg_name;
|
||||
char uuid[64];
|
||||
|
||||
int consistent = 1;
|
||||
int allocatable = 0;
|
||||
@ -178,6 +181,24 @@ static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv,
|
||||
pv_name);
|
||||
return 0;
|
||||
}
|
||||
if (!id_write_format(&pv->id, uuid, sizeof(uuid))) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
log_verbose("Changing uuid of %s to %s.", pv_name, uuid);
|
||||
if (*pv->vg_name) {
|
||||
orig_vg_name = pv->vg_name;
|
||||
orig_pe_alloc_count = pv->pe_alloc_count;
|
||||
pv->vg_name = ORPHAN;
|
||||
pv->pe_alloc_count = 0;
|
||||
if (!(pv_write(cmd, pv, NULL, INT64_C(-1)))) {
|
||||
log_error("pv_write with new uuid failed "
|
||||
"for %s.", pv_name);
|
||||
return 0;
|
||||
}
|
||||
pv->vg_name = orig_vg_name;
|
||||
pv->pe_alloc_count = orig_pe_alloc_count;
|
||||
}
|
||||
}
|
||||
|
||||
log_verbose("Updating physical volume \"%s\"", pv_name);
|
||||
|
Loading…
Reference in New Issue
Block a user