summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2020-09-25 19:10:30 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2020-10-19 16:53:18 +0200
commit4b0565b82f9f2bab0d9fdbc23c63e63cbddba61d (patch)
tree955fd38c820d2abb8316bc0a7b5887e70b99c65f
parent4c1caa7e26b6f8011ca083395650d11943a42a8a (diff)
downloadlvm2-4b0565b82f9f2bab0d9fdbc23c63e63cbddba61d.tar.gz
libdm: enhance error message
-rw-r--r--libdm/libdm-deptree.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 887e8f275..ffd084e52 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -1503,8 +1503,37 @@ static int _thin_pool_node_message(struct dm_tree_node *dnode, struct thin_messa
}
if (!_node_message(dnode->info.major, dnode->info.minor,
- tm->expected_errno, buf))
- return_0;
+ tm->expected_errno, buf)) {
+ switch (m->type) {
+ case DM_THIN_MESSAGE_CREATE_SNAP:
+ case DM_THIN_MESSAGE_CREATE_THIN:
+ if (errno == EEXIST) {
+ /*
+ * ATM errno from ioctl() is preserved through code error path chain
+ * If this would ever change, another way need to be used to
+ * obtain result from failed DM message
+ */
+ log_error("Thin pool %s already contain thin device with device_id %u.",
+ _node_name(dnode), m->u.m_create_snap.device_id);
+ /*
+ * TODO:
+ *
+ * Give some useful advice how to solve this problem,
+ * until lvconvert --repair can handle this automatically
+ */
+ log_error("Manual intervention may be required to remove device dev_id=%u in thin pool metadata.",
+ m->u.m_create_snap.device_id);
+ log_error("Optionally new thin volume with device_id=%u can be manually added into a volume group.",
+ m->u.m_create_snap.device_id);
+ log_warn("WARNING: When uncertain how to do this, contact support!");
+ return 0;
+ }
+ /* fall through */
+ default:
+ return_0;
+ }
+
+ }
return 1;
}