Skip to contentSkip to conversation

global_init fails when only specifying monitor address

DISCUSSION Wido den Hollander 4 participants 7 messages Apr 26, 2012 – May 1, 2012

lore
Share & tools
lore
#0 lore raw

Hi,

I tried to connect to a small Ceph setup on my desktop without cephx and that failed:

root@stack01:~# ceph -m wido-desktop.widodh.nl:6789 -s
global_init: unable to open config file.
root@stack01:~#

I however worked with:

root@stack01:~# ceph -m wido-desktop.widodh.nl:6789 -c /dev/null -s
2012-04-26 14:55:33.828524    pg v148: 594 pgs: 594 active+clean; 0 bytes data, 7740 KB used, 70571 MB / 76800 MB avail
2012-04-26 14:55:33.829622   mds e1: 0/0/1 up
2012-04-26 14:55:33.836144   osd e14: 3 osds: 3 up, 3 in
2012-04-26 14:55:33.886429   log 2012-04-26 14:52:50.674430 osd.1 [2a00:f10:11c:ab:52e5:49ff:fec2:c976]:6807/28366 12 : [INF] 1.2b scrub ok
2012-04-26 14:55:33.892423   mon e1: 1 mons at {desktop=[2a00:f10:11c:ab:52e5:49ff:fec2:c976]:6789/0}
root@stack01:~#

I quick look at global_init.cc showed me why this happened, it simply looks for a configuration file to open and when it can't it fails.

But if a monitor address is set, a config file shouldn't be mandatory.

It could be accomplished rather simple by setting the flag CINIT_FLAG_NO_DEFAULT_CONFIG_FILE if a mon_host has been set, but to do that conf->parse_argv(args); should move a few lines up.

Comments? Thoughts?

Wido

#1 lore raw
Quoted 25 lines · Wido den Hollander

Hi,

I tried to connect to a small Ceph setup on my desktop without cephx and that failed:

root@stack01:~# ceph -m wido-desktop.widodh.nl:6789 -s
global_init: unable to open config file.
root@stack01:~#

I however worked with:

root@stack01:~# ceph -m wido-desktop.widodh.nl:6789 -c /dev/null -s
2012-04-26 14:55:33.828524    pg v148: 594 pgs: 594 active+clean; 0 bytes
data, 7740 KB used, 70571 MB / 76800 MB avail
2012-04-26 14:55:33.829622   mds e1: 0/0/1 up
2012-04-26 14:55:33.836144   osd e14: 3 osds: 3 up, 3 in
2012-04-26 14:55:33.886429   log 2012-04-26 14:52:50.674430 osd.1
[2a00:f10:11c:ab:52e5:49ff:fec2:c976]:6807/28366 12 : [INF] 1.2b scrub ok
2012-04-26 14:55:33.892423   mon e1: 1 mons at
{desktop=[2a00:f10:11c:ab:52e5:49ff:fec2:c976]:6789/0}
root@stack01:~#

I quick look at global_init.cc showed me why this happened, it simply looks for a configuration file to open and when it can't it fails.

Quoted 7 lines

But if a monitor address is set, a config file shouldn't be mandatory.

It could be accomplished rather simple by setting the flag CINIT_FLAG_NO_DEFAULT_CONFIG_FILE if a mon_host has been set, but to do that conf->parse_argv(args); should move a few lines up.

Comments? Thoughts?

I wonder if the simplest thing to do is:

- never error out on missing config in the default search path
- always error out on missing config if it was explicitly specified via -c foo or CEPH_CONF in environment.

?

sage

#2 lore raw
Quoted 36 lines · Sage Weil
Quoted 25 lines · Wido den Hollander

Hi,

I tried to connect to a small Ceph setup on my desktop without cephx and that failed:

root@stack01:~# ceph -m wido-desktop.widodh.nl:6789 (http://wido-desktop.widodh.nl:6789) -s
global_init: unable to open config file.
root@stack01:~#

I however worked with:

root@stack01:~# ceph -m wido-desktop.widodh.nl:6789 (http://wido-desktop.widodh.nl:6789) -c /dev/null -s
2012-04-26 14:55:33.828524 pg v148: 594 pgs: 594 active+clean; 0 bytes
data, 7740 KB used, 70571 MB / 76800 MB avail
2012-04-26 14:55:33.829622 mds e1: 0/0/1 up
2012-04-26 14:55:33.836144 osd e14: 3 osds: 3 up, 3 in
2012-04-26 14:55:33.886429 log 2012-04-26 14:52:50.674430 osd.1
[2a00:f10:11c:ab:52e5:49ff:fec2:c976]:6807/28366 12 : [INF] 1.2b scrub ok
2012-04-26 14:55:33.892423 mon e1: 1 mons at
{desktop=[2a00:f10:11c:ab:52e5:49ff:fec2:c976]:6789/0}
root@stack01:~#

I quick look at global_init.cc (http://global_init.cc) showed me why this happened, it simply looks for a configuration file to open and when it can't it fails.

Quoted 7 lines

But if a monitor address is set, a config file shouldn't be mandatory.

It could be accomplished rather simple by setting the flag CINIT_FLAG_NO_DEFAULT_CONFIG_FILE if a mon_host has been set, but to do that conf->parse_argv(args); should move a few lines up.

Comments? Thoughts?

I wonder if the simplest thing to do is:

Quoted 7 lines

- never error out on missing config in the default search path
- always error out on missing config if it was explicitly specified via -c foo or CEPH_CONF in environment.

?

sage

I think this is probably right. I think that we may even error out correctly if we don't have values specified that we need, but we'll need to check that. I'm working on similar stuff as I look at monitor cluster additions for Carl, so I'll look at this today.
-Greg

#3 lore raw
Quoted 37 lines · Greg Farnum
Quoted 36 lines · Sage Weil
Quoted 25 lines · Wido den Hollander

Hi,

I tried to connect to a small Ceph setup on my desktop without cephx and that failed:

root@stack01:~# ceph -m wido-desktop.widodh.nl:6789 (http://wido-desktop.widodh.nl:6789) -s
global_init: unable to open config file.
root@stack01:~#

I however worked with:

root@stack01:~# ceph -m wido-desktop.widodh.nl:6789 (http://wido-desktop.widodh.nl:6789) -c /dev/null -s
2012-04-26 14:55:33.828524 pg v148: 594 pgs: 594 active+clean; 0 bytes
data, 7740 KB used, 70571 MB / 76800 MB avail
2012-04-26 14:55:33.829622 mds e1: 0/0/1 up
2012-04-26 14:55:33.836144 osd e14: 3 osds: 3 up, 3 in
2012-04-26 14:55:33.886429 log 2012-04-26 14:52:50.674430 osd.1
[2a00:f10:11c:ab:52e5:49ff:fec2:c976]:6807/28366 12 : [INF] 1.2b scrub ok
2012-04-26 14:55:33.892423 mon e1: 1 mons at
{desktop=[2a00:f10:11c:ab:52e5:49ff:fec2:c976]:6789/0}
root@stack01:~#

I quick look at global_init.cc (http://global_init.cc) showed me why this happened, it simply looks for a configuration file to open and when it can't it fails.

Quoted 7 lines

But if a monitor address is set, a config file shouldn't be mandatory.

It could be accomplished rather simple by setting the flag CINIT_FLAG_NO_DEFAULT_CONFIG_FILE if a mon_host has been set, but to do that conf->parse_argv(args); should move a few lines up.

Comments? Thoughts?

I wonder if the simplest thing to do is:

Quoted 8 lines
Quoted 7 lines

- never error out on missing config in the default search path
- always error out on missing config if it was explicitly specified via -c foo or CEPH_CONF in environment.

?

sage

I think this is probably right. I think that we may even error out correctly if we don't have values specified that we need, but we'll need to check that.

I agree, that would be indeed much easier :)

Quoted 1 line

I'm working on similar stuff as I look at monitor cluster additions for Carl, so I'll look at this today.

Thanks!

Wido

Quoted 3 lines

-Greg

#4 lore raw
In reply to Sage Weil

There's no technical reason why you can't simply remove these lines:

Quoted 4 lines
 if (ret == -EDOM) {
   dout_emergency("global_init: error parsing config file.\n");
   _exit(1);

}

Without a configuration file, you'll just get the defaults for everything. Wido, it sounds like that is what you're already doing by passing in "-c /dev/null"

So why didn't we do that in the first place? It was basically a philosophical reason. We have a section in the configuration file for clients. If clients don't use that section, then it would seem kind of pointless to have it. If I were a system administrator, I might be annoyed by accidentally failing to set CEPH_CONF in my .bashrc, and getting a bunch of defaults flooding in when I ran /usr/bin/ceph (or some other tool).

With that being said, there is a case to be made that we should let people run without a configuration file if they so desire. Most UNIX utilities will run with out without a configuration file, so maybe that's what cephtool and similar utilities should do. Your call.

Unrelated:
It might be a good time to get rid of that chunk of code in md_config_t::parse_config_files_impl that does "Warn about section names that look like old-style section names." It's been a while since that actually mattered, I believe.

Colin

Quoted 40 lines · Sage Weil
Quoted 25 lines · Wido den Hollander

Hi,

I tried to connect to a small Ceph setup on my desktop without cephx and that failed:

root@stack01:~# ceph -m wido-desktop.widodh.nl:6789 -s
global_init: unable to open config file.
root@stack01:~#

I however worked with:

root@stack01:~# ceph -m wido-desktop.widodh.nl:6789 -c /dev/null -s
2012-04-26 14:55:33.828524    pg v148: 594 pgs: 594 active+clean; 0 bytes
data, 7740 KB used, 70571 MB / 76800 MB avail
2012-04-26 14:55:33.829622   mds e1: 0/0/1 up
2012-04-26 14:55:33.836144   osd e14: 3 osds: 3 up, 3 in
2012-04-26 14:55:33.886429   log 2012-04-26 14:52:50.674430 osd.1
[2a00:f10:11c:ab:52e5:49ff:fec2:c976]:6807/28366 12 : [INF] 1.2b scrub ok
2012-04-26 14:55:33.892423   mon e1: 1 mons at
{desktop=[2a00:f10:11c:ab:52e5:49ff:fec2:c976]:6789/0}
root@stack01:~#

I quick look at global_init.cc showed me why this happened, it simply looks for a configuration file to open and when it can't it fails.

Quoted 7 lines

But if a monitor address is set, a config file shouldn't be mandatory.

It could be accomplished rather simple by setting the flag CINIT_FLAG_NO_DEFAULT_CONFIG_FILE if a mon_host has been set, but to do that conf->parse_argv(args); should move a few lines up.

Comments? Thoughts?

I wonder if the simplest thing to do is:

 - never error out on missing config in the default search path
 - always error out on missing config if it was explicitly specified via -c foo or CEPH_CONF in environment.

Quoted 7 lines

?

sage
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

What we ended up merging into master is a change so that if you don't specify a configuration file, you'll get a small warning printed out but the program will continue executing. We may remove the warning in future, but right now we thought it was important to leave in since using the default parameters can result in some truly bizarre error messages if they don't match what the rest of the system is using. -Greg

Quoted 90 lines · Colin McCabe

There's no technical reason why you can't simply remove these lines:

Quoted 4 lines

if (ret == -EDOM) {
dout_emergency("global_init: error parsing config file.\n"); _exit(1);
}

Without a configuration file, you'll just get the defaults for everything. Wido, it sounds like that is what you're already doing by passing in "-c /dev/null"

So why didn't we do that in the first place? It was basically a philosophical reason. We have a section in the configuration file for clients. If clients don't use that section, then it would seem kind of pointless to have it. If I were a system administrator, I might be annoyed by accidentally failing to set CEPH_CONF in my .bashrc, and getting a bunch of defaults flooding in when I ran /usr/bin/ceph (or some other tool).

With that being said, there is a case to be made that we should let people run without a configuration file if they so desire. Most UNIX utilities will run with out without a configuration file, so maybe that's what cephtool and similar utilities should do. Your call.

Unrelated:
It might be a good time to get rid of that chunk of code in md_config_t::parse_config_files_impl that does "Warn about section names that look like old-style section names." It's been a while since that actually mattered, I believe.

Colin

Quoted 40 lines · Sage Weil
Quoted 25 lines · Wido den Hollander

Hi,

I tried to connect to a small Ceph setup on my desktop without cephx and that failed:

root@stack01:~# ceph -m wido-desktop.widodh.nl:6789 (http://wido-desktop.widodh.nl:6789) -s
global_init: unable to open config file.
root@stack01:~#

I however worked with:

root@stack01:~# ceph -m wido-desktop.widodh.nl:6789 (http://wido-desktop.widodh.nl:6789) -c /dev/null -s
2012-04-26 14:55:33.828524 pg v148: 594 pgs: 594 active+clean; 0 bytes
data, 7740 KB used, 70571 MB / 76800 MB avail
2012-04-26 14:55:33.829622 mds e1: 0/0/1 up
2012-04-26 14:55:33.836144 osd e14: 3 osds: 3 up, 3 in
2012-04-26 14:55:33.886429 log 2012-04-26 14:52:50.674430 osd.1
[2a00:f10:11c:ab:52e5:49ff:fec2:c976]:6807/28366 12 : [INF] 1.2b scrub ok
2012-04-26 14:55:33.892423 mon e1: 1 mons at
{desktop=[2a00:f10:11c:ab:52e5:49ff:fec2:c976]:6789/0}
root@stack01:~#

I quick look at global_init.cc (http://global_init.cc) showed me why this happened, it simply looks for a configuration file to open and when it can't it fails.

Quoted 7 lines

But if a monitor address is set, a config file shouldn't be mandatory.

It could be accomplished rather simple by setting the flag CINIT_FLAG_NO_DEFAULT_CONFIG_FILE if a mon_host has been set, but to do that conf->parse_argv(args); should move a few lines up.

Comments? Thoughts?

I wonder if the simplest thing to do is:

- never error out on missing config in the default search path
- always error out on missing config if it was explicitly specified via -c foo or CEPH_CONF in environment.

Quoted 7 lines

?

sage
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected] (mailto:[email protected]) More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected] (mailto:[email protected]) More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to Wido den Hollander
Quoted 25 lines · Wido den Hollander

Hi,

I tried to connect to a small Ceph setup on my desktop without cephx and that failed:

root@stack01:~# ceph -m wido-desktop.widodh.nl:6789 (http://wido-desktop.widodh.nl:6789) -s
global_init: unable to open config file.
root@stack01:~#

I however worked with:

root@stack01:~# ceph -m wido-desktop.widodh.nl:6789 (http://wido-desktop.widodh.nl:6789) -c /dev/null -s
2012-04-26 14:55:33.828524 pg v148: 594 pgs: 594 active+clean; 0  
bytes data, 7740 KB used, 70571 MB / 76800 MB avail
2012-04-26 14:55:33.829622 mds e1: 0/0/1 up
2012-04-26 14:55:33.836144 osd e14: 3 osds: 3 up, 3 in
2012-04-26 14:55:33.886429 log 2012-04-26 14:52:50.674430 osd.1  
[2a00:f10:11c:ab:52e5:49ff:fec2:c976]:6807/28366 12 : [INF] 1.2b scrub ok
2012-04-26 14:55:33.892423 mon e1: 1 mons at  
{desktop=[2a00:f10:11c:ab:52e5:49ff:fec2:c976]:6789/0}
root@stack01:~#

I quick look at global_init.cc (http://global_init.cc) showed me why this happened, it simply looks for a configuration file to open and when it can't it fails.

Quoted 7 lines

But if a monitor address is set, a config file shouldn't be mandatory.

It could be accomplished rather simple by setting the flag CINIT_FLAG_NO_DEFAULT_CONFIG_FILE if a mon_host has been set, but to do that conf->parse_argv(args); should move a few lines up.

Comments? Thoughts?

If this is a big annoyance for you, you can cherry-pick the head of wip-2352-hack to build a ceph tool that doesn't require a config file if you specify -m in a similar fashion to what you suggest. Unfortunately actually doing what you suggest would break everything (you need to parse the config file before parsing command-line options so that the command-line ones win…although it's possible parsing them twice would work, actually…) and this hack isn't appropriate to put upstream so I need to spend some time working out a more general fix (hopefully, one that lets executables specify the arguments they need and then requiring the config file iff those aren't all set on the command-line). -Greg

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html