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

report: reporting unknown status

Add SEG_STATUS_UNKNOWN when status cannot be parsed.
Also add 'info_ok' variable when info was correctly obtained.
This commit is contained in:
Zdenek Kabelac 2015-01-20 12:38:38 +01:00
parent 64d8ed502d
commit e34b004422
2 changed files with 11 additions and 13 deletions

View File

@ -36,7 +36,8 @@ typedef enum {
SEG_STATUS_RAID,
SEG_STATUS_SNAPSHOT,
SEG_STATUS_THIN,
SEG_STATUS_THIN_POOL
SEG_STATUS_THIN_POOL,
SEG_STATUS_UNKNOWN
} lv_seg_status_type_t;
struct lv_seg_status {
@ -48,6 +49,7 @@ struct lv_seg_status {
struct lv_with_info_and_seg_status {
const struct logical_volume *lv; /* input */
int info_ok;
struct lvinfo info; /* output */
int seg_part_of_lv; /* output */
struct lv_seg_status seg_status; /* input/output, see lv_seg_status */

View File

@ -57,27 +57,23 @@ static int _do_info_and_status(struct cmd_context *cmd,
struct lv_with_info_and_seg_status *status,
int do_info, int do_status)
{
status->seg_status.mem = NULL;
unsigned use_layer = lv_is_thin_pool(lv) ? 1 : 0;
status->lv = lv;
if (do_status) {
if (!(status->seg_status.mem = dm_pool_create("reporter_pool", 1024)))
return_0;
if (!lv_seg)
_choose_lv_segment_for_status_report(lv, &lv_seg);
if (do_info) {
if (do_info)
/* both info and status */
if (!lv_info_with_seg_status(cmd, lv, lv_seg, 0, status, 1, 1))
status->info.exists = 0;
} else {
status->info_ok = lv_info_with_seg_status(cmd, lv, lv_seg, use_layer, status, 1, 1);
else
/* status only */
if (!lv_status(cmd, lv_seg, &status->seg_status))
status->info.exists = 0;
}
} else if (do_info) {
status->info_ok = lv_status(cmd, lv_seg, use_layer, &status->seg_status);
} else if (do_info)
/* info only */
if (!lv_info(cmd, lv, 0, &status->info, 1, 1))
status->info.exists = 0;
}
status->info_ok = lv_info(cmd, lv, use_layer, &status->info, 1, 1);
return 1;
}