1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-24 17:57:48 +03:00

lvmcache: remove wrapper around lvmcache_get_vgnameids

This was left over from when there was an lvmetad
version of the function.
This commit is contained in:
David Teigland 2019-06-11 14:09:13 -05:00
parent 0f350ba890
commit 4bb7d3da0e
6 changed files with 24 additions and 33 deletions

18
lib/cache/lvmcache.c vendored
View File

@ -947,12 +947,26 @@ int lvmcache_label_scan(struct cmd_context *cmd)
return r;
}
int lvmcache_get_vgnameids(struct cmd_context *cmd, int include_internal,
struct dm_list *vgnameids)
int lvmcache_get_vgnameids(struct cmd_context *cmd,
struct dm_list *vgnameids,
const char *only_this_vgname,
int include_internal)
{
struct vgnameid_list *vgnl;
struct lvmcache_vginfo *vginfo;
if (only_this_vgname) {
if (!(vgnl = dm_pool_alloc(cmd->mem, sizeof(*vgnl)))) {
log_error("vgnameid_list allocation failed.");
return 0;
}
vgnl->vg_name = dm_pool_strdup(cmd->mem, only_this_vgname);
vgnl->vgid = NULL;
dm_list_add(vgnameids, &vgnl->list);
return 1;
}
dm_list_iterate_items(vginfo, &_vginfos) {
if (!include_internal && is_orphan_vg(vginfo->vgname))
continue;

View File

@ -103,8 +103,10 @@ struct device *lvmcache_device_from_pvid(struct cmd_context *cmd, const struct i
const char *lvmcache_vgname_from_info(struct lvmcache_info *info);
const struct format_type *lvmcache_fmt_from_info(struct lvmcache_info *info);
int lvmcache_get_vgnameids(struct cmd_context *cmd, int include_internal,
struct dm_list *vgnameids);
int lvmcache_get_vgnameids(struct cmd_context *cmd,
struct dm_list *vgnameids,
const char *only_this_vgname,
int include_internal);
void lvmcache_drop_metadata(const char *vgname, int drop_precommitted);
void lvmcache_commit_metadata(const char *vgname);

View File

@ -696,9 +696,6 @@ int unlink_lv_from_vg(struct logical_volume *lv);
void lv_set_visible(struct logical_volume *lv);
void lv_set_hidden(struct logical_volume *lv);
int get_vgnameids(struct cmd_context *cmd, struct dm_list *vgnameids,
const char *only_this_vgname, int include_internal);
int pv_write(struct cmd_context *cmd, struct physical_volume *pv, int allow_non_orphan);
int move_pv(struct volume_group *vg_from, struct volume_group *vg_to,
const char *pv_name);

View File

@ -3566,28 +3566,6 @@ void set_pv_devices(struct format_instance *fid, struct volume_group *vg)
_set_pv_device(fid, vg, pvl->pv);
}
int get_vgnameids(struct cmd_context *cmd, struct dm_list *vgnameids,
const char *only_this_vgname, int include_internal)
{
struct vgnameid_list *vgnl;
if (only_this_vgname) {
if (!(vgnl = dm_pool_alloc(cmd->mem, sizeof(*vgnl)))) {
log_error("vgnameid_list allocation failed.");
return 0;
}
vgnl->vg_name = dm_pool_strdup(cmd->mem, only_this_vgname);
vgnl->vgid = NULL;
dm_list_add(vgnameids, &vgnl->list);
return 1;
}
lvmcache_get_vgnameids(cmd, include_internal, vgnameids);
return 1;
}
int pv_write(struct cmd_context *cmd,
struct physical_volume *pv, int allow_non_orphan)
{

View File

@ -2262,7 +2262,7 @@ int process_each_vg(struct cmd_context *cmd,
*/
log_very_verbose("Obtaining the complete list of VGs to process");
if (!get_vgnameids(cmd, &vgnameids_on_system, NULL, include_internal)) {
if (!lvmcache_get_vgnameids(cmd, &vgnameids_on_system, NULL, include_internal)) {
ret_max = ECMD_FAILED;
goto_out;
}
@ -3807,7 +3807,7 @@ int process_each_lv(struct cmd_context *cmd,
*/
log_very_verbose("Obtaining the complete list of VGs before processing their LVs");
if (!get_vgnameids(cmd, &vgnameids_on_system, NULL, 0)) {
if (!lvmcache_get_vgnameids(cmd, &vgnameids_on_system, NULL, 0)) {
ret_max = ECMD_FAILED;
goto_out;
}
@ -4479,7 +4479,7 @@ int process_each_pv(struct cmd_context *cmd,
if (!(read_flags & PROCESS_SKIP_SCAN))
lvmcache_label_scan(cmd);
if (!get_vgnameids(cmd, &all_vgnameids, only_this_vgname, 1)) {
if (!lvmcache_get_vgnameids(cmd, &all_vgnameids, only_this_vgname, 1)) {
ret_max = ret;
goto_out;
}

View File

@ -296,7 +296,7 @@ int vgimportclone(struct cmd_context *cmd, int argc, char **argv)
vgname_count = 1;
}
if (!get_vgnameids(cmd, &vgnameids_on_system, NULL, 0))
if (!lvmcache_get_vgnameids(cmd, &vgnameids_on_system, NULL, 0))
goto_out;
retry_name: