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
Boxiang Sun
slapos
Commits
3369d31e
Commit
3369d31e
authored
Aug 08, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
KVM SR: Fix virtual-hard-drive-md5sum parameter.
parent
d66ea6d3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
8 deletions
+23
-8
slapos/recipe/kvm/template/kvm_run.in
slapos/recipe/kvm/template/kvm_run.in
+15
-6
software/kvm/instance-kvm-input-schema.json
software/kvm/instance-kvm-input-schema.json
+6
-0
software/kvm/instance-kvm.cfg.in
software/kvm/instance-kvm.cfg.in
+2
-2
No files found.
slapos/recipe/kvm/template/kvm_run.in
View file @
3369d31e
...
@@ -18,7 +18,7 @@ nbd_list = (('%(nbd-host)s', %(nbd-port)s), ('%(nbd2-host)s', %(nbd2-port)s))
...
@@ -18,7 +18,7 @@ nbd_list = (('%(nbd-host)s', %(nbd-port)s), ('%(nbd2-host)s', %(nbd2-port)s))
default_disk_image = '%(default-disk-image)s'
default_disk_image = '%(default-disk-image)s'
disk_path = '%(disk-path)s'
disk_path = '%(disk-path)s'
virtual_hard_drive_url = '%(virtual-hard-drive-url)s'.strip()
virtual_hard_drive_url = '%(virtual-hard-drive-url)s'.strip()
virtual_hard_drive_md5
_url = '%(virtual-hard-drive-md5-url
)s'.strip()
virtual_hard_drive_md5
sum = '%(virtual-hard-drive-md5sum
)s'.strip()
nat_rules = '%(nat-rules)s'.strip()
nat_rules = '%(nat-rules)s'.strip()
use_tap = '%(use-tap)s'
use_tap = '%(use-tap)s'
tap_interface = '%(tap-interface)s'
tap_interface = '%(tap-interface)s'
...
@@ -59,18 +59,27 @@ def getSocketStatus(host, port):
...
@@ -59,18 +59,27 @@ def getSocketStatus(host, port):
# Download existing hard drive if needed at first boot
# Download existing hard drive if needed at first boot
if not os.path.exists(disk_path) and virtual_hard_drive_url != '':
if not os.path.exists(disk_path) and virtual_hard_drive_url != '':
print('Downloading virtual hard drive...')
urllib.urlretrieve(virtual_hard_drive_url, disk_path)
urllib.urlretrieve(virtual_hard_drive_url, disk_path)
md5sum = virtual_hard_drive_md5sum.strip()
if md5sum:
print('Checking MD5 checksum...')
local_md5sum = md5Checksum(disk_path)
local_md5sum = md5Checksum(disk_path)
md5sum = urllib.urlopen(virtual_hard_drive_md5_url).read().strip()
if local_md5sum != md5sum:
if local_md5sum != md5sum:
os.remove(disk_path)
os.remove(disk_path)
raise Exception('MD5 mismatch.')
raise Exception('MD5 mismatch. MD5 of local file is %%s, Specified MD5 is %%s.' %% (
local_md5sum, md5sum))
print('MD5sum check passed.')
else:
print('Warning: not checksum specified.')
# 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 os.path.exists(disk_path):
print('Creating virtual hard drive...')
subprocess.Popen([qemu_img_path, 'create' ,'-f', 'qcow2',
subprocess.Popen([qemu_img_path, 'create' ,'-f', 'qcow2',
disk_path, '%%sG' %% disk_size])
disk_path, '%%sG' %% disk_size])
print('Done.')
# Generate network parameters
# Generate network parameters
# XXX: use_tap should be a boolean
# XXX: use_tap should be a boolean
...
...
software/kvm/instance-kvm-input-schema.json
View file @
3369d31e
...
@@ -73,6 +73,12 @@
...
@@ -73,6 +73,12 @@
"format"
:
"uri"
,
"format"
:
"uri"
,
"type"
:
"string"
,
"type"
:
"string"
,
},
},
"virtual-hard-drive-md5sum"
:
{
"title"
:
"Checksum of virtual hard drive"
,
"description"
:
"MD5 checksum of virtual hard drive, used if virtual-hard-drive-url is specified."
,
"type"
:
"string"
,
},
virtual-hard-drive-md
5
sum
"use-tap"
:
{
"use-tap"
:
{
"title"
:
"Use QEMU TAP network interface"
,
"title"
:
"Use QEMU TAP network interface"
,
...
...
software/kvm/instance-kvm.cfg.in
View file @
3369d31e
...
@@ -88,7 +88,7 @@ nat-rules = $${slap-parameter:nat-rules}
...
@@ -88,7 +88,7 @@ nat-rules = $${slap-parameter:nat-rules}
6tunnel-wrapper-path = $${directory:services}/6tunnel
6tunnel-wrapper-path = $${directory:services}/6tunnel
virtual-hard-drive-url = $${slap-parameter:virtual-hard-drive-url}
virtual-hard-drive-url = $${slap-parameter:virtual-hard-drive-url}
virtual-hard-drive-md5
-url = $${slap-parameter:virtual-hard-drive-md5-url
}
virtual-hard-drive-md5
sum = $${slap-parameter:virtual-hard-drive-md5sum
}
shell-path = ${dash:location}/bin/dash
shell-path = ${dash:location}/bin/dash
qemu-path = ${kvm:location}/bin/qemu-system-x86_64
qemu-path = ${kvm:location}/bin/qemu-system-x86_64
...
@@ -243,4 +243,4 @@ nat-rules = 22 80 443
...
@@ -243,4 +243,4 @@ nat-rules = 22 80 443
use-tap = False
use-tap = False
virtual-hard-drive-url =
virtual-hard-drive-url =
virtual-hard-drive-md5
-url
=
virtual-hard-drive-md5
sum
=
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