[sheepdog] [PATCH v2] add foreground option
Ruoyu
liangry at ucweb.com
Thu Mar 19 03:17:26 CET 2015
Saeki,
I think the bug you reported as below would be solved.
https://bugs.launchpad.net/sheepdog-project/+bug/1433452
Could you please re-test it after applying the patch?
On 2015年03月18日 23:07, Vasiliy Tolstov wrote:
> Signed-off-by: Vasiliy Tolstov <v.tolstov at selfip.ru>
> ---
> sheep/sheep.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/sheep/sheep.c b/sheep/sheep.c
> index fc53ec9..86444b0 100644
> --- a/sheep/sheep.c
> +++ b/sheep/sheep.c
> @@ -134,6 +134,7 @@ static struct sd_option sheep_options[] = {
> "specify the cluster driver (default: "DEFAULT_CLUSTER_DRIVER")",
> cluster_help},
> {'D', "directio", false, "use direct IO for backend store"},
> + {'f', "foreground", false, "make the program run in foreground"},
> {'g', "gateway", false, "make the program run as a gateway mode"},
> {'h', "help", false, "display this help and exit"},
> {'i', "ioaddr", true, "use separate network card to handle IO requests"
> @@ -661,6 +662,7 @@ int main(int argc, char **argv)
> char *dir, *p, *pid_file = NULL, *bindaddr = NULL, log_path[PATH_MAX],
> *argp = NULL;
> bool explicit_addr = false;
> + bool daemonize = true;
> int32_t nr_vnodes = -1;
> int64_t zone = -1;
> struct cluster_driver *cdrv;
> @@ -718,6 +720,9 @@ int main(int argc, char **argv)
> case 'D':
> sys->backend_dio = true;
> break;
> + case 'f':
> + daemonize = false;
> + break;
> case 'g':
> if (nr_vnodes > 0) {
> sd_err("Options '-g' and '-V' can not be both specified");
> @@ -905,7 +910,10 @@ int main(int argc, char **argv)
>
> srandom(port);
>
> - if (lock_and_daemon(log_dst_type != LOG_DST_STDOUT, dir)) {
> + if (daemonize && log_dst_type == LOG_DST_STDOUT)
> + daemonize = false;
> +
> + if (lock_and_daemon(daemonize, dir)) {
> free(argp);
> goto cleanup_dir;
> }
More information about the sheepdog
mailing list