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
00e55f04
Commit
00e55f04
authored
Oct 29, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
KVM: convert kvm instance profile to jinja2.
parent
bf218a8c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
262 additions
and
6 deletions
+262
-6
software/kvm/common.cfg
software/kvm/common.cfg
+21
-6
software/kvm/instance-kvm.cfg.jinja2
software/kvm/instance-kvm.cfg.jinja2
+241
-0
No files found.
software/kvm/common.cfg
View file @
00e55f04
...
...
@@ -85,10 +85,24 @@ output = ${buildout:directory}/template.cfg
mode = 0644
[template-kvm]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kvm.cfg.in
md5sum = c06bb498593aabc9c76eb7dc892da15a
output = ${buildout:directory}/template-kvm.cfg
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance-kvm.cfg.jinja2
md5sum = 03550e647e07af99dcd2af8f4869ecbe
rendered = ${buildout:directory}/template-kvm.cfg
output = ${:rendered}
context =
key develop_eggs_directory buildout:develop-eggs-directory
key eggs_directory buildout:eggs-directory
raw curl_executable_location ${curl:location}/bin/curl
raw dash_executable_location ${dash:location}/bin/dash
raw dcron_executable_location ${dcron:location}/sbin/crond
raw debian_amd64_netinst_location ${debian-amd64-netinst.iso:location}/${debian-amd64-netinst.iso:filename}
raw novnc_location ${noVNC:location}
raw openssl_executable_location ${openssl:location}/bin/openssl
raw qemu_executable_location ${kvm:location}/bin/qemu-system-x86_64
raw qemu_img_executable_location ${kvm:location}/bin/qemu-img
raw sixtunnel_executable_location ${6tunnel:location}/bin/6tunnel
raw websockify_executable_location ${buildout:directory}/bin/websockify
mode = 0644
[template-kvm-resilient]
...
...
@@ -151,3 +165,4 @@ md5sum = cdb690495e9eb007d2b7d2f8e12f5c59
output = ${buildout:directory}/template-frontend.cfg
mode = 0644
software/kvm/instance-kvm.cfg.
in
→
software/kvm/instance-kvm.cfg.
jinja2
View file @
00e55f04
...
...
@@ -16,34 +16,34 @@ parts =
# cron-entry-monitor
frontend-promise
eggs-directory =
${buildout:eggs-directory
}
develop-eggs-directory =
${buildout:develop-eggs-directory
}
eggs-directory =
{{ eggs_directory }
}
develop-eggs-directory =
{{ develop_eggs_directory }
}
offline = true
[directory]
recipe = slapos.cookbook:mkdirectory
etc = $
$
{buildout:directory}/etc
bin = $
$
{buildout:directory}/bin
srv = $
$
{buildout:directory}/srv
var = $
$
{buildout:directory}/var
log = $
$
{:var}/log
scripts = $
$
{:etc}/run
services = $
$
{:etc}/service
promises = $
$
{:etc}/promise
novnc-conf = $
$
{:etc}/novnc
run = $
$
{:var}/run
ca-dir = $
$
{:srv}/ssl
cron-entries = $
$
{:etc}/cron.d
crontabs = $
$
{:etc}/crontabs
cronstamps = $
$
{:etc}/cronstamps
etc = ${buildout:directory}/etc
bin = ${buildout:directory}/bin
srv = ${buildout:directory}/srv
var = ${buildout:directory}/var
log = ${:var}/log
scripts = ${:etc}/run
services = ${:etc}/service
promises = ${:etc}/promise
novnc-conf = ${:etc}/novnc
run = ${:var}/run
ca-dir = ${:srv}/ssl
cron-entries = ${:etc}/cron.d
crontabs = ${:etc}/crontabs
cronstamps = ${:etc}/cronstamps
[create-mac]
recipe = slapos.cookbook:generate.mac
storage-path = $
$
{directory:srv}/mac
storage-path = ${directory:srv}/mac
[gen-passwd]
recipe = slapos.cookbook:generate.password
storage-path = $
$
{directory:srv}/passwd
storage-path = ${directory:srv}/passwd
bytes = 8
...
...
@@ -52,126 +52,115 @@ bytes = 8
# Specific code. It needs Jinja.
recipe = slapos.cookbook:kvm
vnc-passwd = $
$
{gen-passwd:passwd}
vnc-passwd = ${gen-passwd:passwd}
ipv4 = $
$
{slap-network-information:local-ipv4}
ipv6 = $
$
{slap-network-information:global-ipv6}
vnc-ip = $
$
{:ipv4}
ipv4 = ${slap-network-information:local-ipv4}
ipv6 = ${slap-network-information:global-ipv6}
vnc-ip = ${:ipv4}
vnc-port = 5901
# XXX-Cedric: should be named "default-cdrom-iso"
default-disk-image =
${debian-amd64-netinst.iso:location}/${debian-amd64-netinst.iso:filename
}
nbd-host = $
$
{slap-parameter:nbd-host}
nbd-port = $
$
{slap-parameter:nbd-port}
nbd2-host = $
$
{slap-parameter:nbd2-host}
nbd2-port = $
$
{slap-parameter:nbd2-port}
default-disk-image =
{{ debian_amd64_netinst_location }
}
nbd-host = ${slap-parameter:nbd-host}
nbd-port = ${slap-parameter:nbd-port}
nbd2-host = ${slap-parameter:nbd2-host}
nbd2-port = ${slap-parameter:nbd2-port}
tap-interface = $
$
{slap-network-information:network-interface}
tap-interface = ${slap-network-information:network-interface}
disk-path = $
$
{directory:srv}/virtual.qcow2
disk-size = $
$
{slap-parameter:disk-size}
disk-type = $
$
{slap-parameter:disk-type}
disk-path = ${directory:srv}/virtual.qcow2
disk-size = ${slap-parameter:disk-size}
disk-type = ${slap-parameter:disk-type}
socket-path = $
$
{directory:var}/qmp_socket
pid-file-path = $
$
{directory:run}/pid_file
socket-path = ${directory:var}/qmp_socket
pid-file-path = ${directory:run}/pid_file
smp-count = $
$
{slap-parameter:cpu-count}
ram-size = $
$
{slap-parameter:ram-size}
mac-address = $
$
{create-mac:mac-address}
smp-count = ${slap-parameter:cpu-count}
ram-size = ${slap-parameter:ram-size}
mac-address = ${create-mac:mac-address}
# XXX-Cedric: should be named runner-wrapper-path and controller-wrapper-path
runner-path = $
$
{directory:services}/kvm
controller-path = $
$
{directory:scripts}/kvm_controller
runner-path = ${directory:services}/kvm
controller-path = ${directory:scripts}/kvm_controller
use-tap = $
$
{slap-parameter:use-tap}
nat-rules = $
$
{slap-parameter:nat-rules}
6tunnel-wrapper-path = $
$
{directory:services}/6tunnel
use-tap = ${slap-parameter:use-tap}
nat-rules = ${slap-parameter:nat-rules}
6tunnel-wrapper-path = ${directory:services}/6tunnel
virtual-hard-drive-url = $
$
{slap-parameter:virtual-hard-drive-url}
virtual-hard-drive-md5sum = $
$
{slap-parameter:virtual-hard-drive-md5sum}
virtual-hard-drive-url = ${slap-parameter:virtual-hard-drive-url}
virtual-hard-drive-md5sum = ${slap-parameter:virtual-hard-drive-md5sum}
shell-path =
${dash:location}/bin/dash
qemu-path =
${kvm:location}/bin/qemu-system-x86_64
qemu-img-path =
${kvm:location}/bin/qemu-img
6tunnel-path =
${6tunnel:location}/bin/6tunnel
shell-path =
{{ dash_executable_location }}
qemu-path =
{{ qemu_executable_location }}
qemu-img-path =
{{ qemu_img_executable_location }}
6tunnel-path =
{{ sixtunnel_executable_location }}
[kvm-vnc-promise]
recipe = slapos.cookbook:check_port_listening
path = $
$
{directory:promises}/vnc_promise
hostname = $
$
{kvm-instance:vnc-ip}
port = $
$
{kvm-instance:vnc-port}
path = ${directory:promises}/vnc_promise
hostname = ${kvm-instance:vnc-ip}
port = ${kvm-instance:vnc-port}
[kvm-disk-image-corruption-promise]
# Check that disk image is not corrupted
recipe = collective.recipe.template
input = inline:#!/bin/sh
$
${kvm-instance:qemu-img-path} check $
${kvm-instance:disk-path}
output = $
$
{directory:promises}/kvm-disk-image-corruption
$
{kvm-instance:qemu-img-path} check
${kvm-instance:disk-path}
output = ${directory:promises}/kvm-disk-image-corruption
mode = 700
[novnc-instance]
recipe = slapos.cookbook:novnc
path = $
$
{ca-novnc:executable}
ip = $
$
{slap-network-information:global-ipv6}
path = ${ca-novnc:executable}
ip = ${slap-network-information:global-ipv6}
port = 6080
vnc-ip = $
$
{kvm-instance:vnc-ip}
vnc-port = $
$
{kvm-instance:vnc-port}
novnc-location =
${noVNC:location
}
websockify-path =
${buildout:directory}/bin/websockify
ssl-key-path = $
$
{ca-novnc:key-file}
ssl-cert-path = $
$
{ca-novnc:cert-file}
vnc-ip = ${kvm-instance:vnc-ip}
vnc-port = ${kvm-instance:vnc-port}
novnc-location =
{{ novnc_location }
}
websockify-path =
{{ websockify_executable_location }}
ssl-key-path = ${ca-novnc:key-file}
ssl-cert-path = ${ca-novnc:cert-file}
[websockify-sighandler]
recipe = slapos.cookbook:signalwrapper
wrapper-path = $
$
{directory:services}/websockify
wrapped-path = $
$
{novnc-instance:path}
wrapper-path = ${directory:services}/websockify
wrapped-path = ${novnc-instance:path}
[certificate-authority]
recipe = slapos.cookbook:certificate_authority
openssl-binary =
${openssl:location}/bin/openssl
ca-dir = $
$
{directory:ca-dir}
requests-directory = $
$
{cadirectory:requests}
wrapper = $
$
{directory:services}/certificate_authority
ca-private = $
$
{cadirectory:private}
ca-certs = $
$
{cadirectory:certs}
ca-newcerts = $
$
{cadirectory:newcerts}
ca-crl = $
$
{cadirectory:crl}
openssl-binary =
{{ openssl_executable_location }}
ca-dir = ${directory:ca-dir}
requests-directory = ${cadirectory:requests}
wrapper = ${directory:services}/certificate_authority
ca-private = ${cadirectory:private}
ca-certs = ${cadirectory:certs}
ca-newcerts = ${cadirectory:newcerts}
ca-crl = ${cadirectory:crl}
[cadirectory]
recipe = slapos.cookbook:mkdirectory
requests = $
$
{directory:ca-dir}/requests/
private = $
$
{directory:ca-dir}/private/
certs = $
$
{directory:ca-dir}/certs/
newcerts = $
$
{directory:ca-dir}/newcerts/
crl = $
$
{directory:ca-dir}/crl/
requests = ${directory:ca-dir}/requests/
private = ${directory:ca-dir}/private/
certs = ${directory:ca-dir}/certs/
newcerts = ${directory:ca-dir}/newcerts/
crl = ${directory:ca-dir}/crl/
[ca-novnc]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
key-file = $
$
{directory:novnc-conf}/novnc.key
cert-file = $
$
{directory:novnc-conf}/novnc.crt
executable = $
$
{directory:bin}/novnc
wrapper = $
$
{directory:bin}/websockify
key-file = ${directory:novnc-conf}/novnc.key
cert-file = ${directory:novnc-conf}/novnc.crt
executable = ${directory:bin}/novnc
wrapper = ${directory:bin}/websockify
[novnc-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promises}/novnc_promise
hostname = $${novnc-instance:ip}
port = $${novnc-instance:port}
#[kvm-monitor]
#recipe = slapos.cookbook:wrapper
#wrapper-path = $${directory:services}/kvm_monitor
#command-line = ${buildout:bin-directory}/kvm.monitor.test
# $${buildout:directory}/buildout-switch-softwaretype.cfg
# $${buildout:directory}/report.xml
# -s slap-parameter
# -opts disk-size ram-size cpu-count
path = ${directory:promises}/novnc_promise
hostname = ${novnc-instance:ip}
port = ${novnc-instance:port}
#----------------
...
...
@@ -180,57 +169,54 @@ port = $${novnc-instance:port}
[cron]
recipe = slapos.cookbook:cron
dcrond-binary =
${dcron:location}/sbin/crond
cron-entries = $
$
{directory:cron-entries}
crontabs = $
$
{directory:crontabs}
cronstamps = $
$
{directory:cronstamps}
catcher = $
$
{cron-simplelogger:wrapper}
binary = $
$
{directory:services}/crond
dcrond-binary =
{{ dcron_executable_location }}
cron-entries = ${directory:cron-entries}
crontabs = ${directory:crontabs}
cronstamps = ${directory:cronstamps}
catcher = ${cron-simplelogger:wrapper}
binary = ${directory:services}/crond
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $
$
{directory:bin}/cron_simplelogger
log = $
$
{directory:log}/crond.log
wrapper = ${directory:bin}/cron_simplelogger
log = ${directory:log}/crond.log
#[cron-entry-monitor]
#<= cron
#recipe = slapos.cookbook:cron.d
#name = kvm_monitor
#frequency = 0 0 * * *
#command = $${kvm-monitor:wrapper-path}
#----------------
#--
#-- Deploy frontend.
[request-slave-frontend]
recipe = slapos.cookbook:requestoptional
software-url = $
$
{slap-parameter:frontend-software-url}
server-url = $
$
{slap-connection:server-url}
key-file = $
$
{slap-connection:key-file}
cert-file = $
$
{slap-connection:cert-file}
computer-id = $
$
{slap-connection:computer-id}
partition-id = $
$
{slap-connection:partition-id}
software-url = ${slap-parameter:frontend-software-url}
server-url = ${slap-connection:server-url}
key-file = ${slap-connection:key-file}
cert-file = ${slap-connection:cert-file}
computer-id = ${slap-connection:computer-id}
partition-id = ${slap-connection:partition-id}
name = VNC Frontend
software-type = $
$
{slap-parameter:frontend-software-type}
software-type = ${slap-parameter:frontend-software-type}
slave = true
config = host port
config-host = $
$
{novnc-instance:ip}
config-port = $
$
{novnc-instance:port}
config-host = ${novnc-instance:ip}
config-port = ${novnc-instance:port}
return = url resource port domainname
sla = instance_guid
sla-instance_guid = $${slap-parameter:frontend-instance-guid}
sla-instance_guid = ${slap-parameter:frontend-instance-guid}
[frontend-promise]
recipe = slapos.cookbook:check_url_available
path = ${directory:promises}/frontend_promise
url = ${publish-connection-information:url}
dash_path = {{ dash_executable_location }}
curl_path = {{ curl_executable_location }}
[publish-connection-information]
recipe = slapos.cookbook:publish
backend-url = https://[$
${novnc-instance:ip}]:$${novnc-instance:port}/vnc_auto.html?host=[$${novnc-instance:ip}]&port=$${novnc-instance:port}&encrypt=1&password=$
${kvm-instance:vnc-passwd}
url = $
${request-slave-frontend:connection-url}/vnc_auto.html?host=$${request-slave-frontend:connection-domainname}&port=$${request-slave-frontend:connection-port}&encrypt=1&path=$${request-slave-frontend:connection-resource}&password=$
${kvm-instance:vnc-passwd}
ipv6 = $
$
{slap-network-information:global-ipv6}
backend-url = https://[$
{novnc-instance:ip}]:${novnc-instance:port}/vnc_auto.html?host=[${novnc-instance:ip}]&port=${novnc-instance:port}&encrypt=1&password=
${kvm-instance:vnc-passwd}
url = $
{request-slave-frontend:connection-url}/vnc_auto.html?host=${request-slave-frontend:connection-domainname}&port=${request-slave-frontend:connection-port}&encrypt=1&path=${request-slave-frontend:connection-resource}&password=
${kvm-instance:vnc-passwd}
ipv6 = ${slap-network-information:global-ipv6}
[frontend-promise]
recipe = slapos.cookbook:check_url_available
path = $${directory:promises}/frontend_promise
url = $${publish-connection-information:url}
dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl
[slap-parameter]
# Default values if not specified
...
...
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