Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
salt
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
17
Merge Requests
1
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
417fbba8
authored
7 years ago
by
Nótai István
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds kvm detection to installer script
parent
cedf8f74
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
122 additions
and
2 deletions
+122
-2
install
+8
-1
install.py
+9
-1
kvm-ok
+105
-0
No files found.
install
View file @
417fbba8
...
...
@@ -12,4 +12,11 @@ PREFIX=$(dirname $FULLPATH)
pip install
-r
$PREFIX
/requirements.txt
python
$PREFIX
/install.py
$PREFIX
/kvm-ok
>
/dev/null
retv
=
$?
EXTRAPARAMS
=
""
if
[
$retv
==
0
]
;
then
EXTRAPARAMS
=
"--kvm-present"
fi
python
$PREFIX
/install.py
$EXTRAPARAMS
This diff is collapsed.
Click to expand it.
install.py
View file @
417fbba8
...
...
@@ -10,6 +10,7 @@ import random
import
os
import
getpass
from
halo
import
Halo
import
argparse
PREFIX
=
dirname
(
__file__
)
...
...
@@ -111,8 +112,12 @@ class KeyStore:
yaml
.
dump
(
self
.
data
,
f
)
KEYFILE
=
join
(
PREFIX
,
'.circlekeys'
)
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--kvm-present'
,
action
=
'store_true'
,
help
=
'Installs with KVM hypervisor otherwise with QEMU.'
)
args
=
parser
.
parse_args
()
KEYFILE
=
join
(
PREFIX
,
'.circlekeys'
)
ks
=
KeyStore
(
KEYFILE
)
installer_sls
=
{
...
...
@@ -162,6 +167,9 @@ installer_sls = {
'management_if'
:
'ethy'
,
'trunk_if'
:
'linkb'
,
},
'vmdriver'
:
{
'hypervisor_type'
:
'kvm'
if
args
.
kvm_present
else
'qemu'
,
},
}
ks
.
save
()
# Save secret keys
...
...
This diff is collapsed.
Click to expand it.
kvm-ok
0 → 100755
View file @
417fbba8
#!/bin/sh
#
# kvm-ok - check whether the CPU we're running on supports KVM acceleration
# Copyright (C) 2008-2010 Canonical Ltd.
#
# Authors:
# Dustin Kirkland <kirkland@canonical.com>
# Kees Cook <kees.cook@canonical.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3,
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set
-e
assert_root
()
{
if
[
"
$(
id
-u
)
"
!=
"0"
]
;
then
echo
"INFO: For more detailed results, you should run this as root"
echo
"HINT: sudo
$0
"
exit
1
fi
}
verdict
()
{
# Print verdict
if
[
"
$1
"
=
"0"
]
;
then
echo
"KVM acceleration can be used"
exit
0
else
echo
"KVM acceleration can NOT be used"
exit
1
fi
}
# check cpu flags for capability
virt
=
$(
egrep
-m1
-w
'^flags[[:blank:]]*:'
/proc/cpuinfo | egrep
-wo
'(vmx|svm)'
)
||
true
[
"
$virt
"
=
"vmx"
]
&&
brand
=
"intel"
[
"
$virt
"
=
"svm"
]
&&
brand
=
"amd"
if
[
-z
"
$virt
"
]
;
then
echo
"INFO: Your CPU does not support KVM extensions"
assert_root
verdict 1
fi
# Now, check that the device exists
if
[
-e
/dev/kvm
]
;
then
echo
"INFO: /dev/kvm exists"
verdict 0
else
echo
"INFO: /dev/kvm does not exist"
echo
"HINT: sudo modprobe kvm_
$brand
"
fi
assert_root
# Prepare MSR access
msr
=
"/dev/cpu/0/msr"
if
[
!
-r
"
$msr
"
]
;
then
modprobe msr
fi
if
[
!
-r
"
$msr
"
]
;
then
echo
"You must be root to run this check."
>
&2
exit
2
fi
echo
"INFO: Your CPU supports KVM extensions"
disabled
=
0
# check brand-specific registers
if
[
"
$virt
"
=
"vmx"
]
;
then
BIT
=
$(
rdmsr
--bitfield
0:0 0x3a 2>/dev/null
||
true
)
if
[
"
$BIT
"
=
"1"
]
;
then
# and FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX clear (no tboot)
BIT
=
$(
rdmsr
--bitfield
2:2 0x3a 2>/dev/null
||
true
)
if
[
"
$BIT
"
=
"0"
]
;
then
disabled
=
1
fi
fi
elif
[
"
$virt
"
=
"svm"
]
;
then
BIT
=
$(
rdmsr
--bitfield
4:4 0xc0010114 2>/dev/null
||
true
)
if
[
"
$BIT
"
=
"1"
]
;
then
disabled
=
1
fi
else
echo
"FAIL: Unknown virtualization extension:
$virt
"
verdict 1
fi
if
[
"
$disabled
"
-eq
1
]
;
then
echo
"INFO: KVM (
$virt
) is disabled by your BIOS"
echo
"HINT: Enter your BIOS setup and enable Virtualization Technology (VT),"
echo
" and then hard poweroff/poweron your system"
verdict 1
fi
verdict 0
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment