From b6b8f645f78a7ad5d2b87efdd9f3a785f7352ab4 Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Mon, 22 Jul 2019 13:37:15 -0500 Subject: [PATCH] Adding back kvm_advance_timer service On compute nodes with openstack-compute label, the kvm_timer_advance_setup.service should be enabled. The puppet service runs before kubelet. Change-Id: I84d6c6234d4bd1c8c0c52f5735d7520377b2fe80 Partial-Bug: 1823751 Depends-On: https://review.opendev.org/#/c/672124 Signed-off-by: Al Bailey --- puppet-manifests/centos/build_srpm.data | 2 +- .../src/modules/platform/manifests/compute.pp | 33 +++++++++++++++++++ .../templates/kvm_timer_advance.conf.erb | 2 ++ .../sysinv/sysinv/sysinv/puppet/platform.py | 26 +++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100755 puppet-manifests/src/modules/platform/templates/kvm_timer_advance.conf.erb diff --git a/puppet-manifests/centos/build_srpm.data b/puppet-manifests/centos/build_srpm.data index 9eec371b56..0ef430acec 100644 --- a/puppet-manifests/centos/build_srpm.data +++ b/puppet-manifests/centos/build_srpm.data @@ -1,2 +1,2 @@ SRC_DIR="src" -TIS_PATCH_VER=91 +TIS_PATCH_VER=92 diff --git a/puppet-manifests/src/modules/platform/manifests/compute.pp b/puppet-manifests/src/modules/platform/manifests/compute.pp index 64a8b4beb6..7ad9ceeba8 100644 --- a/puppet-manifests/src/modules/platform/manifests/compute.pp +++ b/puppet-manifests/src/modules/platform/manifests/compute.pp @@ -351,6 +351,38 @@ class platform::compute::machine { } } +class platform::compute::kvm_timer_advance( + $enabled = False, + $vcpu_pin_set = undef +) { + if $enabled { + # include the declaration of the kubelet service + include ::platform::kubernetes::worker + + file { '/etc/kvm-timer-advance/kvm-timer-advance.conf': + ensure => 'present', + replace => true, + content => template('platform/kvm_timer_advance.conf.erb') + } + -> service { 'kvm_timer_advance_setup': + ensure => 'running', + enable => true, + before => Service['kubelet'], + } + # A separate enable is required since we have modified the service resource + # to never enable/disable services in puppet. + -> exec { 'Enable kvm_timer_advance_setup': + command => '/usr/bin/systemctl enable kvm_timer_advance_setup.service', + } + } else { + # A disable is required since we have modified the service resource + # to never enable/disable services in puppet and stop has no effect. + exec { 'Disable kvm_timer_advance_setup': + command => '/usr/bin/systemctl disable kvm_timer_advance_setup.service', + } + } +} + class platform::compute { Class[$name] -> Class['::platform::vswitch'] @@ -362,4 +394,5 @@ class platform::compute { require ::platform::compute::resctrl require ::platform::compute::machine require ::platform::compute::config + require ::platform::compute::kvm_timer_advance } diff --git a/puppet-manifests/src/modules/platform/templates/kvm_timer_advance.conf.erb b/puppet-manifests/src/modules/platform/templates/kvm_timer_advance.conf.erb new file mode 100755 index 0000000000..f53e8e5d65 --- /dev/null +++ b/puppet-manifests/src/modules/platform/templates/kvm_timer_advance.conf.erb @@ -0,0 +1,2 @@ +[kvm-timer-advance] +vcpu_pin_set=<%= @vcpu_pin_set %> diff --git a/sysinv/sysinv/sysinv/sysinv/puppet/platform.py b/sysinv/sysinv/sysinv/sysinv/puppet/platform.py index bd5ea485d9..756933756e 100644 --- a/sysinv/sysinv/sysinv/sysinv/puppet/platform.py +++ b/sysinv/sysinv/sysinv/sysinv/puppet/platform.py @@ -68,6 +68,7 @@ class PlatformPuppet(base.BasePuppet): config.update(self._get_host_tpm_config(host)) config.update(self._get_host_cpu_config(host)) config.update(self._get_host_memory_config(host)) + config.update(self._get_kvm_timer_advance_config(host)) config.update(self._get_host_lldp_config(host)) return config @@ -718,6 +719,31 @@ class PlatformPuppet(base.BasePuppet): return config + def _get_vcpu_pin_set(self, host): + vm_cpus = self._get_host_cpu_list( + host, function=constants.APPLICATION_FUNCTION, threads=True) + cpu_list = [c.cpu for c in vm_cpus] + return "\"%s\"" % utils.format_range_set(cpu_list) + + # kvm-timer-advance only enabled on computes with openstack compute label + # vcpu_pin_set is only used when kvm-timer-advance is enabled + def _get_kvm_timer_advance_config(self, host): + kvm_timer_advance_enabled = False + vcpu_pin_set = None + + if constants.WORKER in utils.get_personalities(host): + host_labels = self.dbapi.label_get_by_host(host.id) + if utils.has_openstack_compute(host_labels): + kvm_timer_advance_enabled = True + vcpu_pin_set = self._get_vcpu_pin_set(host) + + return { + 'platform::compute::kvm_timer_advance::enabled': + kvm_timer_advance_enabled, + 'platform::compute::kvm_timer_advance::vcpu_pin_set': + vcpu_pin_set, + } + def _get_nfs_config(self, host): # Calculate the optimal NFS r/w size based on the network mtu based