]> sourceware.org Git - lvm2.git/commitdiff
Refactor and add code for (lv) 'move_pv' get function.
authorDave Wysochanski <dwysocha@redhat.com>
Tue, 12 Oct 2010 16:12:02 +0000 (16:12 +0000)
committerDave Wysochanski <dwysocha@redhat.com>
Tue, 12 Oct 2010 16:12:02 +0000 (16:12 +0000)
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-By: Petr Rockai <prockai@redhat.com>
lib/metadata/lv.c
lib/metadata/lv.h
lib/report/properties.c
lib/report/report.c

index 48707ff84c742d28f52b3df6f325cf59ef986316..4ceb7136f75931ab9efbb4a44841ee11d69010fe 100644 (file)
 #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))
index 69c4077ac69b1e4dd1004bd0807b6c5974c92c77..bfb38f9436c1da64c035373aa293f8dcf5242127 100644 (file)
@@ -54,5 +54,6 @@ char *lv_uuid_dup(const struct logical_volume *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
index 27503a95f0c4e836793b72dde12fe921e1d91608..bcec0c848362c626ebb3d1852d5e9d06bf072e5c 100644 (file)
@@ -129,7 +129,7 @@ GET_LV_NUM_PROPERTY_FN(origin_size, lv_origin_size(lv))
 #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
index 83216b28aa988e1cf148cf208121720078f6edd4..26ff879512d28dedc0ec8b92788fc9457a68a2e7 100644 (file)
@@ -378,16 +378,11 @@ static int _movepv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__(
 {
        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;
 }
 
This page took 0.044066 seconds and 5 git commands to generate.