Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3821)

Unified Diff: build/android/install_emulator_deps.py

Issue 116493002: build/android/install_emulator_deps.py: run kvm-ok as root when needed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/install_emulator_deps.py
diff --git a/build/android/install_emulator_deps.py b/build/android/install_emulator_deps.py
index ec923dfc8a99b26e36d1ea4326b2a58565e7e086..31242659a1ee5cad1879e2ff4cec72531e6694eb 100755
--- a/build/android/install_emulator_deps.py
+++ b/build/android/install_emulator_deps.py
@@ -100,6 +100,24 @@ def CheckKVM():
True if kvm-ok returns 0 (already enabled)
"""
try:
+ # Note: Running kvm-ok as root is recommended, but not required, to get
+ # better information in case of failure. I.e.:
+ #
+ # If root:
+ # - If /dev/kvm is available, returns 0 (success)
+ #
+ # - Otherwise, print information explaining whether the CPU
+ # supports KVM extensions, and whether they're disabled by the
+ # BIOS, then return 1 (failure).
+ #
+ # If _not_ root:
+ # - If /dev/kvm is available, returns 0 (success)
+ #
+ # - Otherwise, print a message asking to run it as root, and
+ # return 1 (failure).
+ #
+ # Here, there is no need to run it as root, but it is done in InstallKVM()
+ # below.
return not cmd_helper.RunCmd(['kvm-ok'])
except OSError:
logging.info('kvm-ok not installed')
@@ -138,7 +156,9 @@ def InstallKVM():
logging.critical('ERROR: Did not add KVM module to Linux Kernal. Make sure '
'hardware virtualization is enabled in BIOS.')
# Now check to ensure KVM acceleration can be used.
- rc = cmd_helper.RunCmd(['kvm-ok'])
+ # Run as root to get better diagnostics in case of failure (see note in
+ # CheckKVM() above).
+ rc = cmd_helper.RunCmd(['sudo', 'kvm-ok'])
navabi 2013/12/16 19:43:08 Should we just call CheckKVM() here rather than do
digit1 2013/12/17 08:41:43 Actually, it looks like all /usr/sbin binaries sho
navabi 2013/12/17 21:31:04 I like that idea.
if rc:
logging.critical('ERROR: Can not use KVM acceleration. Make sure hardware '
'virtualization is enabled in BIOS (i.e. Intel VT-x or '
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698