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

log: use separate 'orphan' report object type for orphan VGs

This commit is contained in:
Peter Rajnoha 2016-06-14 13:21:53 +02:00
parent 89e2aef63a
commit cee1aedf12
4 changed files with 23 additions and 12 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.158 -
=================================
Use 'orphan' object type in cmd log for groups to collect PVs not yet in VGs.
Add lvm lastlog command for query and display of last cmd's log in lvm shell.
Report per-object return codes via cmd log while processing multiple objects.
Annotate processing code with log report hooks for per-object command log.

View File

@ -298,6 +298,7 @@ const char *log_get_report_context_name(log_report_context_t context)
const char *log_get_report_object_type_name(log_report_object_type_t object_type)
{
static const char *log_object_type_names[LOG_REPORT_OBJECT_TYPE_COUNT] = {[LOG_REPORT_OBJECT_TYPE_NULL] = "",
[LOG_REPORT_OBJECT_TYPE_ORPHAN] = "orphan",
[LOG_REPORT_OBJECT_TYPE_PV] = "pv",
[LOG_REPORT_OBJECT_TYPE_VG] = "vg",
[LOG_REPORT_OBJECT_TYPE_LV] = "lv"};

View File

@ -74,6 +74,7 @@ typedef enum {
typedef enum {
LOG_REPORT_OBJECT_TYPE_NULL,
LOG_REPORT_OBJECT_TYPE_ORPHAN,
LOG_REPORT_OBJECT_TYPE_PV,
LOG_REPORT_OBJECT_TYPE_VG,
LOG_REPORT_OBJECT_TYPE_LV,

View File

@ -1894,11 +1894,14 @@ static int _process_vgnameid_list(struct cmd_context *cmd, uint32_t read_flags,
notfound = 0;
uuid[0] = '\0';
if (vg_uuid && !is_orphan_vg(vg_name) &&
!id_write_format((const struct id*)vg_uuid, uuid, sizeof(uuid)))
stack;
log_set_report_object_name_and_id(vg_name, uuid);
if (is_orphan_vg(vg_name)) {
log_set_report_object_type(LOG_REPORT_OBJECT_TYPE_ORPHAN);
log_set_report_object_name_and_id(vg_name + sizeof(VG_ORPHANS), uuid);
} else {
if (vg_uuid && !id_write_format((const struct id*)vg_uuid, uuid, sizeof(uuid)))
stack;
log_set_report_object_name_and_id(vg_name, uuid);
}
if (sigint_caught()) {
ret_max = ECMD_FAILED;
@ -3306,7 +3309,8 @@ static int _process_pvs_in_vg(struct cmd_context *cmd,
goto_out;
}
log_set_report_object_group_and_group_id(vg->name, vg_uuid);
if (!is_orphan_vg(vg->name))
log_set_report_object_group_and_group_id(vg->name, vg_uuid);
dm_list_iterate_items(pvl, &vg->pvs) {
pv = pvl->pv;
@ -3430,11 +3434,14 @@ static int _process_pvs_in_vgs(struct cmd_context *cmd, uint32_t read_flags,
notfound = 0;
uuid[0] = '\0';
if (vg_uuid && !is_orphan_vg(vg_name) &&
!id_write_format((const struct id*)vg_uuid, uuid, sizeof(uuid)))
stack;
log_set_report_object_name_and_id(vg_name, uuid);
if (is_orphan_vg(vg_name)) {
log_set_report_object_type(LOG_REPORT_OBJECT_TYPE_ORPHAN);
log_set_report_object_name_and_id(vg_name + sizeof(VG_ORPHANS), uuid);
} else {
if (vg_uuid && !id_write_format((const struct id*)vg_uuid, uuid, sizeof(uuid)))
stack;
log_set_report_object_name_and_id(vg_name, uuid);
}
if (sigint_caught()) {
ret_max = ECMD_FAILED;
@ -3750,7 +3757,8 @@ int process_each_pv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
if (!id_write_format(&vg->id, vg_uuid, sizeof(vg_uuid)))
stack;
log_set_report_object_group_and_group_id(vg->name, vg_uuid);
if (!is_orphan_vg(vg->name))
log_set_report_object_group_and_group_id(vg->name, vg_uuid);
dm_list_iterate_items(pvl, &vg->pvs) {
pv_uuid[0] = '\0';