]> sourceware.org Git - lvm2.git/commitdiff
thin: report PERCENT_INVALID for failed pool
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 18 Feb 2016 12:18:18 +0000 (13:18 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 18 Feb 2016 15:45:42 +0000 (16:45 +0100)
When thin-pool is in failed/error state, we can't
read percentage so report invalid value.

WHATS_NEW
lib/thin/thin.c

index bf3fc0759a33abd905608b12e3baffa36da4eff0..27bb7e2ada30d5dfa7a2576ecae258c6c6e6732e 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.143 -
 =====================================
+  For failing thin-pool and thin volume correctly report percentage as INVALID.
   Report -1, not 'unkown' for lv_{snapshot_invalid,merge_failed} with --binary.
   Add configure --enable-dbus-service for an LVM D-Bus service.
   Replace configure --enable-python_bindings with python2 and python3 versions.
index c9ee9f5301f684c5b01daa6912263e1983c608da..221ac48cef7093cfda72dd34d4eae025aeae383a 100644 (file)
@@ -404,8 +404,10 @@ static int _thin_pool_target_percent(void **target_state __attribute__((unused))
        if (!dm_get_status_thin_pool(mem, params, &s))
                return_0;
 
+       if (s->fail || s->error)
+               *percent = DM_PERCENT_INVALID;
        /* With 'seg' report metadata percent, otherwice data percent */
-       if (seg) {
+       else if (seg) {
                *percent = dm_make_percent(s->used_metadata_blocks,
                                           s->total_metadata_blocks);
                *total_numerator += s->used_metadata_blocks;
@@ -622,7 +624,9 @@ static int _thin_target_percent(void **target_state __attribute__((unused)),
        if (!dm_get_status_thin(mem, params, &s))
                return_0;
 
-       if (seg) {
+       if (s->fail)
+               *percent = DM_PERCENT_INVALID;
+       else if (seg) {
                /* Pool allocates whole chunk so round-up to nearest one */
                csize = first_seg(seg->pool_lv)->chunk_size;
                csize = ((seg->lv->size + csize - 1) / csize) * csize;
This page took 0.050793 seconds and 5 git commands to generate.