From 286e639782ecf0de325f22d823e9f19c6e7e174f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 19 Jun 2012 17:24:01 -0700 Subject: [PATCH] kernel: enable/disable kdb This hard-codes ttyS1, which is what we use on sepia. --- teuthology/task/kernel.py | 42 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/teuthology/task/kernel.py b/teuthology/task/kernel.py index ed190319ad430..ca4de6f87e405 100644 --- a/teuthology/task/kernel.py +++ b/teuthology/task/kernel.py @@ -19,23 +19,29 @@ def normalize_config(ctx, config): osd: tag: v3.0 + kdb: true osd.1: branch: new_btrfs + kdb: false is transformed into:: osd.0: tag: v3.0 + kdb: true osd.1: branch: new_btrfs + kdb: false osd.2: tag: v3.0 + kdb: true If config is None or just specifies a version to use, it is applied to all nodes. """ if config is None or \ - len(config) == 1 and config.keys() in [['tag'], ['branch'], ['sha1']]: + len(config) == 1 and config.keys() in [['tag'], ['branch'], + ['sha1'], ['kdb']]: new_config = {} if config is None: config = {'branch': 'master'} @@ -230,6 +236,26 @@ def install_and_reboot(ctx, config): log.debug('Waiting for install on %s to complete...', name) proc.exitstatus.get() +def enable_disable_kdb(ctx, config): + for role, enable in config.iteritems(): + (role_remote,) = ctx.cluster.only(role).remotes.keys() + if enable: + log.info('Enabling kdb on {role}...'.format(role=role)) + proc = role_remote.run( + args=[ + 'echo', 'ttyS1', + run.Raw('|'), + 'sudo', 'tee', '/sys/module/kgdboc/parameters/kgdboc' + ]) + else: + log.info('Disabling kdb on {role}...'.format(role=role)) + proc = role_remote.run( + args=[ + 'echo', '', + run.Raw('|'), + 'sudo', 'tee', '/sys/module/kgdboc/parameters/kgdboc' + ]) + def wait_for_reboot(ctx, need_install, timeout): """ Loop reconnecting and checking kernel versions until @@ -251,6 +277,7 @@ def wait_for_reboot(ctx, need_install, timeout): raise time.sleep(1) + def task(ctx, config): """ Make sure the specified kernel is installed. @@ -293,6 +320,12 @@ def task(ctx, config): branch: more_specific_branch osd.3: branch: master + + To enable kdb:: + + kernel: + kdb: true + """ assert config is None or isinstance(config, dict), \ "task kernel only supports a dictionary for configuration" @@ -305,6 +338,7 @@ def task(ctx, config): validate_config(ctx, config) need_install = {} + kdb = {} for role, role_config in config.iteritems(): sha1, _ = teuthology.get_ceph_binary_url( package='kernel', @@ -321,7 +355,13 @@ def task(ctx, config): if need_to_install(ctx, role, sha1): need_install[role] = sha1 + # enable or disable kdb if specified, otherwise do not touch + if role_config.get('kdb') is not None: + kdb[role] = role_config.get('kdb') + if need_install: install_firmware(ctx, need_install) install_and_reboot(ctx, need_install) wait_for_reboot(ctx, need_install, timeout) + + enable_disable_kdb(ctx, kdb) -- 2.39.5