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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
slapos
Commits
90b10c1b
Commit
90b10c1b
authored
Aug 29, 2018
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kvm: Allow to use a device (/dev/...) as disk
parent
f2c83225
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
+17
-3
software/kvm/instance-kvm.cfg.jinja2
software/kvm/instance-kvm.cfg.jinja2
+3
-0
software/kvm/software.cfg
software/kvm/software.cfg
+2
-2
software/kvm/template/template-kvm-run.in
software/kvm/template/template-kvm-run.in
+12
-1
No files found.
software/kvm/instance-kvm.cfg.jinja2
View file @
90b10c1b
...
@@ -91,6 +91,7 @@ tap-interface = ${slap-network-information:network-interface}
...
@@ -91,6 +91,7 @@ tap-interface = ${slap-network-information:network-interface}
disk-size = ${slap-parameter:disk-size}
disk-size = ${slap-parameter:disk-size}
disk-type = ${slap-parameter:disk-type}
disk-type = ${slap-parameter:disk-type}
disk-format = ${slap-parameter:disk-format}
disk-format = ${slap-parameter:disk-format}
disk-device-path = ${slap-parameter:disk-device-path}
disk-path = ${directory:srv}/virtual.${slap-parameter:disk-format}
disk-path = ${directory:srv}/virtual.${slap-parameter:disk-format}
pid-file-path = ${kvm-controller-parameter-dict:pid-file}
pid-file-path = ${kvm-controller-parameter-dict:pid-file}
...
@@ -565,6 +566,8 @@ ram-max-size = 51200
...
@@ -565,6 +566,8 @@ ram-max-size = 51200
ram-hotplug-slot-size = 512
ram-hotplug-slot-size = 512
disk-size = 10
disk-size = 10
disk-type = virtio
disk-type = virtio
disk-format = qcow2
disk-device-path =
cpu-count = 1
cpu-count = 1
cpu-max-count = 24
cpu-max-count = 24
...
...
software/kvm/software.cfg
View file @
90b10c1b
...
@@ -99,7 +99,7 @@ recipe = hexagonit.recipe.download
...
@@ -99,7 +99,7 @@ recipe = hexagonit.recipe.download
ignore-existing = true
ignore-existing = true
url = ${:_profile_base_location_}/instance-kvm.cfg.jinja2
url = ${:_profile_base_location_}/instance-kvm.cfg.jinja2
mode = 644
mode = 644
md5sum =
92e0723a2b474d9cc686ef7f0a91e36c
md5sum =
dbf43756c605144f0a3cd829b588d931
download-only = true
download-only = true
on-update = true
on-update = true
...
@@ -186,7 +186,7 @@ ignore-existing = true
...
@@ -186,7 +186,7 @@ ignore-existing = true
url = ${:_profile_base_location_}/template/template-kvm-run.in
url = ${:_profile_base_location_}/template/template-kvm-run.in
mode = 644
mode = 644
filename = template-kvm-run.in
filename = template-kvm-run.in
md5sum = 8
07e03a9ada561499adf447f79e9d2ec
md5sum = 8
87585f23359d136093de42b1ad1d777
download-only = true
download-only = true
on-update = true
on-update = true
...
...
software/kvm/template/template-kvm-run.in
View file @
90b10c1b
...
@@ -31,6 +31,7 @@ nbd_list = (('{{ parameter_dict.get("nbd-host") }}',
...
@@ -31,6 +31,7 @@ nbd_list = (('{{ parameter_dict.get("nbd-host") }}',
{{ parameter_dict.get("nbd2-port") }}))
{{ parameter_dict.get("nbd2-port") }}))
default_cdrom_iso = '{{ parameter_dict.get("default-cdrom-iso") }}'
default_cdrom_iso = '{{ parameter_dict.get("default-cdrom-iso") }}'
disk_path = '{{ parameter_dict.get("disk-path") }}'
disk_path = '{{ parameter_dict.get("disk-path") }}'
virtual_hard_drive_url = '{{ parameter_dict.get("virtual-hard-drive-url") }}'.strip()
virtual_hard_drive_url = '{{ parameter_dict.get("virtual-hard-drive-url") }}'.strip()
virtual_hard_drive_md5sum = '{{ parameter_dict.get("virtual-hard-drive-md5sum") }}'.strip()
virtual_hard_drive_md5sum = '{{ parameter_dict.get("virtual-hard-drive-md5sum") }}'.strip()
virtual_hard_drive_gzipped = '{{ parameter_dict.get("virtual-hard-drive-gzipped") }}'.strip().lower()
virtual_hard_drive_gzipped = '{{ parameter_dict.get("virtual-hard-drive-gzipped") }}'.strip().lower()
...
@@ -74,6 +75,16 @@ disk_cache = disk_cache if disk_cache in ["none", "writeback", "unsafe",
...
@@ -74,6 +75,16 @@ disk_cache = disk_cache if disk_cache in ["none", "writeback", "unsafe",
"directsync", "writethrough"] else "writeback"
"directsync", "writethrough"] else "writeback"
disk_aio = '{{ parameter_dict.get("disk-aio", "threads") }}'.strip()
disk_aio = '{{ parameter_dict.get("disk-aio", "threads") }}'.strip()
disk_aio = disk_aio if disk_aio in ["threads", "native"] else "threads"
disk_aio = disk_aio if disk_aio in ["threads", "native"] else "threads"
# If a device (ie.: /dev/sdb) is provided, use it instead
# the disk_path with disk_format
disk_device_path = '{{ parameter_dict.get("disk-device-path", "") }}'
if disk_device_path.startswith("/dev/"):
disk_path = disk_device_path
disk_format = "raw"
disk_aio = "native"
disk_cache = "none"
smp_count = {{ parameter_dict.get("smp-count") }}
smp_count = {{ parameter_dict.get("smp-count") }}
smp_max_count = {{ parameter_dict.get("smp-max-count") }}
smp_max_count = {{ parameter_dict.get("smp-max-count") }}
machine_options = '{{ parameter_dict.get("machine-options", "") }}'.strip()
machine_options = '{{ parameter_dict.get("machine-options", "") }}'.strip()
...
@@ -189,7 +200,7 @@ if not os.path.exists(disk_path) and virtual_hard_drive_url != '':
...
@@ -189,7 +200,7 @@ if not os.path.exists(disk_path) and virtual_hard_drive_url != '':
# Create disk if doesn't exist
# Create disk if doesn't exist
# XXX: move to Buildout profile
# XXX: move to Buildout profile
if not os.path.exists(disk_path):
if not
disk_device_path.startswith("/dev/") and not
os.path.exists(disk_path):
print('Creating virtual hard drive...')
print('Creating virtual hard drive...')
subprocess.check_call([qemu_img_path, 'create' ,'-f', disk_format,
subprocess.check_call([qemu_img_path, 'create' ,'-f', disk_format,
disk_path, '%sG' % disk_size])
disk_path, '%sG' % disk_size])
...
...
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