This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: Ie7ad2d835c1762dc4b9341e305e6a428cb087935
- Loading branch information
1 parent
91de0b3
commit 6eb72aa
Showing
6 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
releasenotes/notes/nova-compute-startup-delay-fdb1f229840bd0e6.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |