Fix swift init scripts w/o dedicated replication
When not using dedicated replication systemd still puts init scripts down, which take a long time to restart/start. upstart scripts get around this by setting blank scripts. Now that we are using a service dict we can do better by defining an "service_en" flag and not setting up scripts when the service isn't enabled. Additionally, the systemd tempfiles and init files were not using the appropriate "program_binary" variable at all, this has been fixed. Change-Id: Iae569bfe38a440fb09e56658b3a934799a8821e8
This commit is contained in:
parent
e4f7da4a38
commit
033aa502e5
@ -296,6 +296,7 @@ swift_services:
|
|||||||
program_name: "swift-account-replicator-server"
|
program_name: "swift-account-replicator-server"
|
||||||
program_binary: "swift-account-server"
|
program_binary: "swift-account-server"
|
||||||
program_config_options: "/etc/swift/account-server/account-server-replicator.conf"
|
program_config_options: "/etc/swift/account-server/account-server-replicator.conf"
|
||||||
|
service_en: "{{ swift_dedicated_replication | bool }}"
|
||||||
swift-account-server:
|
swift-account-server:
|
||||||
group: swift_acc
|
group: swift_acc
|
||||||
program_name: "swift-account-server"
|
program_name: "swift-account-server"
|
||||||
@ -317,6 +318,7 @@ swift_services:
|
|||||||
program_name: "swift-container-replicator-server"
|
program_name: "swift-container-replicator-server"
|
||||||
program_binary: "swift-container-server"
|
program_binary: "swift-container-server"
|
||||||
program_config_options: "/etc/swift/container-server/container-server-replicator.conf"
|
program_config_options: "/etc/swift/container-server/container-server-replicator.conf"
|
||||||
|
service_en: "{{ swift_dedicated_replication | bool }}"
|
||||||
swift-container-server:
|
swift-container-server:
|
||||||
group: swift_cont
|
group: swift_cont
|
||||||
program_name: "swift-container-server"
|
program_name: "swift-container-server"
|
||||||
@ -346,6 +348,7 @@ swift_services:
|
|||||||
program_name: "swift-object-replicator-server"
|
program_name: "swift-object-replicator-server"
|
||||||
program_binary: "swift-object-server"
|
program_binary: "swift-object-server"
|
||||||
program_config_options: "/etc/swift/object-server/object-server-replicator.conf"
|
program_config_options: "/etc/swift/object-server/object-server-replicator.conf"
|
||||||
|
service_en: "{{ swift_dedicated_replication | bool }}"
|
||||||
swift-object-server:
|
swift-object-server:
|
||||||
group: swift_obj
|
group: swift_obj
|
||||||
program_name: "swift-object-server"
|
program_name: "swift-object-server"
|
||||||
|
@ -30,7 +30,9 @@
|
|||||||
state: "restarted"
|
state: "restarted"
|
||||||
pattern: "{{ item.value.program_name }}"
|
pattern: "{{ item.value.program_name }}"
|
||||||
with_dict: "{{ swift_services }}"
|
with_dict: "{{ swift_services }}"
|
||||||
when: inventory_hostname in groups[item.value.group]
|
when:
|
||||||
|
- inventory_hostname in groups[item.value.group]
|
||||||
|
- "{{ item.value.service_en | default(true) }}"
|
||||||
|
|
||||||
- name: Restart rsyslog
|
- name: Restart rsyslog
|
||||||
service:
|
service:
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
name: "{{ item.value.program_name }}"
|
name: "{{ item.value.program_name }}"
|
||||||
enabled: "yes"
|
enabled: "yes"
|
||||||
with_dict: "{{ swift_services }}"
|
with_dict: "{{ swift_services }}"
|
||||||
when: inventory_hostname in groups[item.value.group]
|
when:
|
||||||
|
- inventory_hostname in groups[item.value.group]
|
||||||
|
- "{{ item.value.service_en | default(true) }}"
|
||||||
notify:
|
notify:
|
||||||
- Restart swift services
|
- Restart swift services
|
||||||
|
@ -19,4 +19,6 @@
|
|||||||
state: "started"
|
state: "started"
|
||||||
pattern: "{{ item.value.program_name }}"
|
pattern: "{{ item.value.program_name }}"
|
||||||
with_dict: "{{ swift_services }}"
|
with_dict: "{{ swift_services }}"
|
||||||
when: inventory_hostname in groups[item.value.group]
|
when:
|
||||||
|
- inventory_hostname in groups[item.value.group]
|
||||||
|
- "{{ item.value.service_en | default(true) }}"
|
||||||
|
@ -12,7 +12,7 @@ Group={{ swift_system_group_name }}
|
|||||||
{% if item.value.program_override is defined %}
|
{% if item.value.program_override is defined %}
|
||||||
ExecStart={{ item.value.program_override }} {{ item.value.program_config_options|default('') }}
|
ExecStart={{ item.value.program_override }} {{ item.value.program_config_options|default('') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
ExecStart={{ swift_bin }}/{{ item.value.program_name }} {{ item.value.program_config_options|default('') }}
|
ExecStart={{ swift_bin }}/{{ item.value.program_binary | default(item.value.program_name) }} {{ item.value.program_config_options|default('') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# Give a reasonable amount of time for the server to start up/shut down
|
# Give a reasonable amount of time for the server to start up/shut down
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
D /var/lock/{{ item.value.program_name }} 2755 {{ swift_system_user_name }} {{ swift_system_group_name }}
|
D /var/lock/{{ item.value.program_binary | default(item.value.program_name) }} 2755 {{ swift_system_user_name }} {{ swift_system_group_name }}
|
||||||
D /var/run/{{ item.value.program_name }} 2755 {{ swift_system_user_name }} {{ swift_system_group_name }}
|
D /var/run/{{ item.value.program_binary | default(item.value.program_name) }} 2755 {{ swift_system_user_name }} {{ swift_system_group_name }}
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
{% if not swift_dedicated_replication and 'replicator-server' in item.value.program_name %}
|
|
||||||
# Blank script - dedicated replication network not in use
|
|
||||||
{% else %}
|
|
||||||
|
|
||||||
description "{{ item.value.program_name }}"
|
description "{{ item.value.program_name }}"
|
||||||
author "Kevin Carter <kevin.carter@rackspace.com>"
|
author "Kevin Carter <kevin.carter@rackspace.com>"
|
||||||
|
|
||||||
@ -41,4 +37,3 @@ exec start-stop-daemon --start \
|
|||||||
--make-pidfile \
|
--make-pidfile \
|
||||||
--pidfile /var/run/{{ item.value.program_binary | default(item.value.program_name) }}/{{ item.value.program_name }}.pid \
|
--pidfile /var/run/{{ item.value.program_binary | default(item.value.program_name) }}/{{ item.value.program_name }}.pid \
|
||||||
--exec "{{ item.value.program_override|default('$RUNBIN') }}" "{{ item.value.program_config_options|default('') }}"
|
--exec "{{ item.value.program_override|default('$RUNBIN') }}" "{{ item.value.program_config_options|default('') }}"
|
||||||
{% endif %}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user