diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2016-03-09 18:00:57 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2016-03-10 18:38:53 +0100 |
commit | 29d1533a497be922dc114524b83e926cbb63c34a (patch) | |
tree | 2a8ac81e05b375d70c0fea8bc1d3d2e8fb583c10 /libdm/libdm-targets.c | |
parent | 9918d95490d46dee12768494dcc8afe784dd19c0 (diff) | |
download | lvm2-29d1533a497be922dc114524b83e926cbb63c34a.tar.gz |
libdm: parse more info from cache status
Parse Fail/Error/need_check/ro status info from cache.
Diffstat (limited to 'libdm/libdm-targets.c')
-rw-r--r-- | libdm/libdm-targets.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libdm/libdm-targets.c b/libdm/libdm-targets.c index 7428eba8a..bd6e5e267 100644 --- a/libdm/libdm-targets.c +++ b/libdm/libdm-targets.c @@ -194,6 +194,17 @@ int dm_get_status_cache(struct dm_pool *mem, const char *params, if (!(s = dm_pool_zalloc(mem, sizeof(struct dm_status_cache)))) return_0; + if (strstr(params, "Error")) { + s->error = 1; + s->fail = 1; /* This is also I/O fail state */ + goto out; + } + + if (strstr(params, "Fail")) { + s->fail = 1; + goto out; + } + /* Read in args that have definitive placement */ if (sscanf(params, " %" PRIu32 @@ -258,6 +269,13 @@ int dm_get_status_cache(struct dm_pool *mem, const char *params, (dm_split_words(str, s->policy_argc, 0, s->policy_argv) != s->policy_argc))) goto bad; + /* TODO: improve this parser */ + if (strstr(p, " ro")) + s->read_only = 1; + + if (strstr(p, " needs_check")) + s->needs_check = 1; +out: *status = s; return 1; |