mirror of
				git://sourceware.org/git/lvm2.git
				synced 2025-11-03 08:23:48 +03:00 
			
		
		
		
	Compare commits
	
		
			7 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					49738f43c0 | ||
| 
						 | 
					9f85f61010 | ||
| 
						 | 
					239f422039 | ||
| 
						 | 
					67af3c37be | ||
| 
						 | 
					a9442385c4 | ||
| 
						 | 
					8c9cd10b8b | ||
| 
						 | 
					72542059dd | 
@@ -390,6 +390,9 @@ int lvdisplay_full(struct cmd_context *cmd, struct logical_volume *lv,
 | 
			
		||||
			snap = list_item(slh, struct snapshot_list)->snapshot;
 | 
			
		||||
			snap_active = lv_snapshot_percent(snap->cow,
 | 
			
		||||
							  &snap_percent);
 | 
			
		||||
			if (!snap_active || snap_percent < 0 ||
 | 
			
		||||
			    snap_percent >= 100)
 | 
			
		||||
				snap_active = 0;
 | 
			
		||||
			log_print("                       %s%s/%s [%s]",
 | 
			
		||||
				  lv->vg->cmd->dev_dir, lv->vg->name,
 | 
			
		||||
				  snap->cow->name,
 | 
			
		||||
@@ -398,6 +401,8 @@ int lvdisplay_full(struct cmd_context *cmd, struct logical_volume *lv,
 | 
			
		||||
		snap = NULL;
 | 
			
		||||
	} else if ((snap = find_cow(lv))) {
 | 
			
		||||
		snap_active = lv_snapshot_percent(lv, &snap_percent);
 | 
			
		||||
		if (!snap_active || snap_percent < 0 || snap_percent >= 100)
 | 
			
		||||
			snap_active = 0;
 | 
			
		||||
		log_print("LV snapshot status     %s destination for %s%s/%s",
 | 
			
		||||
			  (snap_active > 0) ? "active" : "INACTIVE",
 | 
			
		||||
			  lv->vg->cmd->dev_dir, lv->vg->name,
 | 
			
		||||
 
 | 
			
		||||
@@ -255,21 +255,22 @@ static int _read_extents(struct disk_list *data)
 | 
			
		||||
/* 
 | 
			
		||||
 * If exported, remove "PV_EXP" from end of VG name 
 | 
			
		||||
 */
 | 
			
		||||
static void _munge_exported_vg(struct disk_list *data)
 | 
			
		||||
void munge_exported_vg(struct pv_disk *pvd)
 | 
			
		||||
{
 | 
			
		||||
	int l;
 | 
			
		||||
	size_t s;
 | 
			
		||||
 | 
			
		||||
	/* Return if PV not in a VG or VG not exported */
 | 
			
		||||
	if ((!*data->pvd.vg_name) || !(data->vgd.vg_status & VG_EXPORTED))
 | 
			
		||||
	/* Return if PV not in a VG */
 | 
			
		||||
	if ((!*pvd->vg_name))
 | 
			
		||||
		return;
 | 
			
		||||
	/* FIXME also check vgd->status & VG_EXPORTED? */
 | 
			
		||||
 | 
			
		||||
	l = strlen(data->pvd.vg_name);
 | 
			
		||||
	l = strlen(pvd->vg_name);
 | 
			
		||||
	s = sizeof(EXPORTED_TAG);
 | 
			
		||||
	if (!strncmp(data->pvd.vg_name + l - s + 1, EXPORTED_TAG, s))
 | 
			
		||||
		data->pvd.vg_name[l - s + 1] = '\0';
 | 
			
		||||
	if (!strncmp(pvd->vg_name + l - s + 1, EXPORTED_TAG, s))
 | 
			
		||||
		pvd->vg_name[l - s + 1] = '\0';
 | 
			
		||||
 | 
			
		||||
	data->pvd.pv_status |= VG_EXPORTED;
 | 
			
		||||
	pvd->pv_status |= VG_EXPORTED;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static struct disk_list *__read_disk(const struct format_type *fmt,
 | 
			
		||||
@@ -295,6 +296,9 @@ static struct disk_list *__read_disk(const struct format_type *fmt,
 | 
			
		||||
		goto bad;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* If VG is exported, set VG name back to the real name */
 | 
			
		||||
	munge_exported_vg(&dl->pvd);
 | 
			
		||||
 | 
			
		||||
	if (!(info = lvmcache_add(fmt->labeller, dl->pvd.pv_uuid, dev,
 | 
			
		||||
				  dl->pvd.vg_name, NULL)))
 | 
			
		||||
		stack;
 | 
			
		||||
@@ -321,9 +325,6 @@ static struct disk_list *__read_disk(const struct format_type *fmt,
 | 
			
		||||
		goto bad;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* If VG is exported, set VG name back to the real name */
 | 
			
		||||
	_munge_exported_vg(dl);
 | 
			
		||||
 | 
			
		||||
	/* Update VG cache with what we found */
 | 
			
		||||
	/* vgcache_add(dl->pvd.vg_name, dl->vgd.vg_uuid, dev, fmt); */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -224,6 +224,7 @@ int export_uuids(struct disk_list *dl, struct volume_group *vg);
 | 
			
		||||
void export_numbers(struct list *pvds, struct volume_group *vg);
 | 
			
		||||
 | 
			
		||||
void export_pv_act(struct list *pvds);
 | 
			
		||||
void munge_exported_vg(struct pv_disk *pvd);
 | 
			
		||||
 | 
			
		||||
/* blech */
 | 
			
		||||
int get_free_vg_number(struct format_instance *fid, struct dev_filter *filter,
 | 
			
		||||
 
 | 
			
		||||
@@ -51,6 +51,7 @@ static int _read(struct labeller *l, struct device *dev, char *buf,
 | 
			
		||||
	struct pv_disk *pvd = (struct pv_disk *) buf;
 | 
			
		||||
	struct lvmcache_info *info;
 | 
			
		||||
 | 
			
		||||
	munge_exported_vg(pvd);
 | 
			
		||||
	if (!(info = lvmcache_add(l, pvd->pv_uuid, dev, pvd->vg_name, NULL)))
 | 
			
		||||
		return 0;
 | 
			
		||||
	*label = info->label;
 | 
			
		||||
 
 | 
			
		||||
@@ -666,7 +666,7 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vgname,
 | 
			
		||||
 | 
			
		||||
	if ((correct_vg->status & PVMOVE) && !pvmove_mode()) {
 | 
			
		||||
		log_error("WARNING: Interrupted pvmove detected in "
 | 
			
		||||
			  "volume group %s", vg->name);
 | 
			
		||||
			  "volume group %s", correct_vg->name);
 | 
			
		||||
		log_error("Please restore the metadata by running "
 | 
			
		||||
			  "vgcfgrestore.");
 | 
			
		||||
		return NULL;
 | 
			
		||||
 
 | 
			
		||||
@@ -54,6 +54,7 @@ xx(lvchange,
 | 
			
		||||
   "\t[-a|--available y|n]\n"
 | 
			
		||||
   "\t[-C|--contiguous y|n]\n"
 | 
			
		||||
   "\t[-d|--debug]\n"
 | 
			
		||||
   "\t[-f|--force]\n"
 | 
			
		||||
   "\t[-h|--help]\n"
 | 
			
		||||
   "\t[--ignorelockingfailure]\n"
 | 
			
		||||
   "\t[-M|--persistent y|n] [--major major] [--minor minor]\n"
 | 
			
		||||
@@ -65,7 +66,7 @@ xx(lvchange,
 | 
			
		||||
   "\t[--version]" "\n"
 | 
			
		||||
   "\tLogicalVolume[Path] [LogicalVolume[Path]...]\n",
 | 
			
		||||
 | 
			
		||||
   autobackup_ARG, available_ARG, contiguous_ARG,
 | 
			
		||||
   autobackup_ARG, available_ARG, contiguous_ARG, force_ARG,
 | 
			
		||||
   ignorelockingfailure_ARG, major_ARG, minor_ARG, partial_ARG, permission_ARG,
 | 
			
		||||
   persistent_ARG, readahead_ARG, test_ARG)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -227,6 +227,7 @@ static int lvchange_readahead(struct cmd_context *cmd,
 | 
			
		||||
static int lvchange_persistent(struct cmd_context *cmd,
 | 
			
		||||
			       struct logical_volume *lv)
 | 
			
		||||
{
 | 
			
		||||
	struct lvinfo info;
 | 
			
		||||
 | 
			
		||||
	if (!strcmp(arg_str_value(cmd, persistent_ARG, "n"), "n")) {
 | 
			
		||||
		if (!(lv->status & FIXED_MINOR)) {
 | 
			
		||||
@@ -248,8 +249,19 @@ static int lvchange_persistent(struct cmd_context *cmd,
 | 
			
		||||
			log_error("Major number must be specified with -My");
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
		log_verbose("Ensuring %s is inactive. Reactivate with -ay.",
 | 
			
		||||
			    lv->name);
 | 
			
		||||
		if (lv_info(lv, &info) && info.exists && 
 | 
			
		||||
			!arg_count(cmd, force_ARG)) {
 | 
			
		||||
			if (yes_no_prompt("Logical volume %s will be "
 | 
			
		||||
					  "deactivated first. "
 | 
			
		||||
					  "Continue? [y/n]: ",
 | 
			
		||||
					  lv->name) == 'n') {
 | 
			
		||||
				log_print("%s device number not changed.",
 | 
			
		||||
					  lv->name);
 | 
			
		||||
				return 0;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		log_print("Ensuring %s is inactive. "
 | 
			
		||||
			  "(Reactivate using lvchange -ay.)", lv->name);
 | 
			
		||||
		if (!lock_vol(cmd, lv->lvid.s, LCK_LV_DEACTIVATE)) {
 | 
			
		||||
			log_error("%s: deactivation failed", lv->name);
 | 
			
		||||
			return 0;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user