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
Alain Takoudjou
slapos
Commits
5067f9af
Commit
5067f9af
authored
Apr 22, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'kvm'
parents
9411bfb0
a817f39d
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
99 additions
and
79 deletions
+99
-79
component/qemu-kvm/buildout.cfg
component/qemu-kvm/buildout.cfg
+3
-2
slapos/recipe/kvm_frontend/__init__.py
slapos/recipe/kvm_frontend/__init__.py
+2
-1
slapos/recipe/kvm_frontend/template/kvm-proxy.js
slapos/recipe/kvm_frontend/template/kvm-proxy.js
+63
-39
slapos/recipe/kvm_frontend/template/nodejs_run.in
slapos/recipe/kvm_frontend/template/nodejs_run.in
+1
-1
software/kvm/common.cfg
software/kvm/common.cfg
+4
-10
software/kvm/development.cfg
software/kvm/development.cfg
+10
-3
software/kvm/instance-frontend.cfg.in
software/kvm/instance-frontend.cfg.in
+13
-4
software/kvm/instance-kvm.cfg.in
software/kvm/instance-kvm.cfg.in
+3
-4
software/kvm/instance-kvmplus.cfg.in
software/kvm/instance-kvmplus.cfg.in
+0
-14
software/kvm/instance.cfg.in
software/kvm/instance.cfg.in
+0
-1
No files found.
component/qemu-kvm/buildout.cfg
View file @
5067f9af
...
...
@@ -11,8 +11,9 @@ extends =
[qemu-kvm]
recipe = slapos.recipe.cmmi
url = http://downloads.sourceforge.net/project/kvm/qemu-kvm/1.2.0/qemu-kvm-1.2.0.tar.gz
md5sum = d7b18b673c48abfee65a9c0245df0415
# qemu-kvm and qemu are now the same since 1.3.
url = http://wiki.qemu-project.org/download/qemu-1.4.1.tar.bz2
md5sum = eb2d696956324722b5ecfa46e41f9a75
configure-options =
--disable-sdl
--disable-xen
...
...
slapos/recipe/kvm_frontend/__init__.py
View file @
5067f9af
...
...
@@ -107,7 +107,8 @@ class Recipe(GenericSlapRecipe):
http_redirect_server
=
''
config
=
dict
(
ip
=
self
.
options
[
'ip'
],
ipv6
=
self
.
options
[
'ipv6'
],
ipv4
=
self
.
options
[
'ipv4'
],
port
=
self
.
options
[
'port'
],
key
=
self
.
options
[
'ssl-key-path'
],
certificate
=
self
.
options
[
'ssl-cert-path'
],
...
...
slapos/recipe/kvm_frontend/template/kvm-proxy.js
View file @
5067f9af
...
...
@@ -37,12 +37,13 @@ var fs = require('fs'),
httpProxy
=
require
(
'
http-proxy
'
),
proxyByUrl
=
require
(
'
proxy-by-url
'
);
var
listenInterface
=
process
.
argv
[
2
],
port
=
process
.
argv
[
3
],
sslKeyFile
=
process
.
argv
[
4
],
sslCertFile
=
process
.
argv
[
5
],
proxyTable
=
process
.
argv
[
6
],
redirect
=
process
.
argv
[
7
]
||
false
,
var
listenInterfacev6
=
process
.
argv
[
2
],
listenInterfacev4
=
process
.
argv
[
3
],
port
=
process
.
argv
[
4
],
sslKeyFile
=
process
.
argv
[
5
],
sslCertFile
=
process
.
argv
[
6
],
proxyTable
=
process
.
argv
[
7
],
redirect
=
process
.
argv
[
8
]
||
false
,
isRawIPv6
;
if
(
process
.
argv
.
length
<
7
)
{
...
...
@@ -50,11 +51,6 @@ if (process.argv.length < 7) {
process
.
exit
(
1
);
}
isRawIPv6
=
function
checkipv6
(
str
)
{
// Inspired by http://forums.intermapper.com/viewtopic.php?t=452
return
(
/^
\s
*
((([
0-9A-Fa-f
]{1,4}
:
){7}([
0-9A-Fa-f
]{1,4}
|:
))
|
(([
0-9A-Fa-f
]{1,4}
:
){6}(
:
[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]
|2
[
0-4
]\d
|1
\d\d
|
[
1-9
]?\d)){3}))
|:
))
|
(
:
(((
:
[
0-9A-Fa-f
]{1,4}){1,7})
|
((
:
[
0-9A-Fa-f
]{1,4}){0,5}
:
((
25
[
0-5
]
|2
[
0-4
]\d
|1
\d\d
|
[
1-9
]?\d)(\.(
25
[
0-5
]
|2
[
0-4
]\d
|1
\d\d
|
[
1-9
]?\d)){3}))
|:
)))(
%.+
)?\s
*$/
.
test
(
str
));
}(
listenInterface
);
/**
* Dummy middleware that throws 404 not found. Does not contain websocket
* middleware.
...
...
@@ -69,7 +65,7 @@ var middlewareNotFound = function(req, res, proxy) {
/**
* Create server
*/
var
proxyServer
=
httpProxy
.
createServer
(
var
proxyServer
v6
=
httpProxy
.
createServer
(
// We declare our proxyByUrl middleware
proxyByUrl
(
proxyTable
),
// Then we add your dummy middleware, called when proxyByUrl doesn't find url.
...
...
@@ -87,42 +83,70 @@ var proxyServer = httpProxy.createServer(
)
},
source
:
{
host
:
listenInterface
,
host
:
listenInterface
v6
,
port
:
port
}}
);
var
proxyServerv4
=
httpProxy
.
createServer
(
// We declare our proxyByUrl middleware
proxyByUrl
(
proxyTable
),
// Then we add your dummy middleware, called when proxyByUrl doesn't find url.
middlewareNotFound
,
// And we set HTTPS options for server. HTTP will be forbidden.
{
https
:
{
key
:
fs
.
readFileSync
(
sslKeyFile
,
'
utf8
'
),
cert
:
fs
.
readFileSync
(
sslCertFile
,
'
utf8
'
)
},
source
:
{
host
:
listenInterfacev4
,
port
:
port
}}
);
console
.
log
(
'
HTTPS server starting and trying to listen on
'
+
listenInterface
+
'
:
'
+
port
);
listenInterface
v4
+
'
:
'
+
port
);
// Release the beast.
proxyServer
.
listen
(
port
,
listenInterface
);
proxyServerv6
.
listen
(
port
,
listenInterfacev6
);
proxyServerv4
.
listen
(
port
,
listenInterfacev4
);
// Dummy HTTP server redirecting to HTTPS. Only has sense if we can use port 80
if
(
redirect
===
'
1
'
)
{
console
.
log
(
'
HTTP redirect server starting and trying to listen on
'
+
listenInterface
+
'
:
'
+
httpPort
);
try
{
var
httpPort
=
80
;
http
.
createServer
(
function
(
req
,
res
)
{
var
url
;
if
(
isRawIPv6
===
true
)
{
url
=
'
https://[
'
+
listenInterface
+
'
]
'
;
}
else
{
url
=
'
https://
'
+
listenInterface
;
}
// If non standard port : need to specify it
if
(
port
!==
443
)
{
url
=
url
+
'
:
'
+
port
;
}
// Add last part of URL
url
=
url
+
req
.
url
;
console
.
log
(
url
);
// Anwser "permanently redirected"
res
.
statusCode
=
301
;
res
.
setHeader
(
'
Location
'
,
url
);
res
.
end
();
}).
listen
(
httpPort
,
listenInterface
);
}
catch
(
error
)
{
console
.
log
(
'
Couldn
\'
t start plain HTTP redirection server :
'
+
error
)
}
/*
*try {
* var httpPort = 80;
* http.createServer(function(req, res) {
* var url;
* if (isRawIPv6 === true) {
* url = 'https://[' + listenInterface + ']';
* } else {
* url = 'https://' + listenInterface;
* }
* // If non standard port : need to specify it
* if (port !== 443) {
* url = url + ':' + port;
* }
* // Add last part of URL
* url = url + req.url;
* console.log(url);
* // Anwser "permanently redirected"
* res.statusCode = 301;
* res.setHeader('Location', url);
* res.end();
* }).listen(httpPort, listenInterface);
* } catch (error) {
* console.log('Couldn\'t start plain HTTP redirection server : ' + error)
* }
*/
}
slapos/recipe/kvm_frontend/template/nodejs_run.in
View file @
5067f9af
...
...
@@ -2,4 +2,4 @@
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
export NODE_PATH=%(node_env)s
exec %(node_path)s %(conf_path)s %(ip)s %(port)s %(key)s %(certificate)s %(map_path)s %(plain_http)s
exec %(node_path)s %(conf_path)s %(ip
v6)s %(ipv4
)s %(port)s %(key)s %(certificate)s %(map_path)s %(plain_http)s
software/kvm/common.cfg
View file @
5067f9af
...
...
@@ -56,6 +56,7 @@ recipe = plone.recipe.command
destination = ${buildout:parts-directory}/${:_buildout_section_name_}
location = ${buildout:parts-directory}/${:_buildout_section_name_}
command =
export HOME=${:location};
rm -fr ${:destination} &&
mkdir -p ${:destination} &&
cd ${:destination} &&
...
...
@@ -69,17 +70,10 @@ command =
[template-kvm]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kvm.cfg.in
md5sum =
c0320447308299ec9caaeece4187bc1f
md5sum =
87197471aa93863c310204e8865b5ac1
output = ${buildout:directory}/template-kvm.cfg
mode = 0644
[template-kvmplus]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kvmplus.cfg.in
md5sum = c8e92237eeda93caca1132b5202c3a02
output = ${buildout:directory}/template-kvmplus.cfg
mode = 0644
[template-nbd]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-nbd.cfg.in
...
...
@@ -90,13 +84,13 @@ mode = 0644
[template-frontend]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-frontend.cfg.in
md5sum =
73359b52013b1b65f75005e8698ed180
md5sum =
cdb690495e9eb007d2b7d2f8e12f5c59
output = ${buildout:directory}/template-frontend.cfg
mode = 0644
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg.in
md5sum =
68788763d23f70f24b9e575871c903a8
md5sum =
0a98e34aaec7097a84066c0665e3a49a
output = ${buildout:directory}/template.cfg
mode = 0644
software/kvm/development.cfg
View file @
5067f9af
[buildout]
extends =
../../git/buildout.cfg
../../
component/
git/buildout.cfg
common.cfg
parts +=
slapos.cookbook-repository
slapos.core-repository
slapos.toolbox-repository
check-recipe
develop =
${:parts-directory}/slapos.cookbook-repository
${:parts-directory}/slapos.toolbox-repository
[slapos.cookbook-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.git
branch = slaprunner
branch = kvm
git-executable = ${git:location}/bin/git
[slapos.toolbox-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.toolbox.git
branch = master
git-executable = ${git:location}/bin/git
[check-recipe]
...
...
@@ -24,3 +30,4 @@ stop-on-error = true
update-command = ${:command}
command =
grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link &&
grep parts ${buildout:develop-eggs-directory}/slapos.toolbox.egg-link
software/kvm/instance-frontend.cfg.in
View file @
5067f9af
...
...
@@ -11,7 +11,8 @@ parts =
cron-entry-logrotate
ca-frontend
certificate-authority
frontend-promise
frontend-promise-ipv6
frontend-promise-ipv4
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
...
...
@@ -47,7 +48,8 @@ logrotate-entries = $${rootdirectory:etc}/logrotate.d
recipe = slapos.cookbook:kvm.frontend
domain = $${ca-frontend:name}
# port = $${slap-parameter:port}
ip = $${slap-network-information:local-ipv4}
ipv6 = $${slap-network-information:global-ipv6}
ipv4 = $${slap-network-information:local-ipv4}
port = $${slap-parameter:port}
http-redirection = $${slap-parameter:http-redirection}
ssl-key-path = $${ca-frontend:key-file}
...
...
@@ -60,10 +62,16 @@ node-binary = ${nodejs:location}/bin/node
node-env = ${buildout:parts-directory}:${npm-modules:location}/node_modules
shell-path = ${dash:location}/bin/dash
[frontend-promise]
[frontend-promise
-ipv6
]
recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/frontend_promise
hostname = $${frontend-instance:ip}
hostname = $${frontend-instance:ipv6}
port = $${frontend-instance:port}
[frontend-promise-ipv4]
recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/frontend_promise
hostname = $${frontend-instance:ipv4}
port = $${frontend-instance:port}
[certificate-authority]
...
...
@@ -133,6 +141,7 @@ state-file = $${rootdirectory:srv}/logrotate.status
# Default value if no port is specified
port = 4443
http-redirection = 0
slave_instance_list =
# [logrotate-entry-frontend]
# <= logrotate
...
...
software/kvm/instance-kvm.cfg.in
View file @
5067f9af
...
...
@@ -36,7 +36,7 @@ storage-path = $${directory:srv}/mac
[gen-passwd]
recipe = slapos.cookbook:generate.password
storage-path = $${directory:srv}/passwd
bytes =
4
bytes =
8
[kvm-instance]
# XXX-Cedric: change "KVM" recipe to simple "create wrappers". No need for this
...
...
@@ -135,7 +135,7 @@ 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 =
Slave
Frontend
name =
VNC
Frontend
software-type = $${slap-parameter:frontend-software-type}
slave = true
config = host port
...
...
@@ -162,7 +162,6 @@ curl_path = ${curl:location}/bin/curl
[slap-parameter]
# Default values if not specified
frontend-instance-guid = SOFTINST-11031
frontend-software-type = frontend
frontend-software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.92:/software/kvm/software.cfg
...
...
software/kvm/instance-kvmplus.cfg.in
deleted
100644 → 0
View file @
9411bfb0
#############################
#
# Instanciate kvm+
#
#############################
# Deprecated. Just specify amount of RAM / disk you want in instance parameter.
[buildout]
extends = ${template-kvm:output}
[slap-parameter]
ram-size = 2048
disk-size = 20
\ No newline at end of file
software/kvm/instance.cfg.in
View file @
5067f9af
...
...
@@ -10,7 +10,6 @@ offline = true
recipe = slapos.cookbook:softwaretype
default = ${template-kvm:output}
kvm = ${template-kvm:output}
kvm+ = ${template-kvmplus:output}
nbd = ${template-nbd:output}
frontend = ${template-frontend:output}
...
...
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