Enable extra hardware data collection and processing for ironic-inspector

* Enable collection extra data on the ramdisk using python-hardware library
  when a new configuration option inspection_extras is set to True (the default)
* Enable storing this data in swift and converting it to format appropriate
  for introspection rules (always enabled, noop when inspection_extras is False)
* Revive the "inspecion_runbench" option (off by default).

NOTE:
This commit diverges from the original one in Mitaka. In Liberty the
python-hardware library was not originally available on the IPA image.
To avoid breaking people with old images, inspection_extras is changed
to False by default.

Change-Id: Ie7921d9b038bea5aa10c35ccbed908e2651465bc
(cherry picked from commit 12b5a74d0c)
This commit is contained in:
Dmitry Tantsur 2016-02-09 18:14:07 +01:00
parent dc9db644de
commit 0baf083c93
5 changed files with 34 additions and 7 deletions

View File

@ -55,6 +55,8 @@ context = {
'UNDERCLOUD_DEBUG': os.environ.get('UNDERCLOUD_DEBUG', 'true'),
'INSPECTION_IPRANGE': os.environ.get('INSPECTION_IPRANGE', '192.0.2.100,192.0.2.120'),
'INSPECTION_INTERFACE': os.environ.get('INSPECTION_INTERFACE', 'br-ctlplane'),
'INSPECTION_COLLECTORS': os.environ.get('INSPECTION_COLLECTORS', 'default,logs'),
'INSPECTION_KERNEL_ARGS': os.environ.get('INSPECTION_KERNEL_ARGS', ''),
'ENABLE_TEMPEST': os.environ.get('ENABLE_TEMPEST', 'true'),
'IPXE_DEPLOY': os.environ.get('IPXE_DEPLOY', 'true'),
'UNDERCLOUD_ADMIN_VIP': os.environ.get('UNDERCLOUD_ADMIN_VIP', ''),

View File

@ -316,7 +316,9 @@ ironic::inspector::swift_auth_url: "http://{{LOCAL_IP}}:5000/v2.0"
ironic::inspector::dnsmasq_local_ip: {{LOCAL_IP}}
ironic::inspector::dnsmasq_ip_range: {{INSPECTION_IPRANGE}}
ironic::inspector::dnsmasq_interface: {{INSPECTION_INTERFACE}}
ironic::inspector::ramdisk_collectors: 'default,logs'
ironic::inspector::ramdisk_collectors: {{INSPECTION_COLLECTORS}}
ironic::inspector::additional_processing_hooks: 'extra_hardware'
ironic::inspector::ramdisk_kernel_args: {{INSPECTION_KERNEL_ARGS}}
# Rabbit
rabbit_cookie: {{UNDERCLOUD_RABBIT_COOKIE}}

View File

@ -216,7 +216,8 @@ class TestGenerateEnvironment(BaseTestCase):
def test_opts_in_env(self):
env = undercloud._generate_environment('.')
# Just spot check, we don't want to replicate the entire opt list here
self.assertEqual(env['INSPECTION_RUNBENCH'], '0')
self.assertEqual(env['INSPECTION_COLLECTORS'],
'default,logs')
self.assertEqual('192.0.2.1/24', env['PUBLIC_INTERFACE_IP'])
self.assertEqual('192.0.2.1', env['LOCAL_IP'])

View File

@ -162,10 +162,17 @@ _opts = [
'range defined by dhcp_start and dhcp_end, but should '
'be in the same network.')
),
cfg.BoolOpt('inspection_extras',
default=False,
help=('Whether to enable extra hardware collection during '
'the inspection process. Requires python-hardware or '
'python-hardware-detect package on the introspection '
'image.')),
cfg.BoolOpt('inspection_runbench',
default=False,
deprecated_name='discovery_runbench',
help='Whether to run benchmarks when inspecting nodes.'
help=('Whether to run benchmarks when inspecting nodes. '
'Requires inspection_extras set to True.')
),
cfg.BoolOpt('undercloud_debug',
default=True,
@ -640,9 +647,18 @@ def _generate_environment(instack_root):
else:
instack_env[env_name] = six.text_type(CONF[opt.name])
# Opts that needs extra processing
if instack_env.get('INSPECTION_RUNBENCH') not in ['0', '1']:
instack_env['INSPECTION_RUNBENCH'] = ('1' if CONF.inspection_runbench
else '0')
if CONF.inspection_runbench and not CONF.inspection_extras:
raise RuntimeError('inspection_extras must be enabled for '
'inspection_runbench to work')
if CONF.inspection_extras:
instack_env['INSPECTION_COLLECTORS'] = 'default,extra-hardware,logs'
else:
instack_env['INSPECTION_COLLECTORS'] = 'default,logs'
if CONF.inspection_runbench:
instack_env['INSPECTION_KERNEL_ARGS'] = (
'ipa-inspection-benchmarks=cpu,mem,disk')
instack_env['PUBLIC_INTERFACE_IP'] = instack_env['LOCAL_IP']
instack_env['LOCAL_IP'] = instack_env['LOCAL_IP'].split('/')[0]
if instack_env['UNDERCLOUD_SERVICE_CERTIFICATE']:

View File

@ -68,7 +68,13 @@
# Deprecated group/name - [DEFAULT]/discovery_iprange
#inspection_iprange = 192.0.2.100,192.0.2.120
# Whether to run benchmarks when inspecting nodes. (boolean value)
# Whether to enable extra hardware collection during the inspection
# process. Requires python-hardware or python-hardware-detect package
# on the introspection image. (boolean value)
#inspection_extras = false
# Whether to run benchmarks when inspecting nodes. Requires
# inspection_extras set to True. (boolean value)
# Deprecated group/name - [DEFAULT]/discovery_runbench
#inspection_runbench = false