KVM SR: Remove brain overhead of having a dict created from another dict.
[slapos.git] / software / kvm / instance-kvm.cfg.in
1 #############################
2 #
3 # Instanciate kvm
4 #
5 #############################
6 [buildout]
7 parts =
8   certificate-authority
9   publish-connection-information
10   kvm-promise
11   websockify-sighandler
12   novnc-promise
13 #  kvm-monitor
14   cron
15 #  cron-entry-monitor
16   frontend-promise
17
18 eggs-directory = ${buildout:eggs-directory}
19 develop-eggs-directory = ${buildout:develop-eggs-directory}
20 offline = true
21
22 [directory]
23 recipe = slapos.cookbook:mkdirectory
24 etc = $${buildout:directory}/etc
25 bin = $${buildout:directory}/bin
26 srv = $${buildout:directory}/srv
27 var = $${buildout:directory}/var
28 log = $${:var}/log
29 scripts = $${:etc}/run
30 services = $${:etc}/service
31 promises = $${:etc}/promise
32 novnc-conf = $${:etc}/novnc
33 run = $${:var}/run
34 ca-dir = $${:srv}/ssl
35 cron-entries = $${:etc}/cron.d
36 crontabs = $${:etc}/crontabs
37 cronstamps = $${:etc}/cronstamps
38
39 [create-mac]
40 recipe = slapos.cookbook:generate.mac
41 storage-path = $${directory:srv}/mac
42
43 [gen-passwd]
44 recipe = slapos.cookbook:generate.password
45 storage-path = $${directory:srv}/passwd
46 bytes = 8
47
48
49 [kvm-instance]
50 # XXX-Cedric: change "KVM" recipe to simple "create wrappers". No need for this
51 # Specific code. It needs Jinja.
52 recipe = slapos.cookbook:kvm
53
54 vnc-passwd = $${gen-passwd:passwd}
55
56 ipv4 = $${slap-network-information:local-ipv4}
57 ipv6 = $${slap-network-information:global-ipv6}
58 vnc-ip = $${:ipv4}
59
60 vnc-port = 5901
61
62 # XXX-Cedric: should be named "default-cdrom-iso"
63 default-disk-image = ${debian-amd64-netinst.iso:location}/${debian-amd64-netinst.iso:filename}
64 nbd-host = $${slap-parameter:nbd-host}
65 nbd-port = $${slap-parameter:nbd-port}
66 nbd2-host = $${slap-parameter:nbd2-host}
67 nbd2-port = $${slap-parameter:nbd2-port}
68
69 tap-interface = $${slap-network-information:network-interface}
70
71 disk-path = $${directory:srv}/virtual.qcow2
72 disk-size = $${slap-parameter:disk-size}
73 disk-type = $${slap-parameter:disk-type}
74
75 socket-path = $${directory:var}/qmp_socket
76 pid-file-path = $${directory:run}/pid_file
77
78 smp-count = $${slap-parameter:cpu-count}
79 ram-size = $${slap-parameter:ram-size}
80 mac-address = $${create-mac:mac-address}
81
82 # XXX-Cedric: should be named runner-wrapper-path and controller-wrapper-path
83 runner-path = $${directory:services}/kvm
84 controller-path = $${directory:scripts}/kvm_controller
85
86 use-tap = $${slap-parameter:use-tap}
87 nat-rules = $${slap-parameter:nat-rules}
88 6tunnel-wrapper-path = $${directory:services}/6tunnel
89
90 virtual-hard-drive-url = $${slap-parameter:virtual-hard-drive-url}
91 virtual-hard-drive-md5-url = $${slap-parameter:virtual-hard-drive-md5-url}
92
93 shell-path = ${dash:location}/bin/dash
94 qemu-path = ${kvm:location}/bin/qemu-system-x86_64
95 qemu-img-path = ${kvm:location}/bin/qemu-img
96 6tunnel-path = ${6tunnel:location}/bin/6tunnel
97
98
99 [kvm-promise]
100 recipe = slapos.cookbook:check_port_listening
101 path = $${directory:promises}/vnc_promise
102 hostname = $${kvm-instance:vnc-ip}
103 port = $${kvm-instance:vnc-port}
104
105
106 [novnc-instance]
107 recipe = slapos.cookbook:novnc
108 path = $${ca-novnc:executable}
109 ip = $${slap-network-information:global-ipv6}
110 port = 6080
111 vnc-ip = $${kvm-instance:vnc-ip}
112 vnc-port = $${kvm-instance:vnc-port}
113 novnc-location = ${noVNC:location}
114 websockify-path = ${buildout:directory}/bin/websockify
115 ssl-key-path = $${ca-novnc:key-file}
116 ssl-cert-path = $${ca-novnc:cert-file}
117
118 [websockify-sighandler]
119 recipe = slapos.cookbook:signalwrapper
120 wrapper-path = $${directory:services}/websockify
121 wrapped-path = $${novnc-instance:path}
122
123 [certificate-authority]
124 recipe = slapos.cookbook:certificate_authority
125 openssl-binary = ${openssl:location}/bin/openssl
126 ca-dir = $${directory:ca-dir}
127 requests-directory = $${cadirectory:requests}
128 wrapper = $${directory:services}/certificate_authority
129 ca-private = $${cadirectory:private}
130 ca-certs = $${cadirectory:certs}
131 ca-newcerts = $${cadirectory:newcerts}
132 ca-crl = $${cadirectory:crl}
133
134 [cadirectory]
135 recipe = slapos.cookbook:mkdirectory
136 requests = $${directory:ca-dir}/requests/
137 private = $${directory:ca-dir}/private/
138 certs = $${directory:ca-dir}/certs/
139 newcerts = $${directory:ca-dir}/newcerts/
140 crl = $${directory:ca-dir}/crl/
141
142 [ca-novnc]
143 <= certificate-authority
144 recipe = slapos.cookbook:certificate_authority.request
145 key-file = $${directory:novnc-conf}/novnc.key
146 cert-file = $${directory:novnc-conf}/novnc.crt
147 executable = $${directory:bin}/novnc
148 wrapper = $${directory:bin}/websockify
149
150 [novnc-promise]
151 recipe = slapos.cookbook:check_port_listening
152 path = $${directory:promises}/novnc_promise
153 hostname = $${novnc-instance:ip}
154 port = $${novnc-instance:port}
155
156
157 #[kvm-monitor]
158 #recipe = slapos.cookbook:wrapper
159 #wrapper-path = $${directory:services}/kvm_monitor
160 #command-line = ${buildout:bin-directory}/kvm.monitor.test
161 #             $${buildout:directory}/buildout-switch-softwaretype.cfg
162 #             $${buildout:directory}/report.xml
163 #             -s slap-parameter
164 #             -opts disk-size ram-size cpu-count
165
166
167
168 #----------------
169 #--
170 #-- Deploy cron.
171
172 [cron]
173 recipe = slapos.cookbook:cron
174 dcrond-binary = ${dcron:location}/sbin/crond
175 cron-entries = $${directory:cron-entries}
176 crontabs = $${directory:crontabs}
177 cronstamps = $${directory:cronstamps}
178 catcher = $${cron-simplelogger:wrapper}
179 binary = $${directory:services}/crond
180
181 [cron-simplelogger]
182 recipe = slapos.cookbook:simplelogger
183 wrapper = $${directory:bin}/cron_simplelogger
184 log = $${directory:log}/crond.log
185
186
187 #[cron-entry-monitor]
188 #<= cron
189 #recipe = slapos.cookbook:cron.d
190 #name = kvm_monitor
191 #frequency = 0 0 * * *
192 #command = $${kvm-monitor:wrapper-path}
193
194 [request-slave-frontend]
195 recipe = slapos.cookbook:requestoptional
196 software-url = $${slap-parameter:frontend-software-url}
197 server-url = $${slap-connection:server-url}
198 key-file = $${slap-connection:key-file}
199 cert-file = $${slap-connection:cert-file}
200 computer-id = $${slap-connection:computer-id}
201 partition-id = $${slap-connection:partition-id}
202 name = VNC Frontend
203 software-type = $${slap-parameter:frontend-software-type}
204 slave = true
205 config = host port
206 config-host = $${novnc-instance:ip}
207 config-port = $${novnc-instance:port}
208 return = url resource port domainname
209 sla = instance_guid
210 sla-instance_guid = $${slap-parameter:frontend-instance-guid}
211
212
213 [publish-connection-information]
214 recipe = slapos.cookbook:publish
215 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}
216 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}
217
218
219 [frontend-promise]
220 recipe = slapos.cookbook:check_url_available
221 path = $${directory:promises}/frontend_promise
222 url = $${publish-connection-information:url}
223 dash_path = ${dash:location}/bin/dash
224 curl_path = ${curl:location}/bin/curl
225
226 [slap-parameter]
227 # Default values if not specified
228 frontend-software-type = frontend
229 frontend-software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.92:/software/kvm/software.cfg
230 frontend-instance-guid =
231 nbd-port = 1024
232 nbd-host =
233 nbd2-port = 1024
234 nbd2-host =
235
236 ram-size = 1024
237 disk-size = 10
238 disk-type = virtio
239
240 cpu-count = 1
241
242 nat-rules = 22 80 443
243 use-tap = False
244
245 virtual-hard-drive-url =
246 virtual-hard-drive-md5-url =