Adding an optional startup delay to nova-compute
We need an optional delay on nova-compute when it's waiting for ceph to be healthy. This commit is adding a wrapper that will be deployed when necessary. Related: https://bugzilla.redhat.com/show_bug.cgi?id=1498621 Change-Id: Ie7ad2d835c1762dc4b9341e305e6a428cb087935changes/05/766005/6
parent
91de0b33b9
commit
6eb72aa769
@ -0,0 +1,8 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The parameter ``NovaComputeStartupDelay`` allows the operator to delay the
|
||||
startup of ``nova-compute`` after a compute node reboot.
|
||||
When all the overcloud nodes are rebooted at the same time, it can take a
|
||||
few minutes to the Ceph cluster to get in a healthy state. This delay will
|
||||
prevent the instances from booting before the Ceph cluster is healthy.
|
@ -0,0 +1,45 @@
|
||||
#!/usr/libexec/platform-python
|
||||
"""
|
||||
This wrapper was created to add an optional delay to the startup of nova-compute.
|
||||
We know that instances will fail to boot, after a compute reboot, if ceph is not
|
||||
healthy.
|
||||
|
||||
Ideally, we would poll ceph to get its health, but it's not guaranteed that the
|
||||
compute node will have access to the keys.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import logging
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(description='Process some integers.')
|
||||
parser.add_argument('--config-file', dest='nova_config', action='store',
|
||||
default="/etc/nova/nova.conf",
|
||||
help='path to nova configuration (default: /etc/nova/nova.conf)')
|
||||
parser.add_argument('--nova-binary', dest='nova_binary', action='store',
|
||||
default="/usr/bin/nova-compute",
|
||||
help='path to nova compute binary (default: /usr/bin/nova-compute)')
|
||||
parser.add_argument('--delay', dest='delay', action='store',
|
||||
default=120, type=int,
|
||||
help='Number of seconds to wait until nova-compute is started')
|
||||
parser.add_argument('--state-file', dest='state_file', action='store',
|
||||
default="/run/nova-compute-delayed",
|
||||
help='file exists if we already delayed nova-compute startup'\
|
||||
'(default: /run/nova-compute-delayed)')
|
||||
|
||||
|
||||
sections = {}
|
||||
(args, remaining) = parser.parse_known_args(sys.argv)
|
||||
|
||||
real_args = [args.nova_binary, '--config-file', args.nova_config]
|
||||
real_args.extend(remaining[1:])
|
||||
|
||||
if not os.path.isfile(args.state_file):
|
||||
logging.info("Delaying nova-compute startup by %s seconds" % args.delay)
|
||||
time.sleep(args.delay)
|
||||
open(args.state_file, 'a').close()
|
||||
|
||||
logging.info("Executing %s" % real_args)
|
||||
os.execv(args.nova_binary, real_args)
|
Loading…
Reference in New Issue