|
|
|
@@ -1244,13 +1244,14 @@ static int _online_devs(struct cmd_context *cmd, int do_all, struct dm_list *pvs
|
|
|
|
|
struct format_instance *fid;
|
|
|
|
|
struct metadata_area *mda1, *mda2;
|
|
|
|
|
struct volume_group *vg;
|
|
|
|
|
const char *vgname;
|
|
|
|
|
const char *vgname = NULL;
|
|
|
|
|
uint32_t ext_version, ext_flags;
|
|
|
|
|
int do_cache = arg_is_set(cmd, cache_long_ARG);
|
|
|
|
|
int do_activate = arg_is_set(cmd, activate_ARG);
|
|
|
|
|
int list_lvs = arg_is_set(cmd, listlvs_ARG);
|
|
|
|
|
int list_vg = arg_is_set(cmd, listvg_ARG);
|
|
|
|
|
int check_complete = arg_is_set(cmd, checkcomplete_ARG);
|
|
|
|
|
int do_list_lvs = arg_is_set(cmd, listlvs_ARG);
|
|
|
|
|
int do_list_vg = arg_is_set(cmd, listvg_ARG);
|
|
|
|
|
int do_check_complete = arg_is_set(cmd, checkcomplete_ARG);
|
|
|
|
|
int do_vgonline = arg_is_set(cmd, vgonline_ARG);
|
|
|
|
|
int pvs_online;
|
|
|
|
|
int pvs_offline;
|
|
|
|
|
int pvs_unknown;
|
|
|
|
@@ -1360,7 +1361,7 @@ static int _online_devs(struct cmd_context *cmd, int do_all, struct dm_list *pvs
|
|
|
|
|
/*
|
|
|
|
|
* A plain pvscan --cache <dev> just creates the online file.
|
|
|
|
|
*/
|
|
|
|
|
if (!do_activate && !list_lvs && !list_vg) {
|
|
|
|
|
if (!do_activate && !do_list_lvs && !do_list_vg) {
|
|
|
|
|
log_print("pvscan[%d] PV %s online.", getpid(), dev_name(dev));
|
|
|
|
|
release_vg(vg);
|
|
|
|
|
continue;
|
|
|
|
@@ -1372,7 +1373,7 @@ static int _online_devs(struct cmd_context *cmd, int do_all, struct dm_list *pvs
|
|
|
|
|
* complete_vgnames (activation phase will want to know which
|
|
|
|
|
* VGs to activate.)
|
|
|
|
|
*/
|
|
|
|
|
if (do_activate || check_complete) {
|
|
|
|
|
if (do_activate || do_check_complete) {
|
|
|
|
|
pvs_online = 0;
|
|
|
|
|
pvs_offline = 0;
|
|
|
|
|
pvs_unknown = 0;
|
|
|
|
@@ -1429,7 +1430,38 @@ static int _online_devs(struct cmd_context *cmd, int do_all, struct dm_list *pvs
|
|
|
|
|
if (!vgname && vg)
|
|
|
|
|
vgname = vg->name;
|
|
|
|
|
|
|
|
|
|
if (list_lvs) {
|
|
|
|
|
if (do_list_vg || do_list_lvs) {
|
|
|
|
|
if (!vgname)
|
|
|
|
|
log_print("VG unknown");
|
|
|
|
|
else if (!do_check_complete)
|
|
|
|
|
log_print("VG %s", vgname);
|
|
|
|
|
else if (vg_complete) {
|
|
|
|
|
if (do_vgonline && !_online_vg_file_create(cmd, vgname))
|
|
|
|
|
log_print("VG %s finished", vgname);
|
|
|
|
|
else
|
|
|
|
|
log_print("VG %s complete", vgname);
|
|
|
|
|
} else {
|
|
|
|
|
log_print("VG %s incomplete", vgname);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* When the VG is complete|finished, we could print
|
|
|
|
|
* a list of devices in the VG, by reading the pvid files
|
|
|
|
|
* that were counted, which provides major:minor of each
|
|
|
|
|
* device and using that to get the struct dev and dev_name.
|
|
|
|
|
* The user could pass this list of devices to --devices
|
|
|
|
|
* to optimize a subsequent command (activation) on the VG.
|
|
|
|
|
* Just call set_pv_devices_online (if not done othewise)
|
|
|
|
|
* since that finds the devs.
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (do_list_lvs && !vg) {
|
|
|
|
|
/* require all PVs used for booting have metadata */
|
|
|
|
|
log_print("Cannot list LVs from device without metadata.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (do_list_lvs && vg) {
|
|
|
|
|
struct dm_list lvs_list;
|
|
|
|
|
struct lv_list *lvl;
|
|
|
|
|
|
|
|
|
@@ -1447,7 +1479,7 @@ static int _online_devs(struct cmd_context *cmd, int do_all, struct dm_list *pvs
|
|
|
|
|
if (!get_visible_lvs_using_pv(cmd, vg, dev, &lvs_list))
|
|
|
|
|
log_warn("WARNING: failed to find LVs using %s.", dev_name(dev));
|
|
|
|
|
|
|
|
|
|
if (!check_complete) {
|
|
|
|
|
if (!do_check_complete) {
|
|
|
|
|
dm_list_iterate_items(lvl, &lvs_list)
|
|
|
|
|
log_print("LV %s", display_lvname(lvl->lv));
|
|
|
|
|
} else if (vg_complete) {
|
|
|
|
@@ -1473,17 +1505,6 @@ static int _online_devs(struct cmd_context *cmd, int do_all, struct dm_list *pvs
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (list_vg) {
|
|
|
|
|
if (!vgname)
|
|
|
|
|
log_print("VG unknown");
|
|
|
|
|
else if (!check_complete)
|
|
|
|
|
log_print("VG %s", vgname);
|
|
|
|
|
else if (vg_complete)
|
|
|
|
|
log_print("VG %s complete", vgname);
|
|
|
|
|
else
|
|
|
|
|
log_print("VG %s incomplete", vgname);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* When "pvscan --cache -aay <dev>" completes the vg, save the
|
|
|
|
|
* struct vg to use for quick activation function.
|
|
|
|
|