diff options
author | Ondrej Kozina <okozina@redhat.com> | 2015-01-28 13:33:26 +0100 |
---|---|---|
committer | Ondrej Kozina <okozina@redhat.com> | 2015-04-01 11:01:21 +0200 |
commit | ca91f5bb82edce923efbe1a68b1837d80d5291af (patch) | |
tree | 0e02c02030a12cb7778c9b5534383998d3b96982 | |
parent | 04dad62a8e95c4cd5ad7173ca1f3eb00bd94c8a2 (diff) | |
download | lvm2-ca91f5bb82edce923efbe1a68b1837d80d5291af.tar.gz |
adapt lvmpolld client code to previous commit
-rw-r--r-- | daemons/lvmpolld/lvmpolld-client.h | 2 | ||||
-rw-r--r-- | lib/lvmpolld/lvmpolld-client.c | 31 | ||||
-rw-r--r-- | tools/polldaemon.c | 4 |
3 files changed, 25 insertions, 12 deletions
diff --git a/daemons/lvmpolld/lvmpolld-client.h b/daemons/lvmpolld/lvmpolld-client.h index 7820023ea..56cf3099c 100644 --- a/daemons/lvmpolld/lvmpolld-client.h +++ b/daemons/lvmpolld/lvmpolld-client.h @@ -24,7 +24,7 @@ struct cmd_context; /* daemon_handle lvmpolld_connect(const char *socket);*/ void lvmpolld_disconnect(void); -int lvmpolld_poll_init(const char *cmd_line, const char *vgname, +int lvmpolld_poll_init(const struct cmd_context *cmd, const char *vgname, const char *uuid, unsigned background, uint64_t lv_type, unsigned interval, unsigned abort); diff --git a/lib/lvmpolld/lvmpolld-client.c b/lib/lvmpolld/lvmpolld-client.c index 58b81b8e0..d4321c484 100644 --- a/lib/lvmpolld/lvmpolld-client.c +++ b/lib/lvmpolld/lvmpolld-client.c @@ -132,7 +132,7 @@ out_req: */ #define INTERV_SIZE 10 -static int _process_poll_init(const char *cmd_line, const char *poll_type, +static int _process_poll_init(const struct cmd_context *cmd, const char *poll_type, const char *vgname, const char *uuid, unsigned background, unsigned interval, unsigned abort) @@ -155,14 +155,27 @@ static int _process_poll_init(const char *cmd_line, const char *poll_type, if (!daemon_request_extend(req, "lvid = %s", uuid, "vgname = %s", vgname, "interval = %s", str, - "background = %d", background, - "abort = %d", abort, - "cmdline = %s", cmd_line, + "cmdline = %s", cmd->cmd_line, NULL)) { log_error("failed to create %s request", poll_type); goto out_req; } + if (abort && !(daemon_request_extend(req, "abort = %d", abort, NULL))) { + log_error("failed to create %s request" , poll_type); + goto out_req; + } + + if (!background && !(daemon_request_extend(req, "background = %d", background, NULL))) { + log_error("failed to create %s request" , poll_type); + goto out_req; + } + + if (cmd->handles_missing_pvs && !(daemon_request_extend(req, "handle_missing_pvs = %d", cmd->handles_missing_pvs, NULL))) { + log_error("failed to create %s request" , poll_type); + goto out_req; + } + rep = daemon_send(_lvmpolld, req); if (!strcmp(daemon_reply_str(rep, "response", ""), "OK")) @@ -185,7 +198,7 @@ out_req: return r; } -int lvmpolld_poll_init(const char *cmd_line, const char *vgname, const char *uuid, +int lvmpolld_poll_init(const struct cmd_context *cmd, const char *vgname, const char *uuid, unsigned background, uint64_t lv_type, unsigned interval, unsigned abort) { @@ -203,18 +216,18 @@ int lvmpolld_poll_init(const char *cmd_line, const char *vgname, const char *uui if (lv_type & PVMOVE) { log_verbose("lvmpolld: pvmove%s", abort ? "--abort" : ""); - r = _process_poll_init(cmd_line, PVMOVE_POLL, vgname, uuid, background, interval, abort); + r = _process_poll_init(cmd, PVMOVE_POLL, vgname, uuid, background, interval, abort); } else if (lv_type & CONVERTING) { log_verbose("lvmpolld: convert mirror"); - r = _process_poll_init(cmd_line, CONVERT_POLL, vgname, uuid, background, interval, 0); + r = _process_poll_init(cmd, CONVERT_POLL, vgname, uuid, background, interval, 0); } else if (lv_type & MERGING) { if (lv_type & SNAPSHOT) { log_verbose("lvmpolld: Merge snapshot"); - r = _process_poll_init(cmd_line, MERGE_POLL, vgname, uuid, background, interval, 0); + r = _process_poll_init(cmd, MERGE_POLL, vgname, uuid, background, interval, 0); } else if (lv_type & THIN_VOLUME) { log_verbose("lvmpolld: Merge thin snapshot"); - r = _process_poll_init(cmd_line, MERGE_THIN_POLL, vgname, uuid, background, interval, 0); + r = _process_poll_init(cmd, MERGE_THIN_POLL, vgname, uuid, background, interval, 0); } else { log_error(INTERNAL_ERROR "Unsupported poll operation"); diff --git a/tools/polldaemon.c b/tools/polldaemon.c index d7f5d26ad..8f9bfdec3 100644 --- a/tools/polldaemon.c +++ b/tools/polldaemon.c @@ -393,7 +393,7 @@ static int _lvmpolld_init_poll_vg(struct cmd_context *cmd, const char *vgname, continue; } - r = lvmpolld_poll_init(cmd->cmd_line, vgname, lvid.s, + r = lvmpolld_poll_init(cmd, vgname, lvid.s, lpdp->parms->background, lpdp->parms->lv_type, lpdp->parms->interval, @@ -607,7 +607,7 @@ static int _lvmpoll_daemon(struct cmd_context *cmd, const char *name, unsigned finished = 0; if (name || uuid) { - r = lvmpolld_poll_init(cmd->cmd_line, + r = lvmpolld_poll_init(cmd, (parms->lv_type & PVMOVE ? find_vgname_from_pvname(cmd, name) : extract_vgname(cmd, name)), uuid, parms->background, parms->lv_type, parms->interval, parms->aborting); |