Merge "fix neutron-powervc debug utility issue"

This commit is contained in:
Jenkins 2014-10-13 05:01:17 +00:00 committed by Gerrit Code Review
commit d3d8da98b3

View File

@ -17,8 +17,11 @@ if 'powervc' in sys.argv[0]:
# those OpenStack AMQP configurations in [DEFAULT] section of nova.conf, # those OpenStack AMQP configurations in [DEFAULT] section of nova.conf,
# cinder.conf. # cinder.conf.
argv = sys.argv[1:] argv = sys.argv[1:]
argv1 = None if 'neutron' in sys.argv[0]:
argv2 = None argv1 = ['--config-file', '/etc/powervc/amqp-openstack-neutron.conf']
else:
argv1 = ['--config-file', '/etc/powervc/amqp-openstack.conf']
argv2 = ['--config-file', '/etc/powervc/amqp-powervc.conf']
argv1_index = -1 argv1_index = -1
argv2_index = -1 argv2_index = -1
for i in range(len(argv)): for i in range(len(argv)):
@ -30,16 +33,18 @@ if 'powervc' in sys.argv[0]:
elif os.path.basename(argv[i+1]) == 'amqp-powervc.conf': elif os.path.basename(argv[i+1]) == 'amqp-powervc.conf':
argv2 = argv[i:i+2] argv2 = argv[i:i+2]
argv2_index = i+1 argv2_index = i+1
if argv1 is None or argv2 is None: if argv1_index > argv2_index:
sys.exit("Invalid configuration: amqp-powervc.conf and" argv1_index, argv2_index = argv2_index, argv1_index
+ " amqp-openstack.conf(or openstack-neutron.conf)" if argv1_index > -1 and argv2_index > -1:
+ " are required.")
else:
if argv1_index > argv2_index:
argv1_index, argv2_index = argv2_index, argv1_index
sys.argv = (sys.argv[:argv1_index] sys.argv = (sys.argv[:argv1_index]
+ sys.argv[argv1_index+2:argv2_index] + sys.argv[argv1_index+2:argv2_index]
+ sys.argv[argv2_index+2:]) + sys.argv[argv2_index+2:])
elif argv1_index > -1 and argv2_index == -1:
sys.argv = (sys.argv[:argv1_index]
+ sys.argv[argv1_index+2:])
elif argv2_index > -1 and argv1_index == -1:
sys.argv = (sys.argv[:argv2_index]
+ sys.argv[argv2_index+2:])
AMQP_OPENSTACK_CONF = cfg.ConfigOpts() AMQP_OPENSTACK_CONF = cfg.ConfigOpts()
AMQP_POWERVC_CONF = cfg.ConfigOpts() AMQP_POWERVC_CONF = cfg.ConfigOpts()