summaryrefslogtreecommitdiffstats
path: root/daemons
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2012-03-02 20:46:36 +0000
committerAlasdair Kergon <agk@redhat.com>2012-03-02 20:46:36 +0000
commit9c159ea320a4cf9db8d48c4983ccb4088a980d55 (patch)
tree7638ded3f13c85562259e3bb915147a772e3b0b2 /daemons
parent79c42c6600abb4b766d93fb9b95d553d059db011 (diff)
downloadlvm2-9c159ea320a4cf9db8d48c4983ccb4088a980d55.tar.gz
lvm2-9c159ea320a4cf9db8d48c4983ccb4088a980d55.tar.xz
lvm2-9c159ea320a4cf9db8d48c4983ccb4088a980d55.zip
Pass struct device around internally rather than dev_t.
Add 3rd daemon return state "unknown" for lookups that are carried out successfully but don't find the item requested. Avoid issuing error messages when it's expected that a device that's being looked up in lvmetad might not be there.
Diffstat (limited to 'daemons')
-rw-r--r--daemons/lvmetad/lvmetad-core.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index 4182143c..d3cd3346 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -47,6 +47,7 @@ static void debug(const char *fmt, ...) {
fprintf(stderr, "[D %lu] ", pthread_self());
vfprintf(stderr, fmt, ap);
va_end(ap);
+ fflush(stderr);
}
static int debug_cft_line(const char *line, void *baton) {
@@ -412,14 +413,14 @@ static response pv_lookup(lvmetad_state *s, request r)
debug("pv_lookup: could not find device %" PRIu64 "\n", devt);
unlock_pvid_to_pvmeta(s);
dm_config_destroy(res.cft);
- return daemon_reply_simple("failed", "reason = %s", "device not found", NULL);
+ return daemon_reply_simple("unknown", "reason = %s", "device not found", NULL);
}
pv = make_pv_node(s, pvid, res.cft, NULL, res.cft->root);
if (!pv) {
unlock_pvid_to_pvmeta(s);
dm_config_destroy(res.cft);
- return daemon_reply_simple("failed", "reason = %s", "PV not found", NULL);
+ return daemon_reply_simple("unknown", "reason = %s", "PV not found", NULL);
}
pv->key = "physical_volume";
@@ -520,12 +521,12 @@ static response vg_lookup(lvmetad_state *s, request r)
debug("vg_lookup: updated uuid = %s, name = %s\n", uuid, name);
if (!uuid)
- return daemon_reply_simple("failed", "reason = %s", "VG not found", NULL);
+ return daemon_reply_simple("unknown", "reason = %s", "VG not found", NULL);
cft = lock_vg(s, uuid);
if (!cft || !cft->root) {
unlock_vg(s, uuid);
- return daemon_reply_simple("failed", "reason = %s", "UUID not found", NULL);
+ return daemon_reply_simple("unknown", "reason = %s", "UUID not found", NULL);
}
metadata = cft->root;
@@ -821,7 +822,7 @@ static response pv_gone(lvmetad_state *s, request r)
pvid = dm_hash_lookup_binary(s->device_to_pvid, &device, sizeof(device));
if (!pvid) {
unlock_pvid_to_pvmeta(s);
- return daemon_reply_simple("failed", "reason = %s", "device not in cache", NULL);
+ return daemon_reply_simple("unknown", "reason = %s", "device not in cache", NULL);
}
debug("pv_gone (updated): %s / %" PRIu64 "\n", pvid, device);
@@ -836,7 +837,7 @@ static response pv_gone(lvmetad_state *s, request r)
dm_config_destroy(pvmeta);
return daemon_reply_simple("OK", NULL);
} else
- return daemon_reply_simple("failed", "reason = %s", "PVID does not exist", NULL);
+ return daemon_reply_simple("unknown", "reason = %s", "PVID does not exist", NULL);
}
static response pv_found(lvmetad_state *s, request r)
@@ -912,6 +913,7 @@ static response pv_found(lvmetad_state *s, request r)
else {
unlock_vg(s, vgid);
return daemon_reply_simple("failed", "reason = %s",
+// FIXME provide meaningful-to-user error message
"internal treason!", NULL);
}
unlock_vg(s, vgid);