1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

lvmetad: Call _lvmetad_handle_reply in lvmetad_vg_lookup.

This commit is contained in:
Petr Rockai 2013-01-16 11:12:22 +01:00
parent 15fdd5c90d
commit 1e4a9534f4

7
lib/cache/lvmetad.c vendored
View File

@ -306,11 +306,12 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna
{ {
struct volume_group *vg = NULL; struct volume_group *vg = NULL;
daemon_reply reply; daemon_reply reply;
int found;
char uuid[64]; char uuid[64];
struct format_instance *fid; struct format_instance *fid;
struct format_instance_ctx fic; struct format_instance_ctx fic;
struct dm_config_node *top; struct dm_config_node *top;
const char *name; const char *name, *diag_name;
const char *fmt_name; const char *fmt_name;
struct format_type *fmt; struct format_type *fmt;
struct dm_config_node *pvcn; struct dm_config_node *pvcn;
@ -325,14 +326,16 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna
return_NULL; return_NULL;
log_debug_lvmetad("Asking lvmetad for VG %s (%s)", uuid, vgname ? : "name unknown"); log_debug_lvmetad("Asking lvmetad for VG %s (%s)", uuid, vgname ? : "name unknown");
reply = _lvmetad_send("vg_lookup", "uuid = %s", uuid, NULL); reply = _lvmetad_send("vg_lookup", "uuid = %s", uuid, NULL);
diag_name = uuid;
} else { } else {
if (!vgname) if (!vgname)
log_error(INTERNAL_ERROR "VG name required (VGID not available)"); log_error(INTERNAL_ERROR "VG name required (VGID not available)");
log_debug_lvmetad("Asking lvmetad for VG %s", vgname); log_debug_lvmetad("Asking lvmetad for VG %s", vgname);
reply = _lvmetad_send("vg_lookup", "name = %s", vgname, NULL); reply = _lvmetad_send("vg_lookup", "name = %s", vgname, NULL);
diag_name = vgname;
} }
if (!reply.error && !strcmp(daemon_reply_str(reply, "response", ""), "OK")) { if (_lvmetad_handle_reply(reply, "lookup VG", diag_name, &found) && found) {
if (!(top = dm_config_find_node(reply.cft->root, "metadata"))) { if (!(top = dm_config_find_node(reply.cft->root, "metadata"))) {
log_error(INTERNAL_ERROR "metadata config node not found."); log_error(INTERNAL_ERROR "metadata config node not found.");