Skip to content

Commit f0a78db

Browse files
pmkccopybara-github
authored andcommitted
Add support for enabling RT kernel.
Currently only supports Rocky Linux. PiperOrigin-RevId: 834364006
1 parent 56c211c commit f0a78db

File tree

1 file changed

+38
-18
lines changed

1 file changed

+38
-18
lines changed

perfkitbenchmarker/linux_virtual_machine.py

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,14 @@
285285
'modify the interrupt coaleasing behavior.',
286286
)
287287

288+
_ENABLE_RT_KERNEL = flags.DEFINE_bool(
289+
'enable_rt_kernel',
290+
False,
291+
'Attempt to install and enable the real time kernel on '
292+
'the VM.'
293+
'Currently only implemented for RockyLinux.',
294+
)
295+
288296

289297
# RHEL package managers
290298
YUM = 'yum'
@@ -751,6 +759,8 @@ def PrepareVMEnvironment(self):
751759
self.SetupPackageManager()
752760
self.SetFiles()
753761
self.DoSysctls()
762+
if _ENABLE_RT_KERNEL.value:
763+
self._EnableRealTimeKernel()
754764
self._DoAppendKernelCommandLine()
755765
self.ModifyKernelModules()
756766
self.DoConfigureNetworkForBBR()
@@ -777,6 +787,12 @@ def _Stop(self):
777787
"""Stops the VM."""
778788
raise NotImplementedError()
779789

790+
def _EnableRealTimeKernel(self):
791+
"""Enables real-time kernel features on the VM."""
792+
raise NotImplementedError(
793+
f'Real-time kernel not supported for {self.OS_TYPE}'
794+
)
795+
780796
def SetFiles(self):
781797
"""Apply --set_files to the VM."""
782798

@@ -2896,47 +2912,51 @@ def SetupPackageManager(self):
28962912
)
28972913

28982914

2899-
class RockyLinux8Mixin(BaseRedHatMixin):
2900-
"""Class holding Rocky Linux 8 specific VM methods and attributes."""
2915+
class BaseRockyLinuxMixin(BaseRedHatMixin):
2916+
"""Class holding Rocky Linux specific VM methods and attributes."""
29012917

2902-
OS_TYPE = os_types.ROCKY_LINUX8
2918+
def _EnableRealTimeKernel(self):
2919+
self.RemoteCommand(
2920+
'sudo dnf config-manager --set-enabled rt && '
2921+
'sudo dnf install -y kernel-rt && '
2922+
'sudo grubby --set-default /boot/vmlinuz*+rt'
2923+
)
2924+
self._needs_reboot = True
29032925

29042926
def SetupPackageManager(self):
29052927
"""Install EPEL."""
2906-
# https://docs.fedoraproject.org/en-US/epel/#_almalinux_8_rocky_linux_8
2928+
# https://docs.fedoraproject.org/en-US/epel/getting-started/
29072929
self.RemoteCommand(
2908-
'sudo dnf config-manager --set-enabled powertools && '
2930+
'sudo dnf config-manager --set-enabled crb &&'
29092931
'sudo dnf install -y epel-release'
29102932
)
29112933

29122934

2913-
class RockyLinux9Mixin(BaseRedHatMixin):
2935+
class RockyLinux8Mixin(BaseRockyLinuxMixin):
29142936
"""Class holding Rocky Linux 8 specific VM methods and attributes."""
29152937

2916-
OS_TYPE = os_types.ROCKY_LINUX9
2938+
OS_TYPE = os_types.ROCKY_LINUX8
29172939

29182940
def SetupPackageManager(self):
29192941
"""Install EPEL."""
2920-
# https://docs.fedoraproject.org/en-US/epel/#_almalinux_9_rocky_linux_98
2942+
# https://docs.fedoraproject.org/en-US/epel/getting-started/
29212943
self.RemoteCommand(
2922-
'sudo dnf config-manager --set-enabled crb &&'
2944+
'sudo dnf config-manager --set-enabled powertools && '
29232945
'sudo dnf install -y epel-release'
29242946
)
29252947

29262948

2927-
class RockyLinux10Mixin(BaseRedHatMixin):
2949+
class RockyLinux9Mixin(BaseRockyLinuxMixin):
2950+
"""Class holding Rocky Linux 8 specific VM methods and attributes."""
2951+
2952+
OS_TYPE = os_types.ROCKY_LINUX9
2953+
2954+
2955+
class RockyLinux10Mixin(BaseRockyLinuxMixin):
29282956
"""Class holding Rocky Linux 10 specific VM methods and attributes."""
29292957

29302958
OS_TYPE = os_types.ROCKY_LINUX10
29312959

2932-
def SetupPackageManager(self):
2933-
"""Install EPEL."""
2934-
# https://docs.fedoraproject.org/en-US/epel/#_rocky_linux_10
2935-
self.RemoteCommand(
2936-
'sudo dnf config-manager --set-enabled crb &&'
2937-
'sudo dnf install -y epel-release'
2938-
)
2939-
29402960

29412961
class CoreOsMixin(BaseContainerLinuxMixin):
29422962
"""Class holding CoreOS Container Linux specific VM methods and attributes."""

0 commit comments

Comments
 (0)