Fix bug 1338614

util.log_time()'s return value was what was being sent to fork_cb. This means
the resize ran in parallel and the call to fork_cb threw a traceback (trying
to call Nonetype).

By permitting fork_cb to take kwargs, and using the correct method syntax,
this now forks and resizes in the background as appropriate.
This commit is contained in:
Jay Faulkner 2014-09-15 14:39:57 -07:00
parent 6e2c5b6209
commit 170dbd50eb
2 changed files with 4 additions and 4 deletions

View File

@ -154,8 +154,8 @@ def handle(name, cfg, _cloud, log, args):
# Fork to a child that will run
# the resize command
util.fork_cb(
util.log_time(logfunc=log.debug, msg="backgrounded Resizing",
func=do_resize, args=(resize_cmd, log)))
util.log_time, logfunc=log.debug, msg="backgrounded Resizing",
func=do_resize, args=(resize_cmd, log))
else:
util.log_time(logfunc=log.debug, msg="Resizing",
func=do_resize, args=(resize_cmd, log))

View File

@ -193,11 +193,11 @@ def ExtendedTemporaryFile(**kwargs):
return fh
def fork_cb(child_cb, *args):
def fork_cb(child_cb, *args, **kwargs):
fid = os.fork()
if fid == 0:
try:
child_cb(*args)
child_cb(*args, **kwargs)
os._exit(0) # pylint: disable=W0212
except:
logexc(LOG, "Failed forking and calling callback %s",