1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

lvmpolld: report percent complete in answer to progress_info

This commit is contained in:
Ondrej Kozina 2016-03-10 16:37:44 +01:00
parent d93e6156b9
commit 3ec31733dc
4 changed files with 12 additions and 1 deletions

View File

@ -597,11 +597,14 @@ static response progress_info(client_handle h, struct lvmpolld_state *ls, reques
if (st.polling_finished)
r = daemon_reply_simple(LVMPD_RESP_FINISHED,
LVMPD_PARM_DATA " = " FMTd64, st.percent,
"reason = %s", st.cmd_state.signal ? LVMPD_REAS_SIGNAL : LVMPD_REAS_RETCODE,
LVMPD_PARM_VALUE " = " FMTd64, (int64_t)(st.cmd_state.signal ?: st.cmd_state.retcode),
NULL);
else
r = daemon_reply_simple(LVMPD_RESP_IN_PROGRESS, NULL);
r = daemon_reply_simple(LVMPD_RESP_IN_PROGRESS,
LVMPD_PARM_DATA " = " FMTd64, st.percent,
NULL);
}
else
r = daemon_reply_simple(LVMPD_RESP_NOT_FOUND, NULL);

View File

@ -170,6 +170,7 @@ struct lvmpolld_lv_state pdlv_get_status(struct lvmpolld_lv *pdlv)
r.error = pdlv_locked_error(pdlv);
r.polling_finished = pdlv_locked_polling_finished(pdlv);
r.cmd_state = pdlv_locked_cmd_state(pdlv);
r.percent = pdlv_locked_percent(pdlv);
pdlv_unlock(pdlv);
return r;

View File

@ -83,6 +83,7 @@ struct lvmpolld_lv_state {
unsigned error:1;
unsigned polling_finished:1;
struct lvmpolld_cmd_stat cmd_state;
dm_percent_t percent;
};
struct lvmpolld_thread_data {
@ -164,6 +165,11 @@ static inline unsigned pdlv_locked_error(const struct lvmpolld_lv *pdlv)
return pdlv->error;
}
static inline dm_percent_t pdlv_locked_percent(const struct lvmpolld_lv *pdlv)
{
return pdlv->percent;
}
/* struct lvmpolld_store manipulation routines */
struct lvmpolld_store *pdst_init(const char *name);

View File

@ -30,6 +30,7 @@
#define LVMPD_PARM_ABORT "abort"
#define LVMPD_PARM_CMDLINE "cmdline"
#define LVMPD_PARM_DATA "data"
#define LVMPD_PARM_HANDLE_MISSING_PVS "handle_missing_pvs"
#define LVMPD_PARM_INTERVAL "interval"
#define LVMPD_PARM_LVID "lvid"