Skip to content

Commit bf2f058

Browse files
committed
log kern.hv_vmm_present
1 parent ebe2429 commit bf2f058

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎Lib/test/pythoninfo.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,11 @@ def detect_virt():
11561156
if container:
11571157
return container
11581158

1159+
if APPLE:
1160+
hv_vmm_present = run_command(['sysctl', 'kern.hv_vmm_present'])
1161+
if hv_vmm_present == '1':
1162+
return 'run in a VM (kern.hv_vmm_present is 1)'
1163+
11591164
# Other ways to check if running in a container:
11601165
# * Parse /proc/1/mounts or /proc/1/mountinfo (check "/" filesystem).
11611166
# * Parse /proc/1/cgroup.
@@ -1197,7 +1202,7 @@ def collect_system(info_add):
11971202
info_add('system.virt', virt)
11981203

11991204
if APPLE:
1200-
hardware = run_command(['sysctl', '-n', 'hw.model')
1205+
hardware = run_command(['sysctl', '-n', 'hw.model'])
12011206
if hardware:
12021207
info_add('system.hardware', hardware)
12031208

0 commit comments

Comments
 (0)