diff --git a/deployment/nova/nova-compute-container-puppet.yaml b/deployment/nova/nova-compute-container-puppet.yaml index c33c28ca1b..1f7f7f43a6 100644 --- a/deployment/nova/nova-compute-container-puppet.yaml +++ b/deployment/nova/nova-compute-container-puppet.yaml @@ -1409,6 +1409,7 @@ outputs: - /dev:/dev - /lib/modules:/lib/modules:ro - /run:/run + - /run/nova:/run/nova:z - /var/lib/iscsi:/var/lib/iscsi:z - /var/lib/libvirt:/var/lib/libvirt:shared - /sys/class/net:/sys/class/net @@ -1456,12 +1457,20 @@ outputs: file: path: "{{ item.path }}" state: directory - setype: "{{ item.setype }}" + setype: "{{ item.setype | default(omit) }}" with_items: - { 'path': /var/lib/nova, 'setype': container_file_t } - { 'path': /var/lib/_nova_secontext, 'setype': container_file_t} - { 'path': /var/lib/nova/instances, 'setype': container_file_t } - { 'path': /var/lib/libvirt, 'setype': container_file_t } + - { "path": /etc/tmpfiles.d } + - name: ensure /run/nova is present upon reboot + copy: + dest: /etc/tmpfiles.d/run-nova.conf + content: | + d /run/nova 0777 root root - - + - name: create tempfiles + command: systemd-tmpfiles --create - name: Mount Nova NFS Share vars: nfs_backend_enable: {get_attr: [RoleParametersValue, value, nfs_backend_enable]} diff --git a/releasenotes/notes/delayed_nova_compute-71325b99b34a11df.yaml b/releasenotes/notes/delayed_nova_compute-71325b99b34a11df.yaml new file mode 100644 index 0000000000..2b4720333a --- /dev/null +++ b/releasenotes/notes/delayed_nova_compute-71325b99b34a11df.yaml @@ -0,0 +1,9 @@ +--- +fixes: + - | + Delayed Nova Compute script uses `/run/nova/startup` for its state file instead + of `/run`. +upgrade: + - | + Delayed Nova Compute script uses `/run/nova/startup` for its state file instead + of `/run`. diff --git a/scripts/delay-nova-compute b/scripts/delay-nova-compute index c7d226a6ef..111cd77eb7 100644 --- a/scripts/delay-nova-compute +++ b/scripts/delay-nova-compute @@ -24,10 +24,11 @@ parser.add_argument('--nova-binary', dest='nova_binary', action='store', 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-dir', dest='state_dir', action='store', + default="/run/nova/startup", help='state-file directory') 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)') + default="nova-compute-delayed", + help='file exists if we already delayed nova-compute startup') sections = {} @@ -36,10 +37,15 @@ sections = {} real_args = [args.nova_binary, '--config-file', args.nova_config] real_args.extend(remaining[1:]) -if not os.path.isfile(args.state_file): +if not os.path.isdir(args.state_dir): + os.makedirs(args.state_dir, mode = 0o751) + +state_file_name = os.path.join(args.state_dir, args.state_file) + +if not os.path.isfile(state_file_name): logging.info("Delaying nova-compute startup by %s seconds" % args.delay) time.sleep(args.delay) - open(args.state_file, 'a').close() + open(state_file_name, 'a').close() logging.info("Executing %s" % real_args) os.execv(args.nova_binary, real_args)