Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

Add shared folder and virtualization check for Linux. #2122

Merged
merged 2 commits into from
Nov 18, 2015

Conversation

chantra
Copy link
Contributor

@chantra chantra commented Oct 30, 2015

Fixes #2110

Fixes docker#2110

Signed-off-by: Emmanuel Bretelle <chantr4@gmail.com>
@bascht
Copy link

bascht commented Oct 30, 2015

<3

@nathanleclaire nathanleclaire removed this from the 0.5.0 milestone Oct 30, 2015
@nathanleclaire nathanleclaire added this to the 0.6.0 milestone Nov 5, 2015
@dgageot
Copy link
Member

dgageot commented Nov 5, 2015

LGTM. ping @jeanlaurent

@dmp42 dmp42 modified the milestones: 0.5.1, 0.6.0 Nov 6, 2015
@nathanleclaire nathanleclaire changed the title virtualbox: support linux host Add shared folder and virtualization check for Linux. Nov 7, 2015
@jeanlaurent
Copy link
Member

@chantra Sounds like the VT-X detection by checking for vmx detects virtualization flags for intel cpu only. It sounds like we should also check for amd cpu with something like : grep -E "vmx|smd" /proc/cpuinfo and reflecting this change in chantra@42f1dbb#diff-37ee164f06f8f15faa89761d08488d4dR19

Note that I tested the /proc/cpuinfo trick on 3 differents linux host up to now, with no success. Although virtualization was on, as stated in lscpu see [1]. But lscpuis not as widely available as /proc/cpuinfo so we should stick with it for now.

Ca you make the necessary change to the code to detect amd virtualization flag ?

[1]

$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                1
On-line CPU(s) list:   0
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 70
Stepping:              1
CPU MHz:               2294.688
BogoMIPS:              4589.37
Hypervisor vendor:     KVM
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              6144K
L4 cache:              131072K

@chantra
Copy link
Contributor Author

chantra commented Nov 10, 2015 via email

@jeanlaurent
Copy link
Member

Yeah my bad this wasn't clear.
This was not linked to the smd flag.

Here are the cpuinfo of the 3 machines, two of which are running docker with no issue.

cat /proc/cpuinfo on an ubuntu host on a local vbox which runs docker flawlessly :

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 70
model name  : Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
stepping    : 1
microcode   : 0x19
cpu MHz     : 2294.688
cache size  : 6144 KB
physical id : 0
siblings    : 1
core id     : 0
cpu cores   : 1
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm
bugs        :
bogomips    : 4589.37
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

A low-end box, not running docker. But should be...

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 54
model name  : Intel(R) Atom(TM) CPU N2800   @ 1.86GHz
stepping    : 1
microcode   : 0x10d
cpu MHz     : 798.000
cache size  : 512 KB
physical id : 0
siblings    : 4
core id     : 0
cpu cores   : 2
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 10
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts nopl nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm movbe lahf_lm arat dtherm
bogomips    : 3733.28
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

A google cloud instance, running docker flawlessly

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      : Intel(R) Xeon(R) CPU @ 2.50GHz
stepping        : 4
microcode       : 0x1
cpuid level     : 13
cpu MHz         : 2499.998
cache size      : 30720 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc nopl xtopology eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes xsave avx f16c rdrand hypervisor lahf_lm xsaveopt fsgsbase smep
bogomips        : 4999.99
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:

@chantra
Copy link
Contributor Author

chantra commented Nov 10, 2015

So the issue is not that you cannot run docker, it is that if virtualization cpu flags are not enabled, it will make running docker in a VM dead slow. This is being handled in drivers/virtualbox/virtualbox.go

@dgageot dgageot modified the milestones: 0.5.2, 0.5.1 Nov 12, 2015
@nathanleclaire
Copy link
Contributor

The shared folder bit looks good. I'm not sure if checking /proc directly is really the best strategy, but I guess it might do the trick. @tianon does it seem safe to you?

EDIT: At the very least I think I'd prefer to ioutil.ReadAll the file directly and do the pattern matching directly in Golang instead of shelling out to grep.

Use ioutil and also check for smd flag

Signed-off-by: Emmanuel Bretelle <chantr4@gmail.com>
@jeanlaurent
Copy link
Member

thx @chantra for adding the smd detection

LGTM

@dgageot
Copy link
Member

dgageot commented Nov 18, 2015

LGTM

dgageot added a commit that referenced this pull request Nov 18, 2015
Add shared folder and virtualization check for Linux.
@dgageot dgageot merged commit eb42133 into docker:master Nov 18, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants