]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
roles/common: do not set hwclock in kvm node
authorKyr Shatskyy <kyrylo.shatskyy@clyso.com>
Thu, 3 Apr 2025 15:02:34 +0000 (17:02 +0200)
committerKyr Shatskyy <kyrylo.shatskyy@clyso.com>
Sun, 6 Apr 2025 11:01:25 +0000 (13:01 +0200)
The hwclock is not accessible for kvm nodes and trying to set it
creates an error:

    hwclock: Cannot access the Hardware Clock via any known method.
    hwclock: Use the --verbose option to see the details of our search for an access method.

In that case try and check if current clock is using 'kvm-clock'
and just skip this step.

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@clyso.com>
roles/common/tasks/main.yml

index c9435a1e6db50d1d5d3253992584946d0513ec2b..c8a17f5e0c962e70a89f79a8b610be1f02a8e1a2 100644 (file)
 - import_tasks: zypper_systems.yml
   when: ansible_pkg_mgr == "zypper"
 
+- name: Capture current_clocksource content
+  shell: "cat /sys/devices/system/clocksource/clocksource0/current_clocksource"
+  failed_when: false
+  register: current_clocksource
+
 - name: Set the hardware clock
   command: hwclock --systohc
+  # unless system clock is using kvm-clock
+  when: current_clocksource.stdout.find('kvm-clock') == -1
   tags:
     - timezone