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
Romain Courteaud
slapos
Commits
c7860b72
Commit
c7860b72
authored
Nov 05, 2012
by
Cédric de Saint Martin
Committed by
Marco Mariani
Nov 07, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement disk-type and cpu-count parameters in KVM.
parent
1f7f0a60
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
8 deletions
+35
-8
slapos/recipe/kvm/__init__.py
slapos/recipe/kvm/__init__.py
+9
-1
slapos/recipe/kvm/template/kvm_run.in
slapos/recipe/kvm/template/kvm_run.in
+1
-1
software/kvm/instance-kvm-input-schema.json
software/kvm/instance-kvm-input-schema.json
+19
-4
software/kvm/instance-kvm.cfg.in
software/kvm/instance-kvm.cfg.in
+5
-1
software/kvm/software.cfg
software/kvm/software.cfg
+1
-1
No files found.
slapos/recipe/kvm/__init__.py
View file @
c7860b72
...
@@ -33,6 +33,14 @@ class Recipe(GenericBaseRecipe):
...
@@ -33,6 +33,14 @@ class Recipe(GenericBaseRecipe):
kvm instance configuration.
kvm instance configuration.
"""
"""
def
install
(
self
):
def
install
(
self
):
# Sanitize drive type parameter
self
.
options
.
setdefault
(
'disk-type'
,
'virtio'
)
if
not
self
.
options
.
get
(
'disk-type'
)
in
[
'ide'
,
'scsi'
,
'sd'
,
'mtd'
,
'floppy'
,
'pflash'
,
'virtio'
]:
print
'Warning: "disk-type" parameter is not in allowed values. Using '
\
'"virtio" value.'
self
.
options
[
'disk-type'
]
=
'virtio'
config
=
dict
(
config
=
dict
(
tap_interface
=
self
.
options
[
'tap'
],
tap_interface
=
self
.
options
[
'tap'
],
vnc_ip
=
self
.
options
[
'vnc-ip'
],
vnc_ip
=
self
.
options
[
'vnc-ip'
],
...
@@ -41,6 +49,7 @@ class Recipe(GenericBaseRecipe):
...
@@ -41,6 +49,7 @@ class Recipe(GenericBaseRecipe):
nbd_port
=
self
.
options
[
'nbd-port'
],
nbd_port
=
self
.
options
[
'nbd-port'
],
disk_path
=
self
.
options
[
'disk-path'
],
disk_path
=
self
.
options
[
'disk-path'
],
disk_size
=
self
.
options
[
'disk-size'
],
disk_size
=
self
.
options
[
'disk-size'
],
disk_type
=
self
.
options
[
'disk-type'
],
mac_address
=
self
.
options
[
'mac-address'
],
mac_address
=
self
.
options
[
'mac-address'
],
smp_count
=
self
.
options
[
'smp-count'
],
smp_count
=
self
.
options
[
'smp-count'
],
ram_size
=
self
.
options
[
'ram-size'
],
ram_size
=
self
.
options
[
'ram-size'
],
...
@@ -50,7 +59,6 @@ class Recipe(GenericBaseRecipe):
...
@@ -50,7 +59,6 @@ class Recipe(GenericBaseRecipe):
shell_path
=
self
.
options
[
'shell-path'
],
shell_path
=
self
.
options
[
'shell-path'
],
qemu_path
=
self
.
options
[
'qemu-path'
],
qemu_path
=
self
.
options
[
'qemu-path'
],
qemu_img_path
=
self
.
options
[
'qemu-img-path'
],
qemu_img_path
=
self
.
options
[
'qemu-img-path'
],
# XXX Weak password
vnc_passwd
=
self
.
options
[
'passwd'
]
vnc_passwd
=
self
.
options
[
'passwd'
]
)
)
...
...
slapos/recipe/kvm/template/kvm_run.in
View file @
c7860b72
...
@@ -36,7 +36,7 @@ kvm_argument_list = ['%(qemu_path)s', '-enable-kvm', '-net', 'nic,macaddr=%(mac_
...
@@ -36,7 +36,7 @@ kvm_argument_list = ['%(qemu_path)s', '-enable-kvm', '-net', 'nic,macaddr=%(mac_
'-net', 'tap,ifname=%(tap_interface)s,script=no,downscript=no',
'-net', 'tap,ifname=%(tap_interface)s,script=no,downscript=no',
'-smp', '%(smp_count)s',
'-smp', '%(smp_count)s',
'-m', '%(ram_size)s',
'-m', '%(ram_size)s',
'-drive', 'file=%(disk_path)s,if=
virtio
,boot=on',
'-drive', 'file=%(disk_path)s,if=
%(disk_type)s
,boot=on',
'-vnc', '%(vnc_ip)s:1,ipv4,password',
'-vnc', '%(vnc_ip)s:1,ipv4,password',
'-boot', 'menu=on',
'-boot', 'menu=on',
'-qmp', 'unix:%(socket_path)s,server',
'-qmp', 'unix:%(socket_path)s,server',
...
...
software/kvm/instance-kvm-input-schema.json
View file @
c7860b72
...
@@ -18,8 +18,23 @@
...
@@ -18,8 +18,23 @@
"minimum"
:
1
,
"minimum"
:
1
,
"maximum"
:
80
"maximum"
:
80
},
},
"disk-type"
:
{
"title"
:
"Disk type"
,
"description"
:
"Type of QEMU disk drive."
,
"type"
:
"string"
,
"default"
:
"virtio"
,
"enum"
:
[
"ide"
,
"scsi"
,
"sd"
,
"mtd"
,
"floppy"
,
"pflash"
,
"virtio"
]
},
"cpu-count"
:
{
"title"
:
"CPU count"
,
"description"
:
"Number of CPU cores."
,
"type"
:
"integer"
,
"minimum"
:
1
,
"maximum"
:
8
},
"nbd-ip"
:
{
"nbd-ip"
:
{
"title"
:
"NBD hostname"
,
"title"
:
"NBD hostname"
,
"description"
:
"hostname (or IP) of the NBD server containing the boot image."
,
"description"
:
"hostname (or IP) of the NBD server containing the boot image."
,
...
@@ -35,8 +50,8 @@
...
@@ -35,8 +50,8 @@
"minimum"
:
1
,
"minimum"
:
1
,
"maximum"
:
65535
"maximum"
:
65535
},
},
"frontend-instance-guid"
:
{
"frontend-instance-guid"
:
{
"title"
:
"Frontend Instance ID"
,
"title"
:
"Frontend Instance ID"
,
"description"
:
"Unique identifier of the frontend instance, like
\"
SOFTINST-11031
\"
."
,
"description"
:
"Unique identifier of the frontend instance, like
\"
SOFTINST-11031
\"
."
,
...
...
software/kvm/instance-kvm.cfg.in
View file @
c7860b72
...
@@ -50,9 +50,10 @@ nbd-port = $${slap-parameter:nbd-port}
...
@@ -50,9 +50,10 @@ nbd-port = $${slap-parameter:nbd-port}
tap = $${slap-network-information:network-interface}
tap = $${slap-network-information:network-interface}
disk-path = $${directory:srv}/virtual.qcow2
disk-path = $${directory:srv}/virtual.qcow2
disk-size = $${slap-parameter:disk-size}
disk-size = $${slap-parameter:disk-size}
disk-type = $${slap-parameter:disk-type}
socket-path = $${directory:var}/qmp_socket
socket-path = $${directory:var}/qmp_socket
pid-path = $${directory:run}/pid_file
pid-path = $${directory:run}/pid_file
smp-count =
1
smp-count =
$${slap-parameter:cpu-count}
ram-size = $${slap-parameter:ram-size}
ram-size = $${slap-parameter:ram-size}
mac-address = $${create-mac:mac-address}
mac-address = $${create-mac:mac-address}
runner-path = $${directory:services}/kvm
runner-path = $${directory:services}/kvm
...
@@ -174,3 +175,6 @@ nbd_ip = $${:nbd-ip}
...
@@ -174,3 +175,6 @@ nbd_ip = $${:nbd-ip}
ram-size = 1024
ram-size = 1024
disk-size = 10
disk-size = 10
disk-type = virtio
cpu-count = 1
\ No newline at end of file
software/kvm/software.cfg
View file @
c7860b72
...
@@ -119,7 +119,7 @@ command =
...
@@ -119,7 +119,7 @@ command =
[template-kvm]
[template-kvm]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kvm.cfg.in
url = ${:_profile_base_location_}/instance-kvm.cfg.in
md5sum =
67c1980ba1e70b376f2811602991ff09
md5sum =
aefed0723c79f4d4b9ed977b73e4bac5
output = ${buildout:directory}/template-kvm.cfg
output = ${buildout:directory}/template-kvm.cfg
mode = 0644
mode = 0644
...
...
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