160
160
raise KeyError(name)
165
gflags.DEFINE_flag(gflags.HelpFlag(), FLAGS)
163
# Copied from gflags with small mods to get the naming correct.
164
# Originally gflags checks for the first module that is not gflags that is
165
# in the call chain, we want to check for the first module that is not gflags
166
# and not this module.
167
def _GetCallingModule():
168
"""Returns the name of the module that's calling into this module.
170
We generally use this function to get the name of the module calling a
171
DEFINE_foo... function.
173
# Walk down the stack to find the first globals dict that's not ours.
174
for depth in range(1, sys.getrecursionlimit()):
175
if not sys._getframe(depth).f_globals is globals():
176
module_name = __GetModuleName(sys._getframe(depth).f_globals)
177
if module_name == 'gflags':
179
if module_name is not None:
181
raise AssertionError("No module was found")
184
# Copied from gflags because it is a private function
185
def __GetModuleName(globals_dict):
186
"""Given a globals dict, returns the name of the module that defines it.
189
globals_dict: A dictionary that should correspond to an environment
190
providing the values of the globals.
193
A string (the name of the module) or None (if the module could not
196
for name, module in sys.modules.iteritems():
197
if getattr(module, '__dict__', None) is globals_dict:
198
if name == '__main__':
168
204
def _wrapper(func):
185
226
DEFINE_multistring = _wrapper(gflags.DEFINE_multistring)
186
227
DEFINE_multi_int = _wrapper(gflags.DEFINE_multi_int)
187
228
DEFINE_flag = _wrapper(gflags.DEFINE_flag)
190
229
HelpFlag = gflags.HelpFlag
191
230
HelpshortFlag = gflags.HelpshortFlag
192
231
HelpXMLFlag = gflags.HelpXMLFlag
285
324
DEFINE_string('logdir', None, 'output to a per-service log file in named '
327
DEFINE_string('sqlite_db', 'nova.sqlite', 'file name for sqlite')
288
328
DEFINE_string('sql_connection',
289
'sqlite:///$state_path/nova.sqlite',
329
'sqlite:///$state_path/$sqlite_db',
290
330
'connection string for sql database')
291
331
DEFINE_integer('sql_idle_timeout',