#include "activate.h"
#include "toolcontext.h"
+char *lv_move_pv_dup(struct dm_pool *mem, const struct logical_volume *lv)
+{
+ struct lv_segment *seg;
+
+ dm_list_iterate_items(seg, &lv->segments) {
+ if (seg->status & PVMOVE)
+ return dm_pool_strdup(mem, dev_name(seg_dev(seg, 0)));
+ }
+ return NULL;
+}
+
uint64_t lv_origin_size(const struct logical_volume *lv)
{
if (lv_is_cow(lv))
char *lv_tags_dup(const struct logical_volume *lv);
char *lv_path_dup(struct dm_pool *mem, const struct logical_volume *lv);
uint64_t lv_origin_size(const struct logical_volume *lv);
+char *lv_move_pv_dup(struct dm_pool *mem, const struct logical_volume *lv);
#endif
#define _snap_percent_set _not_implemented_set
#define _copy_percent_get _not_implemented_get
#define _copy_percent_set _not_implemented_set
-#define _move_pv_get _not_implemented_get
+GET_LV_STR_PROPERTY_FN(move_pv, lv_move_pv_dup(lv->vg->vgmem, lv))
#define _move_pv_set _not_implemented_set
#define _convert_lv_get _not_implemented_get
#define _convert_lv_set _not_implemented_set
{
const struct logical_volume *lv = (const struct logical_volume *) data;
const char *name;
- struct lv_segment *seg;
- dm_list_iterate_items(seg, &lv->segments) {
- if (!(seg->status & PVMOVE))
- continue;
- name = dev_name(seg_dev(seg, 0));
+ if (!(name = lv_move_pv_dup(mem, lv)))
+ dm_report_field_set_value(field, "", NULL);
+ else
return dm_report_field_string(rh, field, &name);
- }
-
- dm_report_field_set_value(field, "", NULL);
return 1;
}