Add ceph-cache-info role to get the ceph client cache info from ceph 77/37577/3
authorzhifeng.jiang <jiang.zhifeng@zte.com.cn>
Sun, 16 Jul 2017 06:46:46 +0000 (23:46 -0700)
committerzhifeng.jiang <jiang.zhifeng@zte.com.cn>
Tue, 18 Jul 2017 05:56:51 +0000 (22:56 -0700)
nodes.

JIRA: QTIP-254

Change-Id: I3dc9671da038db792807b8cd55859ffa60619670
Signed-off-by: zhifeng.jiang <jiang.zhifeng@zte.com.cn>
resources/ansible_roles/ceph-cache-info/meta/main.yml [new file with mode: 0644]
resources/ansible_roles/ceph-cache-info/tasks/main.yml [new file with mode: 0644]
tests/data/external/sysinfo/ceph-cache-info.log [new file with mode: 0644]

diff --git a/resources/ansible_roles/ceph-cache-info/meta/main.yml b/resources/ansible_roles/ceph-cache-info/meta/main.yml
new file mode 100644 (file)
index 0000000..29b2992
--- /dev/null
@@ -0,0 +1,14 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corporation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+---
+
+allow_duplicates: yes
+dependencies:
+- { role: qtip-common, basename: ceph-cache-info }
diff --git a/resources/ansible_roles/ceph-cache-info/tasks/main.yml b/resources/ansible_roles/ceph-cache-info/tasks/main.yml
new file mode 100644 (file)
index 0000000..7e29a32
--- /dev/null
@@ -0,0 +1,34 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corporation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+- fetch:
+    src: /etc/ceph/ceph.conf
+    dest: "{{ qtip_results }}/sysinfo-{{ inventory_hostname }}/"
+    flat: yes
+
+- name: collect ceph catch info from ceph.conf
+  set_fact: {"{{ item }}":"{{ lookup('ini', '{{ item }} section=client default='' file={{ qtip_results }}/sysinfo-{{ inventory_hostname }}/ceph.conf')  }}"}
+  with_items:
+      - rbd_cache
+      - rbd_cache_max_dirty
+      - rdb_cache_size
+  delegate_to: localhost
+  ignore_errors: True
+  register: result
+
+- name: saving output to log
+  copy:
+    content: "{{ item }} {{ item.stdout }}"
+    dest: "{{ logfile }}"
+  when: result|succeeded
+  delegate_to: localhost
+  with_items:
+      - rbd_cache
+      - rbd_cache_max_dirty
+      - rdb_cache_size
diff --git a/tests/data/external/sysinfo/ceph-cache-info.log b/tests/data/external/sysinfo/ceph-cache-info.log
new file mode 100644 (file)
index 0000000..6762f67
--- /dev/null
@@ -0,0 +1,3 @@
+rdb_cache true
+rdb_cache_size 24
+rbd_cache_max_dirty 16