Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Disabled virtualization check on Linux platforms #3949

Merged
merged 4 commits into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions golem/core/virtualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from cpuinfo import get_cpu_info

from golem.core.common import get_golem_path, is_windows
from golem.core.common import get_golem_path, is_linux, is_windows
from golem.core.windows import run_powershell
from golem.rpc import utils as rpc_utils

Expand All @@ -18,10 +18,13 @@
def is_virtualization_enabled() -> bool:
""" Checks if hardware virtualization is available on this machine.
Currently, this check is limited to Intel CPUs (VT and VT-x support).
:return bool: True if virtualization is available. On Windows, we also check
if the feature is enabled in firmware.
:return bool: True if virtualization is available or the OS is Linux.
On Windows, we additionally check if the feature is enabled in firmware.
"""
if is_windows():
if is_linux():
# Virtualization support is not required to run Golem on Linux.
return True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Virtualization is not enabled per se, it's simply not required. I'd treat this fix as temporary. Maybe this call should be simply skipped by the UI?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, hence the comment I left there. Another option would be to change this RPC / create a new one specific to the use case (i.e. checking for Docker support).

elif is_windows():
return _check_vt_windows()

return _check_vt_unix()
Expand Down
11 changes: 10 additions & 1 deletion tests/golem/core/test_virtualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@ def get_mock_cpuinfo_output(vt_supported=True) -> dict:
}


@patch('golem.core.virtualization.is_linux', side_effect=lambda: True)
class VirtualizationTestLinux(TestCase):

def test_vt_enabled(self, *_):
self.assertTrue(is_virtualization_enabled())


@patch('golem.core.virtualization.is_linux', side_effect=lambda: False)
@patch('golem.core.virtualization.is_windows', side_effect=lambda: False)
class VirtualizationTestUnix(TestCase):
class VirtualizationTestOsx(TestCase):

@patch('golem.core.virtualization.get_cpu_info',
return_value=get_mock_cpuinfo_output())
Expand All @@ -31,6 +39,7 @@ def test_vt_unsupported(self, *_):
self.assertFalse(is_virtualization_enabled())


@patch('golem.core.virtualization.is_linux', side_effect=lambda: False)
@patch('golem.core.virtualization.is_windows', side_effect=lambda: True)
class VirtualizationTestWindows(TestCase):

Expand Down