Use /run/nova/startup/ for nova-comp delay script
Nova have no permissions to write into /run. Use /run/nova/startup instead, and ensure its creation by the systemd tmpfiles. Related: rhbz#2173939 Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com> Change-Id: If46660b89401d2cc6c56bdc858b3ac4393420408
This commit is contained in:
parent
4767139816
commit
457c489548
@ -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]}
|
||||
|
@ -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`.
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user