From b506529ca25753c9508cd6a54f2c2d1c426d235c Mon Sep 17 00:00:00 2001 From: Philip Schwartz Date: Fri, 14 Feb 2014 15:46:33 -0500 Subject: [PATCH] Fix break in vm_vdi_cleaner after oslo changes. Added missing imports along with adding a call to config.parser_args as needed to allow vm_vdi_cleaner to work against current master. Corrected spelling error in comment. Change-Id: I4d30d0f7f9718cb29fb8c4c18e9e6fa23f3496ef Closes-Bug: #1279942 --- tools/xenserver/vm_vdi_cleaner.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/xenserver/vm_vdi_cleaner.py b/tools/xenserver/vm_vdi_cleaner.py index 864041a4836f..58f693aa214f 100755 --- a/tools/xenserver/vm_vdi_cleaner.py +++ b/tools/xenserver/vm_vdi_cleaner.py @@ -27,10 +27,15 @@ possible_topdir = os.getcwd() if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")): sys.path.insert(0, possible_topdir) - +from nova import config from nova import context from nova import db from nova import exception + +# NOTE(philip-schwartz) Added service import to fix issue where importing +# xenapi service would cause an ArgsAlreadyParsedError exception +from nova import service + from nova.openstack.common import timeutils from nova.virt import virtapi from nova.virt.xenapi import driver as xenapi_driver @@ -285,6 +290,7 @@ def clean_orphaned_instances(xenapi, orphaned_instances): def main(): """Main loop.""" + config.parse_args(sys.argv) args = CONF(args=sys.argv[1:], usage='%(prog)s [options] --command={' + '|'.join(ALLOWED_COMMANDS) + '}')