Fix memcached doesn't start issue 59/33359/1
authorQiLiang <liangqi1@huawei.com>
Mon, 27 Mar 2017 02:32:20 +0000 (10:32 +0800)
committerJustin chi <chigang@huawei.com>
Fri, 14 Apr 2017 03:19:08 +0000 (03:19 +0000)
JIRA: -

Sometimes memcached does not start after installation finished,
which will cause issues like openstack dashboard open instance
console failure.

This patch add memcached restart notify during package installation
and add memcached to cron service-status-check task's config file:
/opt/service

Change-Id: I625899348fb447875fcca7beedb619b5490ce567
Signed-off-by: QiLiang <liangqi1@huawei.com>
(cherry picked from commit 5dfa77861d3d5d561dfa19edcc71363a2b91e96b)

deploy/adapters/ansible/openstack/templates/nova.conf
deploy/adapters/ansible/roles/memcached/tasks/main.yml

index 3cd2c03..661a718 100644 (file)
@@ -42,7 +42,6 @@ instance_usage_audit_period = hour
 notify_on_state_change = vm_and_task_state
 notification_driver = nova.openstack.common.notifier.rpc_notifier
 notification_driver = ceilometer.compute.nova_notifier
-memcached_servers = {{ memcached_servers }}
 osapi_compute_workers = {{ api_workers }}
 metadata_workers = {{ api_workers }}
 
@@ -124,3 +123,7 @@ rabbit_password = {{ RABBIT_PASS }}
 rabbit_port = 5672
 rabbit_userid = {{ RABBIT_USER }}
 
+[cache]
+backend = dogpile.cache.memcached
+enabled = True
+memcache_servers = {{ memcached_servers }}
index a4457f3..2b4b7ec 100644 (file)
@@ -19,6 +19,8 @@
 - name: install packages
   action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest update_cache=yes"
   with_items: "{{ packages | union(packages_noarch) }}"
+  notify:
+    - restart memcahed services
 
 - name: enable auto start
   file:
   notify:
     - restart memcahed services
 
+- name: change memcache listen ip
+  lineinfile:
+    dest=/etc/sysconfig/memcached
+    regexp="^OPTIONS=.*"
+    line="OPTIONS=\"-l 0.0.0.0\""
+  when: ansible_os_family == "RedHat"
+  notify:
+    - restart memcahed services
+
+- name: generate memcached service list
+  lineinfile: dest=/opt/service create=yes line='{{ item }}'
+  with_items: "{{ services | union(services_noarch) }}"
+
 - meta: flush_handlers