Commit 9ae2c6f1 authored by Alain Takoudjou's avatar Alain Takoudjou

add parameters to stop/start VM in cluster and enable vhost usage. Increase memory limit to

90Gb
parent f5ac1db1
...@@ -98,7 +98,7 @@ mode = 0644 ...@@ -98,7 +98,7 @@ mode = 0644
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/instance-kvm.cfg.jinja2 url = ${:_profile_base_location_}/instance-kvm.cfg.jinja2
mode = 644 mode = 644
md5sum = da3b3bde94ac2c06759a89c78168df91 md5sum = 52e115fe1aaf232994af9037bf7c292c
download-only = true download-only = true
on-update = true on-update = true
...@@ -106,7 +106,7 @@ on-update = true ...@@ -106,7 +106,7 @@ on-update = true
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/instance-kvm-cluster.cfg.jinja2.in url = ${:_profile_base_location_}/instance-kvm-cluster.cfg.jinja2.in
mode = 644 mode = 644
md5sum = 3fc6611feaabcacd7e51f3b5681120fd md5sum = 5700de1cadde0b5bede78f08e215f47a
download-only = true download-only = true
on-update = true on-update = true
...@@ -213,7 +213,7 @@ recipe = slapos.recipe.template:jinja2 ...@@ -213,7 +213,7 @@ recipe = slapos.recipe.template:jinja2
filename = template-httpd.cfg filename = template-httpd.cfg
template = ${:_profile_base_location_}/instance-kvm-http.cfg.in template = ${:_profile_base_location_}/instance-kvm-http.cfg.in
rendered = ${buildout:parts-directory}/${:_buildout_section_name_}/instance-kvm-http.cfg rendered = ${buildout:parts-directory}/${:_buildout_section_name_}/instance-kvm-http.cfg
md5sum = fc8b3259942d6dedbc01065358a00d71 md5sum = 26a181a48046ce88570adb32334747ef
context = context =
key apache_location apache:location key apache_location apache:location
raw openssl_executable_location ${openssl:location}/bin/openssl raw openssl_executable_location ${openssl:location}/bin/openssl
......
...@@ -144,6 +144,13 @@ ...@@ -144,6 +144,13 @@
"type": "string", "type": "string",
"default": "" "default": ""
}, },
"state": {
"title": "State of this Virtual Machine",
"description": "Define if SlapOS should start or stop this VM.",
"type": "string",
"default": "started",
"enum": ["started", "stopped"]
},
"ram-size": { "ram-size": {
"title": "RAM size", "title": "RAM size",
"description": "RAM size, in MB.", "description": "RAM size, in MB.",
...@@ -151,7 +158,7 @@ ...@@ -151,7 +158,7 @@
"default": 1024, "default": 1024,
"minimum": 128, "minimum": 128,
"multipleOf": 128, "multipleOf": 128,
"maximum": 16384 "maximum": 92160
}, },
"disk-size": { "disk-size": {
"title": "Disk size", "title": "Disk size",
...@@ -290,6 +297,12 @@ ...@@ -290,6 +297,12 @@
443 443
] ]
}, },
"enable-vhost": {
"title": "Use vhost-net to improve network performance of tap interface",
"description": "The vhost-net provides much improved network performance for your VM. Only work if the vhost-net kernel module is loaded and available on host machine, please keep this option off if you're not shure.",
"type": "boolean",
"default": false
},
"data-to-vm": { "data-to-vm": {
"title": "Text content to send to this virtual machine.", "title": "Text content to send to this virtual machine.",
"description": "Text content which will be written in a file 'data' of http server of this virtual machine instance. The file will be available via URL: http://10.0.2.100/data in the VM.", "description": "Text content which will be written in a file 'data' of http server of this virtual machine instance. The file will be available via URL: http://10.0.2.100/data in the VM.",
......
...@@ -28,6 +28,9 @@ config-use-ipv6 = {{ dumps(slapparameter_dict.get('use-ipv6', False)) }} ...@@ -28,6 +28,9 @@ config-use-ipv6 = {{ dumps(slapparameter_dict.get('use-ipv6', False)) }}
software-type = kvm software-type = kvm
name = {{ instance_name }} name = {{ instance_name }}
sla-computer_guid = {{ dumps(kvm_parameter_dict.get('computer-guid', '')) }} sla-computer_guid = {{ dumps(kvm_parameter_dict.get('computer-guid', '')) }}
{% if kvm_parameter_dict.get('state', '') == 'stopped' -%}
state = stopped
{% endif -%}
config-frontend-instance-name = {{ instance_name ~ ' VNC Frontend' }} config-frontend-instance-name = {{ instance_name ~ ' VNC Frontend' }}
config-frontend-software-type = {{ dumps(frontend_dict.get('software-type', 'frontend')) }} config-frontend-software-type = {{ dumps(frontend_dict.get('software-type', 'frontend')) }}
...@@ -53,6 +56,7 @@ config-nat-rules = {{ nat_rules_list | join(' ') }} ...@@ -53,6 +56,7 @@ config-nat-rules = {{ nat_rules_list | join(' ') }}
config-publish-nat-url = True config-publish-nat-url = True
config-use-nat = {{ use_nat }} config-use-nat = {{ use_nat }}
config-use-tap = {{ dumps(kvm_parameter_dict.get('use-tap', True)) }} config-use-tap = {{ dumps(kvm_parameter_dict.get('use-tap', True)) }}
config-enable-vhost = {{ dumps(kvm_parameter_dict.get('enable-vhost', False)) }}
config-virtual-hard-drive-url = {{ dumps(kvm_parameter_dict.get('virtual-hard-drive-url', '')) }} config-virtual-hard-drive-url = {{ dumps(kvm_parameter_dict.get('virtual-hard-drive-url', '')) }}
config-virtual-hard-drive-md5sum = {{ dumps(kvm_parameter_dict.get('virtual-hard-drive-md5sum', '')) }} config-virtual-hard-drive-md5sum = {{ dumps(kvm_parameter_dict.get('virtual-hard-drive-md5sum', '')) }}
config-virtual-hard-drive-gzipped = {{ dumps(kvm_parameter_dict.get('virtual-hard-drive-gzipped', False)) }} config-virtual-hard-drive-gzipped = {{ dumps(kvm_parameter_dict.get('virtual-hard-drive-gzipped', False)) }}
...@@ -189,7 +193,7 @@ mode = {{ mode }} ...@@ -189,7 +193,7 @@ mode = {{ mode }}
# write cluster-data into file public/data # write cluster-data into file public/data
{% if slapparameter_dict.get('cluster-data', '') -%} {% if slapparameter_dict.get('cluster-data', '') -%}
{{ writefile('cluster-data-content', '${http-server:root-dir}/data', slapparameter_dict.get('cluster-data', ''), '700') }} {{ writefile('cluster-data-content', '${directory:webroot}/${hash-code:passwd}/data', slapparameter_dict.get('cluster-data', ''), '700') }}
{% endif -%} {% endif -%}
[publish] [publish]
...@@ -203,6 +207,7 @@ extends = ...@@ -203,6 +207,7 @@ extends =
parts = parts =
httpd httpd
httpd-graceful
httpd-promise httpd-promise
publish publish
directory-doc directory-doc
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
parts = parts =
httpd httpd
httpd-graceful
httpd-promise httpd-promise
[directory] [directory]
...@@ -12,6 +13,7 @@ srv = ${buildout:directory}/srv ...@@ -12,6 +13,7 @@ srv = ${buildout:directory}/srv
public = ${:srv}/public/ public = ${:srv}/public/
log = ${:var}/log log = ${:var}/log
services = ${:etc}/service services = ${:etc}/service
scripts = ${:etc}/run
promises = ${:etc}/promise promises = ${:etc}/promise
run = ${:var}/run run = ${:var}/run
document = ${:srv}/document document = ${:srv}/document
...@@ -46,6 +48,14 @@ recipe = slapos.cookbook:wrapper ...@@ -46,6 +48,14 @@ recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:services}/httpd wrapper-path = ${directory:services}/httpd
command-line = "{{ apache_location }}/bin/httpd" -f "${apache-conf:rendered}" -DFOREGROUND command-line = "{{ apache_location }}/bin/httpd" -f "${apache-conf:rendered}" -DFOREGROUND
[httpd-graceful]
recipe = collective.recipe.template
input = inline:
#!/bin/sh
exec kill -USR1 $(cat ${apache-conf:pid-file})
output = ${directory:scripts}/httpd-graceful
mode = 700
[httpd-ssl] [httpd-ssl]
recipe = plone.recipe.command recipe = plone.recipe.command
command = "{{ openssl_executable_location }}" req -newkey rsa -batch -new -x509 -days 3650 -nodes -keyout "${:key}" -out "${:cert}" command = "{{ openssl_executable_location }}" req -newkey rsa -batch -new -x509 -days 3650 -nodes -keyout "${:key}" -out "${:cert}"
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"default": 1024, "default": 1024,
"minimum": 128, "minimum": 128,
"multipleOf": 128, "multipleOf": 128,
"maximum": 16384 "maximum": 92160
}, },
"disk-size": { "disk-size": {
"title": "Disk size", "title": "Disk size",
...@@ -135,6 +135,12 @@ ...@@ -135,6 +135,12 @@
"description": "List of rules for NAT of QEMU user mode network stack, as comma-separated list of ports. For each port specified, it will redirect port x of the VM (example: 80) to the port x + 10000 of the public IPv6 (example: 10080). Defaults to \"22 80 443\". Ignored if \"use-tap\" parameter is enabled.", "description": "List of rules for NAT of QEMU user mode network stack, as comma-separated list of ports. For each port specified, it will redirect port x of the VM (example: 80) to the port x + 10000 of the public IPv6 (example: 10080). Defaults to \"22 80 443\". Ignored if \"use-tap\" parameter is enabled.",
"type": "string" "type": "string"
}, },
"enable-vhost": {
"title": "Use vhost-net to improve network performance of tap interface",
"description": "The vhost-net provides much improved network performance for your VM. Only work if the vhost-net kernel module is loaded and available on host machine, please keep this option off if you're not shure.",
"type": "boolean",
"default": false
},
"enable-monitor": { "enable-monitor": {
"title": "Deploy monitoring tools", "title": "Deploy monitoring tools",
"description": "Deploy monitor instance to this kvm instance. It help to check instance status, log and promise results.", "description": "Deploy monitor instance to this kvm instance. It help to check instance status, log and promise results.",
......
...@@ -150,6 +150,7 @@ controller-path = ${directory:scripts}/kvm_controller ...@@ -150,6 +150,7 @@ controller-path = ${directory:scripts}/kvm_controller
use-tap = ${slap-parameter:use-tap} use-tap = ${slap-parameter:use-tap}
use-nat = ${slap-parameter:use-nat} use-nat = ${slap-parameter:use-nat}
nat-rules = ${slap-parameter:nat-rules} nat-rules = ${slap-parameter:nat-rules}
enable-vhost = ${slap-parameter:enable-vhost}
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}
...@@ -387,7 +388,7 @@ tap-ipv4 = ${slap-network-information:tap-ipv4} ...@@ -387,7 +388,7 @@ tap-ipv4 = ${slap-network-information:tap-ipv4}
{% endif -%} {% endif -%}
{% set kvm_http = 'http://${slap-network-information:local-ipv4}:' ~ slapparameter_dict.get('httpd-port', 8081) -%} {% set kvm_http = 'http://${slap-network-information:local-ipv4}:' ~ slapparameter_dict.get('httpd-port', 8081) -%}
{% if enable_http == 'True' %} {% if enable_http == 'true' %}
{% if use_nat == 'true' -%} {% if use_nat == 'true' -%}
{% set kvm_http = 'http://10.0.2.100' -%} {% set kvm_http = 'http://10.0.2.100' -%}
{% endif %} {% endif %}
...@@ -548,6 +549,7 @@ numa = ...@@ -548,6 +549,7 @@ numa =
nat-rules = 22 80 443 nat-rules = 22 80 443
use-nat = True use-nat = True
use-tap = False use-tap = False
enable-vhost = False
virtual-hard-drive-url = virtual-hard-drive-url =
virtual-hard-drive-md5sum = virtual-hard-drive-md5sum =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment