[openstack-dev] Freezer - tmp_file issue
Straub, Albert
Albert.Straub at charter.com
Wed Jul 20 21:12:08 UTC 2016
Hi!
I’m rather new at this so let me know if this is the wrong place to ask for a change. I was trying to run the Freezer code without the trickle executable but with a configuration file. It wouldn’t run. So, I took a look and it appears that if you do not have a trickle executable but you do have a config file that it will add a tmp_file key to the backup_args dictionary. However, if you don’t have a trickle executable, it will try to pop out tmp_file which doesn’t exist and thus an exception is thrown and the program exits. Would it be possible to have someone move the if backup_args.config: \ backup_args.__dict__[‘tmp_file’] = conf_file.name above and on the same indent as the if trickle_executable and then move the part in the else statement if backup_args.config to the same indent level as well? That should prevent it from having a happy heart attack and exiting.
Thanks,
Al
if trickle_executable:
LOG.info("Info: Starting trickle ...")
trickle_command = '{0} -d {1} -u {2} '.\
format(trickle_executable,
getattr(backup_args, 'download_limit') or -1,
getattr(backup_args, 'upload_limit') or -1)
backup_args.__dict__['trickle_command'] = trickle_command
if backup_args.config:
backup_args.__dict__['tmp_file'] = conf_file.name
# maintain env variable not to get into infinite loop
if "tricklecount" in os.environ:
tricklecount = int(os.environ.get("tricklecount", 1))
tricklecount += 1
os.environ["tricklecount"] = str(tricklecount)
else:
os.environ["tricklecount"] = str(1)
else:
LOG.warn("Trickle not found. Switching to normal mode without "
"limiting bandwidth")
if backup_args.config:
# remove index tmp_file from backup arguments dict
backup_args.__dict__.pop('tmp_file')
utils.delete_file(conf_file.name)
More information about the OpenStack-dev
mailing list