Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kwabena Antwi-Boasiako
slapos
Commits
9125569a
Commit
9125569a
authored
Apr 24, 2015
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kvm: validate numa and other cpu parameters
parent
fa82cc5c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
slapos/recipe/kvm/template/kvm_run.in
slapos/recipe/kvm/template/kvm_run.in
+8
-2
No files found.
slapos/recipe/kvm/template/kvm_run.in
View file @
9125569a
...
@@ -11,6 +11,7 @@ import gzip
...
@@ -11,6 +11,7 @@ import gzip
import shutil
import shutil
from random import shuffle
from random import shuffle
import glob
import glob
import re
# XXX: give all of this through parameter, don't use this as template, but as module
# XXX: give all of this through parameter, don't use this as template, but as module
qemu_img_path = '%(qemu-img-path)s'
qemu_img_path = '%(qemu-img-path)s'
...
@@ -202,7 +203,10 @@ if use_tap == 'True':
...
@@ -202,7 +203,10 @@ if use_tap == 'True':
smp = smp_count
smp = smp_count
if smp_options:
if smp_options:
smp += ',%%s' %% smp_options
for option in smp_options.split(','):
key, val = option.split('=')
if key in ('cores', 'threads', 'sockets', 'maxcpus') and val.isdigit():
smp += ',%%s=%%s' %% (key, val)
kvm_argument_list = [qemu_path,
kvm_argument_list = [qemu_path,
'-enable-kvm', '-smp', smp,
'-enable-kvm', '-smp', smp,
'-m', ram_size, '-vga', 'std',
'-m', ram_size, '-vga', 'std',
...
@@ -213,8 +217,10 @@ kvm_argument_list = [qemu_path,
...
@@ -213,8 +217,10 @@ kvm_argument_list = [qemu_path,
'-pidfile', pid_file_path,
'-pidfile', pid_file_path,
]
]
rgx = re.compile('^[\w*\,][\=\d+\-\,\w]*$')
for numa in numa_list:
for numa in numa_list:
numa_parameter.extend(['-numa', numa])
if rgx.match(numa):
numa_parameter.extend(['-numa', numa])
kvm_argument_list += numa_parameter
kvm_argument_list += numa_parameter
if tap_network_parameter == [] and nat_network_parameter == []:
if tap_network_parameter == [] and nat_network_parameter == []:
...
...
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