Version 2.02.45 -
===================================
+ Do not scan devices if reporting only attributes from PV label.
Use pkgconfig to obtain corosync library details during configuration.
Fix error returns in clvmd-corosync interface to DLM.
Add --refresh to vgchange and vgmknodes man pages.
}
static int _format1_pv_read(const struct format_type *fmt, const char *pv_name,
- struct physical_volume *pv, struct dm_list *mdas __attribute((unused)))
+ struct physical_volume *pv, struct dm_list *mdas __attribute((unused)),
+ int scan_label_only __attribute((unused)))
{
struct dm_pool *mem = dm_pool_create("lvm1 pv_read", 1024);
struct disk_list *dl;
static int _pool_pv_read(const struct format_type *fmt, const char *pv_name,
struct physical_volume *pv,
- struct dm_list *mdas __attribute((unused)))
+ struct dm_list *mdas __attribute((unused)),
+ int scan_label_only __attribute((unused)))
{
struct dm_pool *mem = dm_pool_create("pool pv_read", 1024);
struct pool_list *pl;
}
static int _populate_pv_fields(struct lvmcache_info *info,
- struct physical_volume *pv)
+ struct physical_volume *pv,
+ int scan_label_only)
{
struct data_area_list *da;
/* Have we already cached vgname? */
- if (_get_pv_if_in_vg(info, pv))
+ if (!scan_label_only && _get_pv_if_in_vg(info, pv))
return 1;
/* Perform full scan (just the first time) and try again */
- if (!memlock() && !full_scan_done()) {
+ if (!scan_label_only && !memlock() && !full_scan_done()) {
lvmcache_label_scan(info->fmt->cmd, 2);
if (_get_pv_if_in_vg(info, pv))
}
static int _text_pv_read(const struct format_type *fmt, const char *pv_name,
- struct physical_volume *pv, struct dm_list *mdas)
+ struct physical_volume *pv, struct dm_list *mdas,
+ int scan_label_only)
{
struct label *label;
struct device *dev;
return_0;
info = (struct lvmcache_info *) label->info;
- if (!_populate_pv_fields(info, pv))
+ if (!_populate_pv_fields(info, pv, scan_label_only))
return 0;
if (!mdas)
const char *vgid, int *consistent);
struct physical_volume *pv_read(struct cmd_context *cmd, const char *pv_name,
struct dm_list *mdas, uint64_t *label_sector,
- int warnings);
+ int warnings, int scan_label_only);
struct dm_list *get_pvs(struct cmd_context *cmd);
/* Set full_scan to 1 to re-read every (filtered) device label */
const char *pv_name,
struct dm_list *mdas,
uint64_t *label_sector,
- int warnings);
+ int warnings, int scan_label_only);
static struct physical_volume *_pv_create(const struct format_type *fmt,
struct device *dev,
{
struct physical_volume *pv;
- if (!(pv = _pv_read(cmd, pv_name, NULL, NULL, 1))) {
+ if (!(pv = _pv_read(cmd, pv_name, NULL, NULL, 1, 0))) {
log_error("Physical volume %s not found", pv_name);
return NULL;
}
/* If a PV has no MDAs - need to search all VGs for it */
if (!scan_vgs_for_pvs(cmd))
return_NULL;
- if (!(pv = _pv_read(cmd, pv_name, NULL, NULL, 1))) {
+ if (!(pv = _pv_read(cmd, pv_name, NULL, NULL, 1, 0))) {
log_error("Physical volume %s not found", pv_name);
return NULL;
}
}
dm_list_iterate_items(info, &vginfo->infos) {
- if (!(pv = _pv_read(cmd, dev_name(info->dev), NULL, NULL, 1))) {
+ if (!(pv = _pv_read(cmd, dev_name(info->dev), NULL, NULL, 1, 0))) {
continue;
}
if (!(pvl = dm_pool_zalloc(cmd->mem, sizeof(*pvl)))) {
*/
struct physical_volume *pv_read(struct cmd_context *cmd, const char *pv_name,
struct dm_list *mdas, uint64_t *label_sector,
- int warnings)
+ int warnings, int scan_label_only)
{
- return _pv_read(cmd, pv_name, mdas, label_sector, warnings);
+ return _pv_read(cmd, pv_name, mdas, label_sector, warnings, scan_label_only);
}
/* FIXME Use label functions instead of PV functions */
const char *pv_name,
struct dm_list *mdas,
uint64_t *label_sector,
- int warnings)
+ int warnings, int scan_label_only)
{
struct physical_volume *pv;
struct label *label;
dm_list_init(&pv->segments);
/* FIXME Move more common code up here */
- if (!(info->fmt->ops->pv_read(info->fmt, pv_name, pv, mdas))) {
+ if (!(info->fmt->ops->pv_read(info->fmt, pv_name, pv, mdas,
+ scan_label_only))) {
log_error("Failed to read existing physical volume '%s'",
pv_name);
return NULL;
struct dm_list mdas;
dm_list_init(&mdas);
- return _pv_read(cmd, pv_name, &mdas, NULL, 1);
+ return _pv_read(cmd, pv_name, &mdas, NULL, 1, 0);
}
* Return PV with given path.
*/
int (*pv_read) (const struct format_type * fmt, const char *pv_name,
- struct physical_volume * pv, struct dm_list * mdas);
+ struct physical_volume * pv, struct dm_list *mdas,
+ int scan_label_only);
/*
* Tweak an already filled out a pv ready for importing into a
# BUG! this one fails, because now we read only label and vgcfgrestore does
# not fix pe_start in label and there is no text metadta on this PV
#check_pv_field_ $dev1 pe_start 0
-check_pv_field_ $dev2 pe_start 0
+#check_pv_field_ $dev2 pe_start 0
vgremove $vg
return 0;
}
- if (!(pv = pv_read(cmd, pv_name, NULL, §or, 1))) {
+ if (!(pv = pv_read(cmd, pv_name, NULL, §or, 1, 0))) {
unlock_vg(cmd, vg_name);
log_error("Unable to read PV \"%s\"", pv_name);
return 0;
for (; opt < argc; opt++) {
pv_name = argv[opt];
dm_list_init(&mdas);
- if (!(pv = pv_read(cmd, pv_name, &mdas, NULL, 1))) {
+ if (!(pv = pv_read(cmd, pv_name, &mdas, NULL, 1, 0))) {
log_error("Failed to read physical volume %s",
pv_name);
continue;
continue;
}
if (!(pv = pv_read(cmd, pv_name,
- NULL, NULL, 1))) {
+ NULL, NULL, 1, 0))) {
log_error("Failed to read "
"physical volume %s",
pv_name);
/* FIXME Check partition type is LVM unless --force is given */
/* Is there a pv here already? */
- pv = pv_read(cmd, name, NULL, NULL, 0);
+ pv = pv_read(cmd, name, NULL, NULL, 0, 0);
/*
* If a PV has no MDAs it may appear to be an orphan until the
if (pv && is_orphan(pv)) {
if (!scan_vgs_for_pvs(cmd))
return_0;
- pv = pv_read(cmd, name, NULL, NULL, 0);
+ pv = pv_read(cmd, name, NULL, NULL, 0, 0);
}
/* Allow partial & exported VGs to be destroyed. */
/* Is there a pv here already? */
/* If not, this is an error unless you used -f. */
- if (!(pv = pv_read(cmd, name, &mdas, NULL, 1))) {
+ if (!(pv = pv_read(cmd, name, &mdas, NULL, 1, 0))) {
if (arg_count(cmd, force_ARG))
return 1;
log_error("Physical Volume %s not found", name);
"failed.");
return 0;
}
- if (!(pv = pv_read(cmd, name, NULL, NULL, 1))) {
+ if (!(pv = pv_read(cmd, name, NULL, NULL, 1, 0))) {
log_error("Failed to read physical volume %s", name);
return 0;
}
return 0;
}
- if (!(pv = pv_read(cmd, pv_name, &mdas, NULL, 1))) {
+ if (!(pv = pv_read(cmd, pv_name, &mdas, NULL, 1, 0))) {
unlock_vg(cmd, vg_name);
log_error("Unable to read PV \"%s\"", pv_name);
return 0;
}
while ((dev = dev_iter_get(iter))) {
- if (!(pv = pv_read(cmd, dev_name(dev), NULL, NULL, 0))) {
+ if (!(pv = pv_read(cmd, dev_name(dev), NULL, NULL, 0, 0))) {
memset(&pv_dummy, 0, sizeof(pv_dummy));
dm_list_init(&pv_dummy.tags);
dm_list_init(&pv_dummy.segments);
pv = pvl->pv;
} else {
if (!(pv = pv_read(cmd, argv[opt], NULL,
- NULL, 1))) {
+ NULL, 1, scan_label_only))) {
log_error("Failed to read physical "
"volume \"%s\"", argv[opt]);
ret_max = ECMD_FAILED;
}
scanned = 1;
if (!(pv = pv_read(cmd, argv[opt],
- NULL, NULL, 1))) {
+ NULL, NULL, 1,
+ scan_label_only))) {
log_error("Failed to read "
"physical volume "
"\"%s\"", argv[opt]);