From 998c5460a04a2e0c37dc03a31decd7e8c1316147 Mon Sep 17 00:00:00 2001 From: charisu <838885272@qq.com> Date: Wed, 2 Sep 2020 19:06:37 +0800 Subject: [PATCH] fix check_chunkserver and check_mds --- .../common_tasks/check_chunkserver.yml | 27 ++++++++++++------- curve-ansible/common_tasks/check_mds.yml | 8 +++--- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/curve-ansible/common_tasks/check_chunkserver.yml b/curve-ansible/common_tasks/check_chunkserver.yml index 6c039691fa..ebcba4c635 100644 --- a/curve-ansible/common_tasks/check_chunkserver.yml +++ b/curve-ansible/common_tasks/check_chunkserver.yml @@ -26,10 +26,10 @@ msg: "distribution_major_version is {{ansible_facts['distribution_major_version']}}" when: ansible_facts['distribution_major_version'] != "9" -- name: "check kernel" - fail: - msg: "kernel version is {{ ansible_facts['kernel'] }}" - when: ansible_facts['kernel'] != "4.9.0-8-amd64" +- name: check kernel version + assert: + that: + - ansible_facts['kernel']|version_compare('4.9.0-8-amd64', '>=') - name: "check max fd number" shell: cat /proc/sys/fs/file-max @@ -83,21 +83,30 @@ failed_when: " 'Operation Mode: Disabled' not in result.stdout " changed_when: False +- name: check if jbod enabled + shell: sudo megacli -AdpGetProp -enablejbod -aALL + register: jbod_res + - name: check the RAID cache shell: sudo megacli -LDGetProp -Cache -LALL -a0 register: result failed_when: " 'Cache Policy:WriteThrough' not in result.stdout" changed_when: False + when: "'Disabled' not in jbod_res.stdout" - name: check the RAID firmware - shell: sudo /usr/sbin/megacli -AdpAllInfo -aALL | grep "FW Package Build" - register: result - failed_when: " '24.3.0-0050' not in result.stdout" + shell: sudo /usr/sbin/megacli -AdpAllInfo -aALL | grep "FW Package Build" | awk -F ' ' '{print $2}' + register: firmware_version + +- name: check kernel version + assert: + that: + - firmware_version.stdout|version_compare('24.3.0-0050', '>=') - name: check the disk schedule algorithm - shell: cat /sys/block/sd*/queue/scheduler | grep -v "\[deadline\]" | wc -l + shell: cat /sys/block/sd*/queue/scheduler | grep "\[noop\]" | wc -l register: result - failed_when: result.stdout != "" + failed_when: result.stdout | int != chunkserver_num - name: check if the disk cache closed shell: sudo /sbin/hdparm -W /dev/sd* | grep "write-caching" diff --git a/curve-ansible/common_tasks/check_mds.yml b/curve-ansible/common_tasks/check_mds.yml index de3f1cb887..a4e98f4bda 100644 --- a/curve-ansible/common_tasks/check_mds.yml +++ b/curve-ansible/common_tasks/check_mds.yml @@ -26,7 +26,7 @@ msg: "distribution_major_version is {{ansible_facts['distribution_major_version']}}" when: ansible_facts['distribution_major_version'] != "9" -- name: "check kernel" - fail: - msg: "kernel version is {{ ansible_facts['kernel'] }}" - when: ansible_facts['kernel'] != "4.9.0-8-amd64" +- name: check kernel version + assert: + that: + - ansible_facts['kernel']|version_compare('4.9.0-8-amd64', '>=')