master - dev_manager: add dev_manager_vdo_pool_status
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4f708e870974fb9414ce7f1b7d277f14af6c2d38 Commit: 4f708e870974fb9414ce7f1b7d277f14af6c2d38 Parent: 493ffe7a0f4646d151bd4a48e2ec9756892c4944 Author: Zdenek Kabelac <[email protected]> AuthorDate: Fri Jun 29 11:15:54 2018 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Jul 9 15:28:35 2018 +0200
dev_manager: add dev_manager_vdo_pool_status
--- lib/activate/activate.c | 40 +++++++++++++++++++++++++++++ lib/activate/activate.h | 2 + lib/activate/dev_manager.c | 59 ++++++++++++++++++++++++++++++++++++++++++++ lib/activate/dev_manager.h | 5 +++ 4 files changed, 106 insertions(+), 0 deletions(-)
lib/activate/activate.c +40 -0
@@ -1313,6 +1313,46 @@ int lv_thin_device_id(const struct logical_volume *lv, uint32_t *device_id)return r; } +/* +* lv_vdo_pool_status obtains status information about VDO pool +* +* If the 'params' string has been already retrieved, use it. +* If the mempool already exists, use it. +* +*/ +int lv_vdo_pool_status (const struct logical_volume *lv,int flush, +struct lv_status_vdo **vdo_status) +{ +int r =0 ; +struct dev_manager *dm; +struct lv_status_vdo *status; +char *params; + +if (!lv_info (lv->vg->cmd, lv,0 ,NULL ,0 ,0 )) +return 0 ; + +log_debug_activation ("Checking VDO pool status for LV %s." , +display_lvname (lv)); + +if (!(dm =dev_manager_create (lv->vg->cmd, lv->vg->name, !lv_is_pvmove (lv)))) + return_0; + +if (!dev_manager_vdo_pool_status (dm, lv, flush, ¶ms, &status)) + goto_out; + +if (!parse_vdo_pool_status (status->mem, lv, params, status)) + goto_out; + +/* User is responsible to dm_pool_destroy memory pool! */ + *vdo_status = status; + r =1 ; +out: +if (!r) +dev_manager_destroy (dm); + +return r; +} +static int _lv_active (struct cmd_context *cmd,const struct logical_volume *lv) {struct lvinfo info;
lib/activate/activate.h +2 -0
@@ -193,6 +193,8 @@ int lv_thin_percent(const struct logical_volume *lv, int mapped,int lv_thin_pool_transaction_id (const struct logical_volume *lv,uint64_t *transaction_id);int lv_thin_device_id (const struct logical_volume *lv,uint32_t *device_id); +int lv_vdo_pool_status (const struct logical_volume *lv,int flush, +struct lv_status_vdo **status);/* * Return number of LVs in the VG that are active.
lib/activate/dev_manager.c +59 -0
65 lines not on this page · raw message
lib/activate/dev_manager.h +5 -0
@@ -79,6 +79,11 @@ int dev_manager_thin_percent(struct dev_manager *dm,int dev_manager_thin_device_id (struct dev_manager *dm,const struct logical_volume *lv,uint32_t *device_id); +int dev_manager_vdo_pool_status (struct dev_manager *dm, +const struct logical_volume *lv, +int flush, +char **vdo_params, +struct lv_status_vdo **vdo_status);int dev_manager_suspend (struct dev_manager *dm,const struct logical_volume *lv,struct lv_activate_opts *laopts,int lockfs,int flush_required); int dev_manager_activate(struct dev_manager *dm, const struct logical_volume *lv,