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
Valentin Benozillo
slapos
Commits
31615b44
Commit
31615b44
authored
Mar 21, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'kvm'
parents
cbba3f8c
67149ea6
Changes
37
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
1332 additions
and
1043 deletions
+1332
-1043
component/cloud9/buildout.cfg
component/cloud9/buildout.cfg
+45
-0
component/gettext/buildout.cfg
component/gettext/buildout.cfg
+1
-0
component/noVNC/buildout.cfg
component/noVNC/buildout.cfg
+2
-2
component/nodejs/buildout.cfg
component/nodejs/buildout.cfg
+51
-0
setup.py
setup.py
+7
-2
slapos/recipe/README.kvm_frontend.txt
slapos/recipe/README.kvm_frontend.txt
+56
-0
slapos/recipe/check_port_listening/__init__.py
slapos/recipe/check_port_listening/__init__.py
+48
-0
slapos/recipe/check_port_listening/template/socket_connection_attempt.py.in
...k_port_listening/template/socket_connection_attempt.py.in
+21
-0
slapos/recipe/generatemac.py
slapos/recipe/generatemac.py
+40
-0
slapos/recipe/generic_onetimeupload/__init__.py
slapos/recipe/generic_onetimeupload/__init__.py
+59
-0
slapos/recipe/generic_onetimeupload/template/onetimeupload_run.in
...ecipe/generic_onetimeupload/template/onetimeupload_run.in
+1
-1
slapos/recipe/kvm/__init__.py
slapos/recipe/kvm/__init__.py
+42
-322
slapos/recipe/kvm/certificate_authority.py
slapos/recipe/kvm/certificate_authority.py
+0
-114
slapos/recipe/kvm/socket_connection_attempt.py
slapos/recipe/kvm/socket_connection_attempt.py
+0
-26
slapos/recipe/kvm/template/kvm_run.in
slapos/recipe/kvm/template/kvm_run.in
+52
-14
slapos/recipe/kvm/template/openssl.cnf.ca.in
slapos/recipe/kvm/template/openssl.cnf.ca.in
+0
-350
slapos/recipe/kvm/template/port_listening_promise.in
slapos/recipe/kvm/template/port_listening_promise.in
+0
-4
slapos/recipe/kvm/template/slapreport_run.in
slapos/recipe/kvm/template/slapreport_run.in
+0
-4
slapos/recipe/kvm_frontend/__init__.py
slapos/recipe/kvm_frontend/__init__.py
+137
-0
slapos/recipe/kvm_frontend/template/kvm-proxy.js
slapos/recipe/kvm_frontend/template/kvm-proxy.js
+128
-0
slapos/recipe/kvm_frontend/template/nodejs_run.in
slapos/recipe/kvm_frontend/template/nodejs_run.in
+5
-0
slapos/recipe/librecipe/generic.py
slapos/recipe/librecipe/generic.py
+1
-0
slapos/recipe/nbdserver/__init__.py
slapos/recipe/nbdserver/__init__.py
+26
-56
slapos/recipe/nbdserver/template/nbdserver_run.in
slapos/recipe/nbdserver/template/nbdserver_run.in
+2
-2
slapos/recipe/novnc/__init__.py
slapos/recipe/novnc/__init__.py
+54
-0
slapos/recipe/request.py
slapos/recipe/request.py
+13
-3
slapos/recipe/softwaretype.py
slapos/recipe/softwaretype.py
+11
-0
software/kvm/instance-frontend.cfg
software/kvm/instance-frontend.cfg
+148
-0
software/kvm/instance-kvm.cfg
software/kvm/instance-kvm.cfg
+136
-0
software/kvm/instance-kvmplus.cfg
software/kvm/instance-kvmplus.cfg
+27
-0
software/kvm/instance-nbd.cfg
software/kvm/instance-nbd.cfg
+63
-0
software/kvm/instance.cfg
software/kvm/instance.cfg
+18
-16
software/kvm/software.cfg
software/kvm/software.cfg
+110
-96
software/nbd/instance.cfg
software/nbd/instance.cfg
+0
-11
software/nbd/software.cfg
software/nbd/software.cfg
+0
-20
stack/nodejs.cfg
stack/nodejs.cfg
+18
-0
stack/slapos.cfg
stack/slapos.cfg
+10
-0
No files found.
component/cloud9/buildout.cfg
0 → 100644
View file @
31615b44
[buildout]
extends =
../dcron/buildout.cfg
../libxml2/buildout.cfg
../logrotate/buildout.cfg
../rdiff-backup/buildout.cfg
../nodejs/buildout.cfg
parts =
nodejs
npm
cloud9
[cloud9]
<= cloud9-git
[cloud9-git]
# Online IDE written in javascript/node.js
# URL : c9.io
# You can use it using the following command :
# NODE_PATH=${:destination}/node_modules ${nodejs:node_location} ${:cloud9_js_location}
recipe = plone.recipe.command
stop-on-error = true
commit = 97db1467c517d265438684bd2a70b0b76ee282f6
repository = https://github.com/ajaxorg/cloud9.git
location = ${buildout:parts-directory}/${:_buildout_section_name_}
git-binary = ${git:location}/bin/git
npm-binary = ${nodejs-0.4:location}/bin/node ${npm:location}/bin/npm
command = export GIT_SSL_NO_VERIFY=true; (${:git-binary} clone --quiet ${:repository} ${:location} && cd ${:location} && ${:git-binary} reset --hard ${:commit} && ${:git-binary} submodule update --init && cd support/jsdav && PATH=/opt/slapgrid/c86b6d036d0004572b96e10de1a1b5e8/parts/nodejs-0.4/bin:$PATH LDFLAGS=-L${libxml2:location}/lib ${:npm-binary} install) || (rm -fr ${:location}; exit 1)
update-command =
[cloud9-npm]
# Online IDE written in javascript/node.js
# URL : c9.io
# You can use it using the following command :
# NODE_PATH=${:destination}/node_modules ${nodejs:node_location} ${:cloud9_js_location}
recipe = slapos.recipe.npm
# Node part has to be specified, otherwise system node is used.
node = nodejs-0.6
# List of packages to install
packages =
cloud9
# Specify environment jsDAV (dependency of cloud9) needs libxml2
environment =
LDFLAGS=-L${libxml2:location}/lib -Wl,-rpath=${libxml2:location}/lib
component/gettext/buildout.cfg
View file @
31615b44
...
@@ -20,6 +20,7 @@ configure-options =
...
@@ -20,6 +20,7 @@ configure-options =
--without-emacs
--without-emacs
--disable-acl
--disable-acl
--disable-openmp
--disable-openmp
--without-git
environment =
environment =
CPPFLAGS=-I${libxml2:location}/include -I${zlib:location}/include -I${ncurses:location}/include
CPPFLAGS=-I${libxml2:location}/include -I${zlib:location}/include -I${ncurses:location}/include
...
...
component/noVNC/buildout.cfg
View file @
31615b44
...
@@ -3,6 +3,6 @@ parts =
...
@@ -3,6 +3,6 @@ parts =
noVNC
noVNC
[noVNC]
[noVNC]
recipe =
hexagonit.recipe.downloa
d
recipe =
slapos.recipe.build:download-unpacke
d
url = https://github.com/kanaka/noVNC/tarball/
master
url = https://github.com/kanaka/noVNC/tarball/
v0.2
strip-top-level-dir = true
strip-top-level-dir = true
component/nodejs/buildout.cfg
0 → 100644
View file @
31615b44
[buildout]
extends =
../git/buildout.cfg
../pkgconfig/buildout.cfg
../openssl/buildout.cfg
../python-2.7/buildout.cfg
../zlib/buildout.cfg
parts =
nodejs
[nodejs]
# Server-side Javascript.
recipe = hexagonit.recipe.cmmi
url = http://nodejs.org/dist/v0.6.12/node-v0.6.12.tar.gz
md5sum = a12766ae4003c9712927d1fa134ed9f6
configure-options =
--openssl-includes=${openssl:location}/include
--openssl-libpath=${openssl:location}/lib
environment =
PATH=${pkgconfig:location}/bin:${python2.7:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${openssl:location}/lib/pkgconfig/
CPPFLAGS=-I${zlib:location}/include
LDFLAGS=-Wl,-rpath=${openssl:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib
[nodejs-0.4]
recipe = hexagonit.recipe.cmmi
url = http://nodejs.org/dist/node-v0.4.12.tar.gz
md5sum = a6375eaa43db5356bf443e25b828ae16
configure-options =
--openssl-includes=${openssl:location}/include
--openssl-libpath=${openssl:location}/lib
environment =
PATH=${pkgconfig:location}/bin:${python2.7:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${openssl:location}/lib/pkgconfig/
CPPFLAGS=-I${zlib:location}/include
LDFLAGS=-Wl,-rpath=${openssl:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib
[npm]
# Node.js Package Manager
# Deprecated. Included in node >= 0.6.3.
recipe = plone.recipe.command
location = ${buildout:parts-directory}/${:_buildout_section_name_}
stop-on-error = true
commit = 3136abc5c6b3ed332c4700ece24450fada63639b
origin = https://github.com/isaacs/npm.git
git-bin = ${git:location}/bin/git
node-bin = ${nodejs-0.4:location}/bin/node
command = (GIT_SSL_NO_VERIFY=true ${:git-bin} clone --quiet ${:origin} ${:location} && cd ${:location} && ${:git-bin} reset --hard ${:commit} && ${:location}/configure --prefix=${:location} && GIT_SSL_NO_VERIFY=true ${:git-bin} submodule update --init --recursive && ${:node_bin} cli.js install npm@1.0.106 -g -f) || (rm -fr ${:location}; exit 1)
update-command =
setup.py
View file @
31615b44
...
@@ -46,6 +46,7 @@ setup(name=name,
...
@@ -46,6 +46,7 @@ setup(name=name,
'apache.zope.backend = slapos.recipe.apache_zope_backend:Recipe'
,
'apache.zope.backend = slapos.recipe.apache_zope_backend:Recipe'
,
'certificate_authority = slapos.recipe.certificate_authority:Recipe'
,
'certificate_authority = slapos.recipe.certificate_authority:Recipe'
,
'certificate_authority.request = slapos.recipe.certificate_authority:Request'
,
'certificate_authority.request = slapos.recipe.certificate_authority:Request'
,
'check_port_listening = slapos.recipe.check_port_listening:Recipe'
,
'cron = slapos.recipe.dcron:Recipe'
,
'cron = slapos.recipe.dcron:Recipe'
,
'cron.d = slapos.recipe.dcron:Part'
,
'cron.d = slapos.recipe.dcron:Part'
,
'davstorage = slapos.recipe.davstorage:Recipe'
,
'davstorage = slapos.recipe.davstorage:Recipe'
,
...
@@ -56,14 +57,18 @@ setup(name=name,
...
@@ -56,14 +57,18 @@ setup(name=name,
'erp5scalabilitytestbed = slapos.recipe.erp5scalabilitytestbed:Recipe'
,
'erp5scalabilitytestbed = slapos.recipe.erp5scalabilitytestbed:Recipe'
,
'equeue = slapos.recipe.equeue:Recipe'
,
'equeue = slapos.recipe.equeue:Recipe'
,
'erp5testnode = slapos.recipe.erp5testnode:Recipe'
,
'erp5testnode = slapos.recipe.erp5testnode:Recipe'
,
'generate.mac = slapos.recipe.generatemac:Recipe'
,
'nbdserver = slapos.recipe.nbdserver:Recipe'
,
'generic.onetimeupload = slapos.recipe.generic_onetimeupload:Recipe'
,
'helloworld = slapos.recipe.helloworld:Recipe'
,
'helloworld = slapos.recipe.helloworld:Recipe'
,
'generic.cloudooo = slapos.recipe.generic_cloudooo:Recipe'
,
'generic.cloudooo = slapos.recipe.generic_cloudooo:Recipe'
,
'fontconfig = slapos.recipe.fontconfig:Recipe'
,
'fontconfig = slapos.recipe.fontconfig:Recipe'
,
'java = slapos.recipe.java:Recipe'
,
'java = slapos.recipe.java:Recipe'
,
'kumofs = slapos.recipe.kumofs:Recipe'
,
'kumofs = slapos.recipe.kumofs:Recipe'
,
'kvm = slapos.recipe.kvm:Recipe'
,
'kvm.frontend = slapos.recipe.kvm_frontend:Recipe'
,
'generic.kumofs = slapos.recipe.generic_kumofs:Recipe'
,
'generic.kumofs = slapos.recipe.generic_kumofs:Recipe'
,
'haproxy = slapos.recipe.haproxy:Recipe'
,
'haproxy = slapos.recipe.haproxy:Recipe'
,
'kvm = slapos.recipe.kvm:Recipe'
,
'libcloud = slapos.recipe.libcloud:Recipe'
,
'libcloud = slapos.recipe.libcloud:Recipe'
,
'libcloudrequest = slapos.recipe.libcloudrequest:Recipe'
,
'libcloudrequest = slapos.recipe.libcloudrequest:Recipe'
,
'lockfile = slapos.recipe.lockfile:Recipe'
,
'lockfile = slapos.recipe.lockfile:Recipe'
,
...
@@ -73,11 +78,11 @@ setup(name=name,
...
@@ -73,11 +78,11 @@ setup(name=name,
'mydumper = slapos.recipe.mydumper:Recipe'
,
'mydumper = slapos.recipe.mydumper:Recipe'
,
'generic.mysql = slapos.recipe.generic_mysql:Recipe'
,
'generic.mysql = slapos.recipe.generic_mysql:Recipe'
,
'mkdirectory = slapos.recipe.mkdirectory:Recipe'
,
'mkdirectory = slapos.recipe.mkdirectory:Recipe'
,
'nbdserver = slapos.recipe.nbdserver:Recipe'
,
'nosqltestbed = slapos.recipe.nosqltestbed:NoSQLTestBed'
,
'nosqltestbed = slapos.recipe.nosqltestbed:NoSQLTestBed'
,
'notifier = slapos.recipe.notifier:Recipe'
,
'notifier = slapos.recipe.notifier:Recipe'
,
'notifier.callback = slapos.recipe.notifier:Callback'
,
'notifier.callback = slapos.recipe.notifier:Callback'
,
'notifier.notify = slapos.recipe.notifier:Notify'
,
'notifier.notify = slapos.recipe.notifier:Notify'
,
'novnc = slapos.recipe.novnc:Recipe'
,
'lamp = slapos.recipe.lamp:Request'
,
'lamp = slapos.recipe.lamp:Request'
,
'lamp.request = slapos.recipe.lamp:Request'
,
'lamp.request = slapos.recipe.lamp:Request'
,
'lamp.static = slapos.recipe.lamp:Static'
,
'lamp.static = slapos.recipe.lamp:Static'
,
...
...
slapos/recipe/README.kvm_frontend.txt
0 → 100644
View file @
31615b44
kvm_frontend
===
Introduction
------------
The ``slapos.recipe.kvm_frontend`` aims to provide proxy server to KVM instances.
It allows HTTPS IPv4/IPv6 proxying (with or without domain name), and supports
the WebSocket technology needed for VNC-in-webapplication noVNC.
It works following the master/slave instances system. A master instance is
created, containing all what is needed to run the proxy. Slave instances
are later created, adding one line in the master instance's proxy configuration
that specify the IP/port to proxy to the KVM.
The slave instance (kvm) is then accessible from
http://[masterinstanceIPorhostname]/[randomgeneratednumber]
Instance parameters
------------
Incoming master instance parameters
+++++++
``port`` - Port of server, optional, defaults to 4443.
``domain`` - domain name to use, optional, default to
"host.vifib.net".
``redirect_plain_http`` - if value is one of ['y', 'yes', '1', 'true'], instance
will try to create a simple http server on port 80
redirecting to the proxy. Optional.
Incoming slave instance parameters
+++++++
``host`` - KVM instance IP or hostname. Mandatory.
``port`` - KVM instance port, Mandatory.
``https`` - if value is one of ['n', 'no', '0', 'false'], will try to connect
to target in plain http. Optional.
Connection parameters
-------------
Outgoing master connection parameters
+++++++
``domain_ipv6_address`` - Proxy IP
``site_url`` - Proxy URL
Outgoing slave connection parameters are :
+++++++
``site_url`` - URL of instance
``domain_name`` - Domain name of proxy
``port`` - Port of proxy
slapos/recipe/check_port_listening/__init__.py
0 → 100644
View file @
31615b44
##############################################################################
#
# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
slapos.recipe.librecipe
import
GenericBaseRecipe
import
sys
class
Recipe
(
GenericBaseRecipe
):
"""
Check listening port promise
"""
def
install
(
self
):
config
=
dict
(
hostname
=
self
.
options
[
'hostname'
],
port
=
self
.
options
[
'port'
],
python_path
=
sys
.
executable
,
)
vnc_promise
=
self
.
createExecutable
(
self
.
options
[
'path'
],
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'socket_connection_attempt.py.in'
),
config
))
return
[
vnc_promise
]
slapos/recipe/check_port_listening/template/socket_connection_attempt.py.in
0 → 100644
View file @
31615b44
#!%(python_path)s
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
import socket
import sys
hostname = "%(hostname)s"
port = %(port)s
connection_okay = False
try:
s = socket.create_connection((hostname, port))
connection_okay = True
s.close()
except (socket.error, socket.timeout):
connection_okay = False
if not connection_okay:
print >> sys.stderr, "%(port)s on %(hostname)s isn't listening"
sys.exit(127)
slapos/recipe/generatemac.py
0 → 100644
View file @
31615b44
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import
random
from
slapos.recipe.librecipe
import
GenericBaseRecipe
class
Recipe
(
GenericBaseRecipe
):
def
__init__
(
self
,
buildout
,
name
,
options
):
# First octet has to represent a locally administered address
octet_list
=
[
254
]
+
[
random
.
randint
(
0x00
,
0xff
)
for
x
in
range
(
5
)]
options
[
'mac-address'
]
=
':'
.
join
([
'%02x'
%
x
for
x
in
octet_list
])
def
install
(
self
):
return
[]
slapos/recipe/generic_onetimeupload/__init__.py
0 → 100644
View file @
31615b44
##############################################################################
#
# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
slapos.recipe.librecipe
import
GenericBaseRecipe
import
binascii
import
os
import
sys
class
Recipe
(
GenericBaseRecipe
):
"""
kvm instance configuration.
"""
def
__init__
(
self
,
buildout
,
name
,
options
):
options
[
'key'
]
=
binascii
.
hexlify
(
os
.
urandom
(
24
))
return
GenericBaseRecipe
.
__init__
(
self
,
buildout
,
name
,
options
)
def
install
(
self
):
config
=
dict
(
ip
=
self
.
options
[
'ip'
],
port
=
self
.
options
[
'port'
],
onetimeupload_path
=
self
.
options
[
'onetimeupload-path'
],
shell_path
=
self
.
options
[
'shell-path'
],
log_path
=
self
.
options
[
'log-path'
],
image
=
self
.
options
[
'image-path'
],
key
=
self
.
options
[
'key'
],
)
# Runners
runner_path
=
self
.
createExecutable
(
self
.
options
[
'path'
],
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'onetimeupload_run.in'
),
config
))
return
[
runner_path
]
slapos/recipe/
nbdserver
/template/onetimeupload_run.in
→
slapos/recipe/
generic_onetimeupload
/template/onetimeupload_run.in
View file @
31615b44
#!
/bin/sh
#!
%(shell_path)s
# BEWARE: This file is operated by slapgrid
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
# BEWARE: It will be overwritten automatically
exec %(onetimeupload_path)s -l %(log_path)s %(ip)s %(port)s %(image)s %(key)s
exec %(onetimeupload_path)s -l %(log_path)s %(ip)s %(port)s %(image)s %(key)s
slapos/recipe/kvm/__init__.py
View file @
31615b44
This diff is collapsed.
Click to expand it.
slapos/recipe/kvm/certificate_authority.py
deleted
100755 → 0
View file @
cbba3f8c
import
os
import
subprocess
import
time
import
ConfigParser
import
uuid
def
popenCommunicate
(
command_list
,
input
=
None
):
subprocess_kw
=
dict
(
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
if
input
is
not
None
:
subprocess_kw
.
update
(
stdin
=
subprocess
.
PIPE
)
popen
=
subprocess
.
Popen
(
command_list
,
**
subprocess_kw
)
result
=
popen
.
communicate
(
input
)[
0
]
if
popen
.
returncode
is
None
:
popen
.
kill
()
if
popen
.
returncode
!=
0
:
raise
ValueError
(
'Issue during calling %r, result was:
\
n
%s'
%
(
command_list
,
result
))
return
result
class
CertificateAuthority
:
def
__init__
(
self
,
key
,
certificate
,
openssl_binary
,
openssl_configuration
,
request_dir
):
self
.
key
=
key
self
.
certificate
=
certificate
self
.
openssl_binary
=
openssl_binary
self
.
openssl_configuration
=
openssl_configuration
self
.
request_dir
=
request_dir
def
checkAuthority
(
self
):
file_list
=
[
self
.
key
,
self
.
certificate
]
ca_ready
=
True
for
f
in
file_list
:
if
not
os
.
path
.
exists
(
f
):
ca_ready
=
False
break
if
ca_ready
:
return
for
f
in
file_list
:
if
os
.
path
.
exists
(
f
):
os
.
unlink
(
f
)
try
:
# no CA, let us create new one
popenCommunicate
([
self
.
openssl_binary
,
'req'
,
'-nodes'
,
'-config'
,
self
.
openssl_configuration
,
'-new'
,
'-x509'
,
'-extensions'
,
'v3_ca'
,
'-keyout'
,
self
.
key
,
'-out'
,
self
.
certificate
,
'-days'
,
'10950'
],
# Authority name will be random, so no instance has the same issuer
'Certificate Authority %s
\
n
'
%
uuid
.
uuid1
())
except
:
try
:
for
f
in
file_list
:
if
os
.
path
.
exists
(
f
):
os
.
unlink
(
f
)
except
:
# do not raise during cleanup
pass
raise
def
_checkCertificate
(
self
,
common_name
,
key
,
certificate
):
file_list
=
[
key
,
certificate
]
ready
=
True
for
f
in
file_list
:
if
not
os
.
path
.
exists
(
f
):
ready
=
False
break
if
ready
:
return
False
for
f
in
file_list
:
if
os
.
path
.
exists
(
f
):
os
.
unlink
(
f
)
csr
=
certificate
+
'.csr'
try
:
popenCommunicate
([
self
.
openssl_binary
,
'req'
,
'-config'
,
self
.
openssl_configuration
,
'-nodes'
,
'-new'
,
'-keyout'
,
key
,
'-out'
,
csr
,
'-days'
,
'3650'
],
common_name
+
'
\
n
'
)
try
:
popenCommunicate
([
self
.
openssl_binary
,
'ca'
,
'-batch'
,
'-config'
,
self
.
openssl_configuration
,
'-out'
,
certificate
,
'-infiles'
,
csr
])
finally
:
if
os
.
path
.
exists
(
csr
):
os
.
unlink
(
csr
)
except
:
try
:
for
f
in
file_list
:
if
os
.
path
.
exists
(
f
):
os
.
unlink
(
f
)
except
:
# do not raise during cleanup
pass
raise
else
:
return
True
def
checkRequestDir
(
self
):
for
request_file
in
os
.
listdir
(
self
.
request_dir
):
parser
=
ConfigParser
.
RawConfigParser
()
parser
.
readfp
(
open
(
os
.
path
.
join
(
self
.
request_dir
,
request_file
),
'r'
))
if
self
.
_checkCertificate
(
parser
.
get
(
'certificate'
,
'name'
),
parser
.
get
(
'certificate'
,
'key_file'
),
parser
.
get
(
'certificate'
,
'certificate_file'
)):
print
'Created certificate %r'
%
parser
.
get
(
'certificate'
,
'name'
)
def
runCertificateAuthority
(
args
):
ca_conf
=
args
[
0
]
ca
=
CertificateAuthority
(
ca_conf
[
'key'
],
ca_conf
[
'certificate'
],
ca_conf
[
'openssl_binary'
],
ca_conf
[
'openssl_configuration'
],
ca_conf
[
'request_dir'
])
while
True
:
ca
.
checkAuthority
()
ca
.
checkRequestDir
()
time
.
sleep
(
60
)
slapos/recipe/kvm/socket_connection_attempt.py
deleted
100644 → 0
View file @
cbba3f8c
import
socket
import
sys
def
connection_attempt
():
try
:
hostname
,
port
=
sys
.
argv
[
1
:
3
]
except
ValueError
:
print
>>
sys
.
stderr
,
"""Bad command line.
Usage: %s hostname|ip port"""
%
sys
.
argv
[
0
]
sys
.
exit
(
1
)
connection_okay
=
False
try
:
s
=
socket
.
create_connection
((
hostname
,
port
))
connection_okay
=
True
s
.
close
()
except
(
socket
.
error
,
socket
.
timeout
):
connection_okay
=
False
if
not
connection_okay
:
print
>>
sys
.
stderr
,
"%(port)s on %(ip)s isn't listening"
%
{
'port'
:
port
,
'ip'
:
hostname
}
sys
.
exit
(
127
)
slapos/recipe/kvm/template/kvm_run.in
View file @
31615b44
#!
/bin/sh
#!
%(python_path)s
# BEWARE: This file is operated by slapgrid
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
# BEWARE: It will be overwritten automatically
# TODO: -net nic,model=virtio, but OS installer has to provide the virtio_net
# Echo client program
# module
import os
exec
%
(
qemu_path
)
s
\
import socket
-net
nic,macaddr
=
%
(
mac_address
)
s
\
import subprocess
-net
tap,ifname
=
%
(
tap_interface
)
s,script
=
no,downscript
=
no
\
-smp
%
(
smp_count
)
s
\
def getSocketStatus(host, port):
-m
%
(
ram_size
)
s
\
s = None
-cdrom
nbd:[%
(
nbd_ip
)
s]:%
(
nbd_port
)
s
\
for res in socket.getaddrinfo(host, port,
-drive
file
=
%
(
disk_path
)
s,if
=
virtio,boot
=
on
\
socket.AF_UNSPEC, socket.SOCK_STREAM):
-vnc
%
(
vnc_ip
)
s:1,ipv4,password
\
af, socktype, proto, canonname, sa = res
-boot
menu
=
on
\
try:
-qmp
unix:%
(
socket_path
)
s,server
\
s = socket.socket(af, socktype, proto)
-pidfile
%
(
pid_file_path
)
s
except socket.error, msg:
s = None
continue
try:
s.connect(sa)
except socket.error, msg:
s.close()
s = None
continue
break
return s
# create disk if doesn't exist
disk_path = '%(disk_path)s'
if not os.path.exists(disk_path):
subprocess.Popen(['%(qemu_img_path)s', 'create' ,'-f', 'qcow2',
'%(disk_path)s', '%(disk_size)sG'])
kvm_argument_list = ['kvm', '-net', 'nic,macaddr=%(mac_address)s',
'-net', 'tap,ifname=%(tap_interface)s,script=no,downscript=no',
'-smp', '%(smp_count)s',
'-m', '%(ram_size)s',
'-drive', 'file=%(disk_path)s,if=virtio,boot=on',
'-vnc', '%(vnc_ip)s:1,ipv4,password',
'-boot', 'menu=on',
'-qmp', 'unix:%(socket_path)s,server',
'-pidfile', '%(pid_file_path)s',
]
# Try to connect to NBD server
s = getSocketStatus('%(nbd_ip)s', %(nbd_port)s)
if s is None:
# NBD is not available : launch kvm without it
print 'Warning : Nbd is not available.'
os.execv('%(qemu_path)s', kvm_argument_list)
else:
# NBD is available
kvm_argument_list.extend(['-cdrom', 'nbd:[%(nbd_ip)s]:%(nbd_port)s'])
os.execv('%(qemu_path)s', kvm_argument_list)
slapos/recipe/kvm/template/openssl.cnf.ca.in
deleted
100644 → 0
View file @
cbba3f8c
This diff is collapsed.
Click to expand it.
slapos/recipe/kvm/template/port_listening_promise.in
deleted
100644 → 0
View file @
cbba3f8c
#!/usr/bin/env sh
"%(check_port_listening_script)s"
"%(hostname)s"
"%(port)s"
exit
$?
slapos/recipe/kvm/template/slapreport_run.in
deleted
100644 → 0
View file @
cbba3f8c
#!/bin/sh
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
exec
%
(
python_path
)
s %
(
slapreport_path
)
s
$1
%
(
database_path
)
s
slapos/recipe/kvm_frontend/__init__.py
0 → 100644
View file @
31615b44
##############################################################################
#
# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
slapos.recipe.librecipe
import
GenericBaseRecipe
,
GenericSlapRecipe
import
json
import
zc.buildout
class
Recipe
(
GenericSlapRecipe
):
"""
kvm frontend instance configuration.
"""
def
_getRewriteRuleContent
(
self
,
slave_instance_list
):
"""Generate rewrite rules list from slaves list"""
rewrite_rule_list
=
[]
for
slave_instance
in
slave_instance_list
:
self
.
logger
.
info
(
"Processing slave instance %s..."
%
slave_instance
[
'slave_reference'
])
# Check for mandatory fields
if
slave_instance
.
get
(
'host'
,
None
)
is
None
:
self
.
logger
.
warn
(
'No "host" parameter is defined for %s slave'
\
'instance. Ignoring it.'
%
slave_instance
[
'slave_reference'
])
continue
if
slave_instance
.
get
(
'port'
,
None
)
is
None
:
self
.
logger
.
warn
(
'No "host" parameter is defined for %s slave'
\
'instance. Ignoring it.'
%
slave_instance
[
'slave_reference'
])
continue
current_slave_dict
=
dict
()
# Get host, and if IPv6 address, remove "[" and "]"
current_slave_dict
[
'host'
]
=
slave_instance
[
'host'
].
\
replace
(
'['
,
''
).
replace
(
']'
,
''
)
current_slave_dict
[
'port'
]
=
slave_instance
[
'port'
]
# Check if target is https or http
current_slave_dict
[
'https'
]
=
slave_instance
.
get
(
'https'
,
'true'
)
if
current_slave_dict
[
'https'
]
in
GenericBaseRecipe
.
FALSE_VALUES
:
current_slave_dict
[
'https'
]
=
'false'
# Set reference and resource url
# Reference is raw reference from SlapOS Master, resource is
# URL-compatible name
reference
=
slave_instance
.
get
(
'slave_reference'
)
current_slave_dict
[
'reference'
]
=
reference
current_slave_dict
[
'resource'
]
=
reference
.
replace
(
'-'
,
''
)
rewrite_rule_list
.
append
(
current_slave_dict
)
return
rewrite_rule_list
def
_getProxyTableContent
(
self
,
rewrite_rule_list
):
"""Generate proxy table file content from rewrite rules list"""
proxy_table
=
dict
()
for
rewrite_rule
in
rewrite_rule_list
:
proxy_table
[
rewrite_rule
[
'resource'
]]
=
{
'port'
:
rewrite_rule
[
'port'
],
'host'
:
rewrite_rule
[
'host'
],
'https'
:
rewrite_rule
[
'https'
],
}
proxy_table_content
=
json
.
dumps
(
proxy_table
)
return
proxy_table_content
def
_install
(
self
):
# Check for mandatory field
if
self
.
options
.
get
(
'domain'
,
None
)
is
None
:
raise
zc
.
buildout
.
UserError
(
'No domain name specified. Please define '
'the "domain" instance parameter.'
)
# Generate rewrite rules
rewrite_rule_list
=
self
.
_getRewriteRuleContent
(
json
.
loads
(
self
.
options
[
'slave-instance-list'
]))
# Create Map
map_content
=
self
.
_getProxyTableContent
(
rewrite_rule_list
)
map_file
=
self
.
createFile
(
self
.
options
[
'map-path'
],
map_content
)
# Create configuration
conf
=
open
(
self
.
getTemplateFilename
(
'kvm-proxy.js'
),
'r'
)
conf_file
=
self
.
createFile
(
self
.
options
[
'conf-path'
],
conf
.
read
())
conf
.
close
()
# Do we create http dummy server used to redirect to https?
if
self
.
options
[
'http-redirection'
]
in
GenericBaseRecipe
.
TRUE_VALUES
:
http_redirect_server
=
'1'
else
:
http_redirect_server
=
''
config
=
dict
(
ip
=
self
.
options
[
'ip'
],
port
=
self
.
options
[
'port'
],
key
=
self
.
options
[
'ssl-key-path'
],
certificate
=
self
.
options
[
'ssl-cert-path'
],
name
=
self
.
options
[
'domain'
],
shell_path
=
self
.
options
[
'shell-path'
],
node_path
=
self
.
options
[
'node-binary'
],
node_env
=
self
.
options
[
'node-env'
],
conf_path
=
conf_file
,
map_path
=
map_file
,
plain_http
=
http_redirect_server
,
)
runner_path
=
self
.
createExecutable
(
self
.
options
[
'wrapper-path'
],
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'nodejs_run.in'
),
config
))
# Send connection parameters of slave instances
site_url
=
"https://%s:%s/"
%
(
self
.
options
[
'domain'
],
self
.
options
[
'port'
])
for
slave
in
rewrite_rule_list
:
self
.
setConnectionDict
(
dict
(
url
=
"%s%s"
%
(
site_url
,
slave
[
'resource'
]),
domainname
=
self
.
options
[
'domain'
],
port
=
self
.
options
[
'port'
],
resource
=
slave
[
'resource'
]),
slave
[
'reference'
])
return
[
map_file
,
conf_file
,
runner_path
]
slapos/recipe/kvm_frontend/template/kvm-proxy.js
0 → 100644
View file @
31615b44
/*****************************************************************************
*
* Copyright (c) 2012 Vifib SARL and Contributors. All Rights Reserved.
*
* WARNING: This program as such is intended to be used by professional
* programmers who take the whole responsibility of assessing all potential
* consequences resulting from its eventual inadequacies and bugs
* End users who are looking for a ready-to-use solution with commercial
* guarantees and support are strongly adviced to contract a Free Software
* Service Company
*
* This program is Free Software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*****************************************************************************/
/* Wrapper used to configure the httpproxy node package to proxy
http://myhost/myinstance
to real IP/URL of myinstance
*/
var
fs
=
require
(
'
fs
'
),
util
=
require
(
'
util
'
),
colors
=
require
(
'
colors
'
),
http
=
require
(
'
http
'
),
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
,
isRawIPv6
;
if
(
process
.
argv
.
length
<
7
)
{
console
.
error
(
"
Too few arguments. Exiting.
"
);
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}(
:
[
0-9A-Fa-f
]{1,4}
|
((
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})
|:
))
|
(([
0-9A-Fa-f
]{1,4}
:
){5}(((
:
[
0-9A-Fa-f
]{1,4}){1,2})
|:
((
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})
|:
))
|
(([
0-9A-Fa-f
]{1,4}
:
){4}(((
:
[
0-9A-Fa-f
]{1,4}){1,3})
|
((
:
[
0-9A-Fa-f
]{1,4})?
:
((
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}))
|:
))
|
(([
0-9A-Fa-f
]{1,4}
:
){3}(((
:
[
0-9A-Fa-f
]{1,4}){1,4})
|
((
:
[
0-9A-Fa-f
]{1,4}){0,2}
:
((
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}))
|:
))
|
(([
0-9A-Fa-f
]{1,4}
:
){2}(((
:
[
0-9A-Fa-f
]{1,4}){1,5})
|
((
:
[
0-9A-Fa-f
]{1,4}){0,3}
:
((
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}))
|:
))
|
(([
0-9A-Fa-f
]{1,4}
:
){1}(((
:
[
0-9A-Fa-f
]{1,4}){1,6})
|
((
:
[
0-9A-Fa-f
]{1,4}){0,4}
:
((
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}))
|:
))
|
(
:
(((
:
[
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.
*/
var
middlewareNotFound
=
function
(
req
,
res
,
proxy
)
{
res
.
statusCode
=
404
;
res
.
setHeader
(
'
Content-Type
'
,
'
text/plain
'
);
res
.
end
(
'
This URL is not known. Please check your URL or contact your
'
+
'
SlapOS administrator.
'
);
};
/**
* Create server
*/
var
proxyServer
=
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
:
listenInterface
,
port
:
port
}}
);
console
.
log
(
'
HTTPS server starting and trying to listen on
'
+
listenInterface
+
'
:
'
+
port
);
// Release the beast.
proxyServer
.
listen
(
port
,
listenInterface
);
// 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
)
}
}
slapos/recipe/kvm
/template/slapmonitor
_run.in
→
slapos/recipe/kvm
_frontend/template/nodejs
_run.in
View file @
31615b44
#!
/bin/sh
#!
%(shell_path)s
# BEWARE: This file is operated by slapgrid
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
# BEWARE: It will be overwritten automatically
exec
%
(
python_path
)
s %
(
slapmonitor_path
)
s %
(
pid_file_path
)
s %
(
database_path
)
s
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
slapos/recipe/librecipe/generic.py
View file @
31615b44
...
@@ -38,6 +38,7 @@ import zc.buildout
...
@@ -38,6 +38,7 @@ import zc.buildout
class
GenericBaseRecipe
(
object
):
class
GenericBaseRecipe
(
object
):
TRUE_VALUES
=
[
'y'
,
'yes'
,
'1'
,
'true'
]
TRUE_VALUES
=
[
'y'
,
'yes'
,
'1'
,
'true'
]
FALSE_VALUES
=
[
'n'
,
'no'
,
'0'
,
'false'
]
def
__init__
(
self
,
buildout
,
name
,
options
):
def
__init__
(
self
,
buildout
,
name
,
options
):
"""Recipe initialisation"""
"""Recipe initialisation"""
...
...
slapos/recipe/nbdserver/__init__.py
View file @
31615b44
##############################################################################
##############################################################################
#
#
# Copyright (c) 201
0
Vifib SARL and Contributors. All Rights Reserved.
# Copyright (c) 201
1
Vifib SARL and Contributors. All Rights Reserved.
#
#
# WARNING: This program as such is intended to be used by professional
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# programmers who take the whole responsibility of assessing all potential
...
@@ -24,59 +24,29 @@
...
@@ -24,59 +24,29 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
##############################################################################
##############################################################################
import
os
from
slapos.recipe.librecipe
import
GenericBaseRecipe
import
binascii
import
binascii
from
slapos.recipe.librecipe
import
BaseSlapRecipe
import
os
import
sys
import
pkg_resources
class
Recipe
(
GenericBaseRecipe
):
class
Recipe
(
BaseSlapRecipe
):
"""
nbd instance configuration.
def
_install
(
self
):
"""
# Image path
def
install
(
self
):
cdrom_iso
=
os
.
path
.
join
(
self
.
data_root_directory
,
'cdrom.iso'
)
config
=
dict
(
ip
=
self
.
options
[
'ip'
],
#Get the IP list
port
=
self
.
options
[
'port'
],
ip
=
self
.
getGlobalIPv6Address
()
image_path
=
self
.
options
[
'image-path'
],
http_port
=
9999
qemu_path
=
self
.
options
[
'qemu-path'
],
nbd_port
=
1024
shell_path
=
self
.
options
[
'shell-path'
],
)
# Instanciate onetimeupload
onetimeupload_config
=
{}
# Runners
onetimeupload_config
.
update
(
self
.
options
)
runner_path
=
self
.
createExecutable
(
onetimeupload_config
[
'port'
]
=
http_port
self
.
options
[
'path'
],
onetimeupload_config
[
'ip'
]
=
ip
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'nbdserver_run.in'
),
onetimeupload_config
[
'image'
]
=
cdrom_iso
config
))
onetimeupload_config
[
'key'
]
=
binascii
.
hexlify
(
os
.
urandom
(
24
))
onetimeupload_config
[
'log_path'
]
=
os
.
path
.
join
(
self
.
log_directory
,
return
[
runner_path
]
'onetimeupload.log'
)
wrapper_template_location
=
pkg_resources
.
resource_filename
(
__name__
,
os
.
path
.
join
(
'template'
,
'onetimeupload_run.in'
))
onetimeupload_runner_path
=
self
.
createRunningWrapper
(
"onetimeupload"
,
self
.
substituteTemplate
(
wrapper_template_location
,
onetimeupload_config
))
# Instanciate qemu
qemu_config
=
{}
qemu_config
.
update
(
self
.
options
)
qemu_config
[
'ip'
]
=
ip
qemu_config
[
'port'
]
=
nbd_port
qemu_config
[
'image'
]
=
cdrom_iso
wrapper_template_location
=
pkg_resources
.
resource_filename
(
__name__
,
os
.
path
.
join
(
'template'
,
'nbdserver_run.in'
))
nbdserver_runner_path
=
self
.
createRunningWrapper
(
"nbdserver"
,
self
.
substituteTemplate
(
wrapper_template_location
,
qemu_config
))
# Publish connection dict
self
.
computer_partition
.
setConnectionDict
(
dict
(
upload_connection_string
=
"https://[%s]:%s/"
%
(
ip
,
http_port
),
upload_key
=
onetimeupload_config
[
'key'
],
nbd_connection_string
=
"nbd:[%s]:%s"
%
(
ip
,
nbd_port
),
))
return
[
onetimeupload_runner_path
,
nbdserver_runner_path
]
slapos/recipe/nbdserver/template/nbdserver_run.in
View file @
31615b44
#!
/bin/sh
#!
%(shell_path)s
# BEWARE: This file is operated by slapgrid
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
# BEWARE: It will be overwritten automatically
# 32767 is the maximum number of connections allowed by the nbd server
# 32767 is the maximum number of connections allowed by the nbd server
exec
%
(
qemu_path
)
s
-b
%
(
ip
)
s %
(
image
)
s
-r
-t
-p
%
(
port
)
s
-e
32767
exec %(qemu_path)s -b %(ip)s %(image
_path
)s -r -t -p %(port)s -e 32767
slapos/recipe/novnc/__init__.py
0 → 100644
View file @
31615b44
##############################################################################
#
# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
slapos.recipe.librecipe
import
GenericBaseRecipe
import
binascii
import
os
import
sys
class
Recipe
(
GenericBaseRecipe
):
"""
novnc instance configuration.
"""
def
install
(
self
):
runner_path
=
self
.
createPythonScript
(
self
.
options
[
'path'
],
'slapos.recipe.librecipe.execute.execute_wait'
,
[[
self
.
options
[
'websockify-path'
],
'--web'
,
self
.
options
[
'novnc-location'
],
'--key=%s'
%
self
.
options
[
'ssl-key-path'
],
'--cert=%s'
%
self
.
options
[
'ssl-cert-path'
],
'--ssl-only'
,
'%s:%s'
%
(
self
.
options
[
'ip'
],
self
.
options
[
'port'
]),
'%s:%s'
%
(
self
.
options
[
'vnc-ip'
],
self
.
options
[
'vnc-port'
]),
],
[
self
.
options
[
'ssl-key-path'
],
self
.
options
[
'ssl-cert-path'
]]],
)
return
[
runner_path
]
slapos/recipe/request.py
View file @
31615b44
...
@@ -72,14 +72,15 @@ class Recipe(object):
...
@@ -72,14 +72,15 @@ class Recipe(object):
partition_parameter_kw
[
config_parameter
]
=
\
partition_parameter_kw
[
config_parameter
]
=
\
options
[
'config-%s'
%
config_parameter
]
options
[
'config-%s'
%
config_parameter
]
instance
=
self
.
request
(
options
[
'software-url'
],
software_type
,
self
.
instance
=
self
.
request
(
options
[
'software-url'
],
software_type
,
options
.
get
(
'name'
,
name
),
partition_parameter_kw
=
partition_parameter_kw
,
options
.
get
(
'name'
,
name
),
partition_parameter_kw
=
partition_parameter_kw
,
filter_kw
=
filter_kw
,
shared
=
self
.
isSlave
)
filter_kw
=
filter_kw
,
shared
=
self
.
isSlave
)
self
.
failed
=
None
self
.
failed
=
None
for
param
in
self
.
return_parameters
:
for
param
in
self
.
return_parameters
:
try
:
try
:
options
[
'connection-%s'
%
param
]
=
str
(
instance
.
getConnectionParameter
(
param
))
options
[
'connection-%s'
%
param
]
=
str
(
self
.
instance
.
getConnectionParameter
(
param
))
except
slapmodule
.
NotFoundError
:
except
slapmodule
.
NotFoundError
:
options
[
'connection-%s'
%
param
]
=
''
options
[
'connection-%s'
%
param
]
=
''
if
self
.
failed
is
None
:
if
self
.
failed
is
None
:
...
@@ -87,7 +88,16 @@ class Recipe(object):
...
@@ -87,7 +88,16 @@ class Recipe(object):
def
install
(
self
):
def
install
(
self
):
if
self
.
failed
is
not
None
:
if
self
.
failed
is
not
None
:
raise
KeyError
(
"Connection parameter %r not found."
%
self
.
failed
)
# Check instance status to know if instance has been deployed
try
:
status
=
self
.
instance
.
getState
()
except
slapmodule
.
NotFoundError
:
status
=
"not ready yet, please try again"
# XXX-Cedric : currently raise an error. So swallow it...
except
AttributeError
:
status
=
"unknown"
raise
KeyError
(
"Connection parameter %s not found. "
"Status of requested instance is : %s."
%
(
self
.
failed
,
status
))
return
[]
return
[]
update
=
install
update
=
install
slapos/recipe/softwaretype.py
View file @
31615b44
...
@@ -64,6 +64,15 @@ class Recipe:
...
@@ -64,6 +64,15 @@ class Recipe:
# XXX: Lack checking for globality of address
# XXX: Lack checking for globality of address
return
self
.
_getIpAddress
(
netaddr
.
valid_ipv6
)
return
self
.
_getIpAddress
(
netaddr
.
valid_ipv6
)
def
getNetworkInterface
(
self
):
"""Returns the network interface available on partition"""
if
not
'ip_list'
in
self
.
parameter_dict
:
raise
AttributeError
for
name
,
ip
in
self
.
parameter_dict
[
'ip_list'
]:
if
name
:
return
name
raise
AttributeError
,
"Not network interface found"
def
install
(
self
):
def
install
(
self
):
slap
=
slapos
.
slap
.
slap
()
slap
=
slapos
.
slap
.
slap
()
slap_connection
=
self
.
buildout
[
'slap_connection'
]
slap_connection
=
self
.
buildout
[
'slap_connection'
]
...
@@ -111,6 +120,8 @@ class Recipe:
...
@@ -111,6 +120,8 @@ class Recipe:
self
.
getLocalIPv4Address
())
self
.
getLocalIPv4Address
())
buildout
.
set
(
'slap-network-information'
,
'global-ipv6'
,
buildout
.
set
(
'slap-network-information'
,
'global-ipv6'
,
self
.
getGlobalIPv6Address
())
self
.
getGlobalIPv6Address
())
buildout
.
set
(
'slap-network-information'
,
'network-interface'
,
self
.
getNetworkInterface
())
# Copy/paste slap_connection
# Copy/paste slap_connection
buildout
.
add_section
(
'slap-connection'
)
buildout
.
add_section
(
'slap-connection'
)
...
...
software/kvm/instance-frontend.cfg
0 → 100644
View file @
31615b44
#############################
#
# Instanciate kvm frontend
#
#############################
[buildout]
parts =
logrotate
# logrotate-entry-frontend
cron
cron-entry-logrotate
ca-frontend
certificate-authority
frontend-promise
publish-kvm-frontend-connection-information
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
bin = $${buildout:directory}/bin
srv = $${buildout:directory}/srv
var = $${buildout:directory}/var
[basedirectory]
recipe = slapos.cookbook:mkdirectory
services = $${rootdirectory:etc}/run
promises = $${rootdirectory:etc}/promise
nodejs-conf = $${rootdirectory:etc}/nodejs
run = $${rootdirectory:var}/run
log = $${rootdirectory:var}/log
ca-dir = $${rootdirectory:srv}/ssl
backup = $${rootdirectory:srv}/backup
[directory]
recipe = slapos.cookbook:mkdirectory
cron-entries = $${rootdirectory:etc}/cron.d
crontabs = $${rootdirectory:etc}/crontabs
cronstamps = $${rootdirectory:etc}/cronstamps
ca-dir = $${rootdirectory:srv}/ssl
logrotate-backup = $${basedirectory:backup}/logrotate
logrotate-entries = $${rootdirectory:etc}/logrotate.d
[frontend-instance]
recipe = slapos.cookbook:kvm.frontend
domain = $${ca-frontend:name}
# port = $${slap-parameter:port}
ip = $${slap-network-information:global-ipv6}
port = $${slap-parameter:port}
http-redirection = $${slap-parameter:http-redirection}
ssl-key-path = $${ca-frontend:key-file}
ssl-cert-path = $${ca-frontend:cert-file}
slave-instance-list = $${slap-parameter:slave_instance_list}
map-path = $${basedirectory:nodejs-conf}/proxy_table.json
conf-path = $${basedirectory:nodejs-conf}/kvm-proxy.js
wrapper-path = $${rootdirectory:bin}/kvm_frontend
node-binary = ${nodejs:location}/bin/node
node-env = ${buildout:parts-directory}:${npm-modules:location}/node_modules
shell-path = ${dash:location}/bin/dash
[frontend-promise]
recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/frontend_promise
hostname = $${frontend-instance:ip}
port = $${frontend-instance:port}
[certificate-authority]
recipe = slapos.cookbook:certificate_authority
openssl-binary = ${openssl:location}/bin/openssl
ca-dir = $${basedirectory:ca-dir}
requests-directory = $${cadirectory:requests}
wrapper = $${basedirectory: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 = $${basedirectory:ca-dir}/requests/
private = $${basedirectory:ca-dir}/private/
certs = $${basedirectory:ca-dir}/certs/
newcerts = $${basedirectory:ca-dir}/newcerts/
crl = $${basedirectory:ca-dir}/crl/
[ca-frontend]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
key-file = $${basedirectory:nodejs-conf}/nodejs.key
cert-file = $${basedirectory:nodejs-conf}/nodejs.crt
executable = $${frontend-instance:wrapper-path}
wrapper = $${basedirectory:services}/nodejs
# Put domain name
name = $${slap-parameter:domain}
[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 = $${basedirectory:services}/crond
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${rootdirectory:bin}/cron_simplelogger
log = $${basedirectory:log}/cron.log
[cron-entry-logrotate]
<= cron
recipe = slapos.cookbook:cron.d
name = logrotate
frequency = 0 0 * * *
command = $${logrotate:wrapper}
[logrotate]
recipe = slapos.cookbook:logrotate
# Binaries
logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
gzip-binary = ${gzip:location}/bin/gzip
gunzip-binary = ${gzip:location}/bin/gunzip
# Directories
wrapper = $${rootdirectory:bin}/logrotate
conf = $${rootdirectory:etc}/logrotate.conf
logrotate-entries = $${directory:logrotate-entries}
backup = $${directory:logrotate-backup}
state-file = $${rootdirectory:srv}/logrotate.status
[publish-kvm-frontend-connection-information]
recipe = slapos.cookbook:publish
ip = $${frontend-instance:ip}
port = $${frontend-instance:port}
[slap-parameter]
# Default value if no port is specified
port = 4443
http-redirection = 0
# [logrotate-entry-frontend]
# <= logrotate
# recipe = slapos.cookbook:logrotate.d
# name = frontend
# log = $${mariadb-instance:error-log} $${mariadb-instance:slow-query-log}
# post = $${mariadb-instance:mysql-binary} --no-defaults -B --socket=$${mariadb-instance:socket} -e "FLUSH LOGS"
software/kvm/instance-kvm.cfg
0 → 100644
View file @
31615b44
#############################
#
# Instanciate kvm
#
#############################
[buildout]
parts =
request-slave-frontend
certificate-authority
kvm-promise
novnc-promise
publish-kvm-connection-information
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
bin = $${buildout:directory}/bin
srv = $${buildout:directory}/srv
var = $${buildout:directory}/var
[basedirectory]
recipe = slapos.cookbook:mkdirectory
services = $${rootdirectory:etc}/run
promises = $${rootdirectory:etc}/promise
novnc-conf = $${rootdirectory:etc}/novnc
run = $${rootdirectory:var}/run
ca-dir = $${rootdirectory:srv}/ssl
[create-mac]
recipe = slapos.cookbook:generate.mac
[kvm-instance]
recipe = slapos.cookbook:kvm
vnc-ip = $${slap-network-information:local-ipv4}
vnc-port = 5901
nbd-ip = $${slap-parameter:nbd_ip}
nbd-port = $${slap-parameter:nbd_port}
tap = $${slap-network-information:network-interface}
disk-path = $${rootdirectory:srv}/virtual.qcow2
disk-size = 10
socket-path = $${rootdirectory:var}/qmp_socket
pid-path = $${basedirectory:run}/pid_file
smp-count = 1
ram-size = 1024
mac-address = $${create-mac:mac-address}
runner-path = $${basedirectory:services}/kvm
controller-path = $${basedirectory:services}/kvm_controller
shell-path = ${dash:location}/bin/dash
qemu-path = ${kvm:location}/bin/qemu-system-x86_64
qemu-img-path = ${kvm:location}/bin/qemu-img
[kvm-promise]
recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/vnc_promise
hostname = $${kvm-instance:vnc-ip}
port = $${kvm-instance:vnc-port}
[novnc-instance]
recipe = slapos.cookbook:novnc
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}
[certificate-authority]
recipe = slapos.cookbook:certificate_authority
openssl-binary = ${openssl:location}/bin/openssl
ca-dir = $${basedirectory:ca-dir}
requests-directory = $${cadirectory:requests}
wrapper = $${basedirectory: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 = $${basedirectory:ca-dir}/requests/
private = $${basedirectory:ca-dir}/private/
certs = $${basedirectory:ca-dir}/certs/
newcerts = $${basedirectory:ca-dir}/newcerts/
crl = $${basedirectory:ca-dir}/crl/
[ca-novnc]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
key-file = $${basedirectory:novnc-conf}/novnc.key
cert-file = $${basedirectory:novnc-conf}/novnc.crt
executable = $${rootdirectory:bin}/novnc
wrapper = $${basedirectory:services}/websockify
[novnc-promise]
recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/novnc_promise
hostname = $${novnc-instance:ip}
port = $${novnc-instance:port}
[kvm-monitor]
recipe = slapos.cookbook:generic.slapmonitor
db-path = $${rootdirectory:srv}/slapmonitor_database
[request-common]
recipe = slapos.cookbook:request
software-url = $${slap-connection:software-release-url}
sla = computer_guid
sla-computer_guid = $${slap-connection:computer-id}
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}
[request-slave-frontend]
<=request-common
name = SlaveFrontend
software-type = frontend
slave = true
config = host port
config-host = $${novnc-instance:ip}
config-port = $${novnc-instance:port}
return = url resource port domainname
[publish-kvm-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
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:passwd}
software/kvm/instance-kvmplus.cfg
0 → 100644
View file @
31615b44
#############################
#
# Instanciate kvm+
#
#############################
[buildout]
extends = instance-kvm.cfg
[kvm-instance]
recipe = slapos.cookbook:kvm
vnc-ip = $${slap-network-information:local-ipv4}
vnc-port = 5901
nbd-ip = $${slap-parameter:nbd_ip}
nbd-port = $${slap-parameter:nbd_port}
tap = $${slap-network-information:network-interface}
disk-path = $${rootdirectory:srv}/virtual.qcow2
disk-size = 20
socket-path = $${rootdirectory:var}/qmp_socket
pid-path = $${basedirectory:run}/pid_file
smp-count = 2
ram-size = 2048
mac-address = $${create-mac:mac-address}
runner-path = $${basedirectory:services}/kvm
controller-path = $${basedirectory:services}/kvm_controller
shell-path = ${dash:location}/bin/dash
qemu-path = ${kvm:location}/bin/qemu-system-x86_64
qemu-img-path = ${kvm:location}/bin/qemu-img
software/kvm/instance-nbd.cfg
0 → 100644
View file @
31615b44
#############################
#
# Instanciate nbdserver
#
#############################
[buildout]
parts =
nbd-promise
onetimeupload-promise
publish-connection-information
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
srv = $${buildout:directory}/srv
log = $${buildout:directory}/log
[basedirectory]
recipe = slapos.cookbook:mkdirectory
services = $${rootdirectory:etc}/run
promises = $${rootdirectory:etc}/promise
[nbd-instance]
recipe = slapos.cookbook:nbdserver
ip = $${slap-network-information:global-ipv6}
port = 1024
image-path = $${onetimeupload-instance:image-path}
qemu-path = ${kvm:location}/bin/qemu-nbd
shell-path = ${dash:location}/bin/dash
# XXX TODO: Wait for the iso to be uploaded (execute_wait)
path = $${basedirectory:services}/nbdserver
[nbd-promise]
recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/nbd_promise
hostname = $${nbd-instance:ip}
port = $${nbd-instance:port}
[onetimeupload-instance]
recipe = slapos.cookbook:generic.onetimeupload
ip = $${slap-network-information:global-ipv6}
port = 9999
image-path = $${rootdirectory:srv}/cdrom.iso
log-path = $${rootdirectory:log}/onetimeupload.log
shell-path = ${dash:location}/bin/dash
onetimeupload-path = ${buildout:bin-directory}/onetimeupload
path = $${basedirectory:services}/onetimeupload
[onetimeupload-promise]
recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/onetimeupload_promise
hostname = $${onetimeupload-instance:ip}
port = $${onetimeupload-instance:port}
[publish-connection-information]
recipe = slapos.cookbook:publish
nbd_url = nbd://[$${nbd-instance:ip}]:$${nbd-instance:port}
upload_url = http://[$${onetimeupload-instance:ip}]:$${onetimeupload-instance:port}/
upload_key = $${onetimeupload-instance:key}
software/kvm/instance.cfg
View file @
31615b44
[buildout]
[buildout]
parts =
parts =
kvminstanc
e
switch-softwaretyp
e
eggs-directory = ${buildout:eggs-directory}
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[kvminstance]
[switch-softwaretype]
recipe = slapos.cookbook:kvm
recipe = slapos.cookbook:softwaretype
qemu_path = ${kvm:location}/bin/qemu-system-x86_64
default = ${template-kvm:output}
qemu_img_path = ${kvm:location}/bin/qemu-img
kvm = ${template-kvm:output}
#slapmonitor_path = ${buildout:bin-directory}/slapmonitor
kvm+ = ${template-kvmplus:output}
#slapreport_path = ${buildout:bin-directory}/slapreport
nbd = ${template-nbd:output}
websockify = ${buildout:directory}/bin/websockify
frontend = ${template-frontend:output}
noVNC_location = ${noVNC:location}
openssl_binary = ${openssl:location}/bin/openssl
rdiff_backup_binary = ${buildout:bin-directory}/rdiff-backup
dcrond_binary = ${dcron:location}/sbin/crond
smp_count = 1
[slap-connection]
ram_size = 1024
# part to migrate to new - separated words
disk_size = 10
computer-id = $${slap_connection:computer_id}
partition-id = $${slap_connection:partition_id}
server-url = $${slap_connection:server_url}
software-release-url = $${slap_connection:software_release_url}
key-file = $${slap_connection:key_file}
cert-file = $${slap_connection:cert_file}
software/kvm/software.cfg
View file @
31615b44
...
@@ -3,46 +3,37 @@ extensions =
...
@@ -3,46 +3,37 @@ extensions =
buildout-versions
buildout-versions
extends =
extends =
../../component/gzip/buildout.cfg
../../component/dcron/buildout.cfg
../../component/dcron/buildout.cfg
../../component/logrotate/buildout.cfg
../../component/git/buildout.cfg
../../component/git/buildout.cfg
../../component/gnutls/buildout.cfg
../../component/gnutls/buildout.cfg
../../component/libpng/buildout.cfg
../../component/libpng/buildout.cfg
../../component/libuuid/buildout.cfg
../../component/libuuid/buildout.cfg
../../component/lxml-python/buildout.cfg
../../component/noVNC/buildout.cfg
../../component/noVNC/buildout.cfg
../../component/openssl/buildout.cfg
../../component/openssl/buildout.cfg
../../component/
python-2.7
/buildout.cfg
../../component/
dash
/buildout.cfg
../../component/
rdiff-backup
/buildout.cfg
../../component/
lxml-python
/buildout.cfg
../../stack/
shacache-client
.cfg
../../stack/
nodejs
.cfg
develop =
develop =
${:parts-directory}/websockify
${:parts-directory}/websockify
parts =
parts =
template
template
dash
kvm
kvm
eggs
eggs
check-local-eggs
check-local-eggs
nodejs
find-links +=
http-proxy
http://www.nexedi.org/static/packages/source/slapos.buildout/
proxy-by-url
npm-modules
dcron
logrotate
versions = versions
versions = versions
# Use only quite well working sites.
allow-hosts =
*.nexedi.org
*.python.org
*.sourceforge.net
alastairs-place.net
dist.repoze.org
effbot.org
github.com
peak.telecommunity.com
psutil.googlecode.com
www.dabeaz.com
www.owlfish.com
#XXX-Cedric : Currently, one can only access to KVM using noVNC.
#XXX-Cedric : Currently, one can only access to KVM using noVNC.
# Ideally one should be able to access KVM by using either NoVNC or VNC.
# Ideally one should be able to access KVM by using either NoVNC or VNC.
# Problem is : no native crypto support in web browsers. So we have to disable ssl
# Problem is : no native crypto support in web browsers. So we have to disable ssl
...
@@ -54,15 +45,14 @@ allow-hosts =
...
@@ -54,15 +45,14 @@ allow-hosts =
# Websockify (socket <-> websocket proxy server) when it is ready.
# Websockify (socket <-> websocket proxy server) when it is ready.
# May solve previous XXX depending on the implementation.
# May solve previous XXX depending on the implementation.
#XXX-Cedric: Check status of
# https://www.tiolive.com/nexedi/bug_module/20110819-11F4F70 for
# Chrome >= 14 and Firefox >=7 can access to noVNC. (should be solved)
#XXX-Cedric : add list of keyboard layouts (azerty/us querty/...) parameter to qemu
#XXX-Cedric : add list of keyboard layouts (azerty/us querty/...) parameter to qemu
[kvm]
[kvm]
recipe = hexagonit.recipe.cmmi
recipe = hexagonit.recipe.cmmi
url = http://downloads.sourceforge.net/project/kvm/qemu-kvm/0.15.1/qemu-kvm-0.15.1.tar.gz
url = http://downloads.sourceforge.net/project/kvm/qemu-kvm/0.15.1/qemu-kvm-0.15.1.tar.gz
# XXX-Cedric : Upgrade to 1.0
# url = http://downloads.sourceforge.net/project/kvm/qemu-kvm/1.0/qemu-kvm-1.0.tar.gz
# md5sum = 00a825db46a70ba8ef9fc95da9cc7c1e
md5sum = 8800a7d6b3aa4a168ea7f78dc66c0320
md5sum = 8800a7d6b3aa4a168ea7f78dc66c0320
configure-options =
configure-options =
--disable-sdl
--disable-sdl
...
@@ -76,7 +66,7 @@ configure-options =
...
@@ -76,7 +66,7 @@ configure-options =
--enable-vnc-png
--enable-vnc-png
--disable-vnc-jpeg
--disable-vnc-jpeg
--extra-cflags="-I${gnutls:location}/include -I${libuuid:location}/include -I${zlib:location}/include -I${libpng:location}/include"
--extra-cflags="-I${gnutls:location}/include -I${libuuid:location}/include -I${zlib:location}/include -I${libpng:location}/include"
--extra-ldflags="-Wl,-rpath -Wl,${glib:location}/lib -L${glib:location}/lib -Wl,-rpath -Wl,${gnutls:location}/lib -L${gnutls:location}/lib -L${gettext:location}/lib -Wl,-rpath -Wl,${gettext:location}/lib -Wl,-rpath -Wl,${libpng:location}/lib -L${libpng:location}/lib -L${libuuid:location}/lib -Wl,-rpath -Wl,${libuuid:location}/lib -L${zlib:location}/lib -Wl,-rpath -Wl,${zlib:location}/lib -lpng -lz -lgnutls"
--extra-ldflags="-Wl,-rpath -Wl,${glib:location}/lib -L${glib:location}/lib -Wl,-rpath -Wl,${gnutls:location}/lib -L${gnutls:location}/lib -
Wl,-rpath -Wl,${gpg-error:location}/lib -L${gpg-error:location}/lib -
L${gettext:location}/lib -Wl,-rpath -Wl,${gettext:location}/lib -Wl,-rpath -Wl,${libpng:location}/lib -L${libpng:location}/lib -L${libuuid:location}/lib -Wl,-rpath -Wl,${libuuid:location}/lib -L${zlib:location}/lib -Wl,-rpath -Wl,${zlib:location}/lib -lpng -lz -lgnutls"
--disable-werror
--disable-werror
environment =
environment =
PATH=${pkgconfig:location}/bin:%(PATH)s
PATH=${pkgconfig:location}/bin:%(PATH)s
...
@@ -86,8 +76,8 @@ environment =
...
@@ -86,8 +76,8 @@ environment =
# XXX-Cedric : use official egg from pypi when it is released
# XXX-Cedric : use official egg from pypi when it is released
recipe = plone.recipe.command
recipe = plone.recipe.command
stop-on-error = true
stop-on-error = true
commit =
e7363f43443deb9982bdb5c3db50eec475584b06
commit =
301f3ae580557da47fa5ea2050aa671ce9c5a1a0
repository = https://github.com/
desaintmartin
/websockify.git
repository = https://github.com/
SlapOS
/websockify.git
location = ${buildout:parts-directory}/${:_buildout_section_name_}
location = ${buildout:parts-directory}/${:_buildout_section_name_}
git-binary = ${git:location}/bin/git
git-binary = ${git:location}/bin/git
command = export GIT_SSL_NO_VERIFY=true; (${:git-binary} clone --quiet ${:repository} ${:location} && cd ${:location} && ${:git-binary} reset --hard ${:commit}) || (rm -fr ${:location}; exit 1)
command = export GIT_SSL_NO_VERIFY=true; (${:git-binary} clone --quiet ${:repository} ${:location} && cd ${:location} && ${:git-binary} reset --hard ${:commit}) || (rm -fr ${:location}; exit 1)
...
@@ -101,83 +91,107 @@ command = grep parts ${buildout:develop-eggs-directory}/websockify.egg-link
...
@@ -101,83 +91,107 @@ command = grep parts ${buildout:develop-eggs-directory}/websockify.egg-link
depends = ${eggs:dummy}
depends = ${eggs:dummy}
[eggs]
[eggs]
python = python2.7
recipe = z3c.recipe.scripts
recipe = z3c.recipe.scripts
dummy =
dummy =
${websockify:location}
${websockify:location}
eggs =
eggs =
${lxml-python:egg}
${lxml-python:egg}
slapos.cookbook
websockify
websockify
slapos.cookbook
slapos.toolbox
[http-proxy]
# https://github.com/nodejitsu/node-http-proxy
recipe = slapos.recipe.build:download-unpacked
#XXX-Cedric : use upstream when merged
url = https://nodeload.github.com/desaintmartin/node-http-proxy/zipball/master
md5sum = 20204d0b29c2cef26e1c91e99eedca6b
[proxy-by-url]
# https://github.com/dominictarr/proxy-by-url
recipe = slapos.recipe.build:download-unpacked
#XXX-Cedric : use upstream when merged
url = https://nodeload.github.com/desaintmartin/proxy-by-url/zipball/master
md5sum = f6a7c4f8f01f3049086a1dbde2cd141c
[npm-modules]
recipe = plone.recipe.command
destination = ${buildout:parts-directory}/${:_buildout_section_name_}
location = ${buildout:parts-directory}/${:_buildout_section_name_}
command =
rm -fr ${:destination} &&
mkdir -p ${:destination} &&
cd ${:destination} &&
${nodejs:location}/bin/node ${nodejs:location}/bin/npm install colors@0.6.0-1 &&
${nodejs:location}/bin/node ${nodejs:location}/bin/npm install socket.io@0.8.7 &&
${nodejs:location}/bin/node ${nodejs:location}/bin/npm install socket.io-client@0.8.7 &&
${nodejs:location}/bin/node ${nodejs:location}/bin/npm install optimist@0.3.1 &&
${nodejs:location}/bin/node ${nodejs:location}/bin/npm install pkginfo@0.2.3
[template-kvm]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kvm.cfg
md5sum = b6572c018e44d4676e76805116bcade0
output = ${buildout:directory}/template-kvm.cfg
mode = 0644
[template-kvmplus]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kvmplus.cfg
md5sum = 2e35c5b2ac9ee51d8f98fb1199f011c4
output = ${buildout:directory}/template-kvmplus.cfg
mode = 0644
[template-nbd]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-nbd.cfg
md5sum = 7691fadfc8d4392c58ac1bf0ebd5aaf2
output = ${buildout:directory}/template-nbd.cfg
mode = 0644
[template-frontend]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-frontend.cfg
md5sum = 123bf4e5bea9e86c03b62e9afb8ca04b
output = ${buildout:directory}/template-frontend.cfg
mode = 0644
[template]
[template]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
url = ${:_profile_base_location_}/instance.cfg
md5sum =
298b146e4efce41bfd58b3f85d064ff1
md5sum =
68788763d23f70f24b9e575871c903a8
output = ${buildout:directory}/template.cfg
output = ${buildout:directory}/template.cfg
mode = 0644
mode = 0644
[versions]
[networkcache]
zc.buildout = 1.5.3-dev-SlapOS-010
# signature certificates of the following uploaders.
# Romain Courteaud
slapos.cookbook = 0.37
# Cedric de Saint Martin
Jinja2 = 2.6
signature-certificate-list =
Werkzeug = 0.8.1
-----BEGIN CERTIFICATE-----
buildout-versions = 1.7
MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE
hexagonit.recipe.cmmi = 1.5.0
CBMQRGVmYXVsdCBQcm92aW5jZTEPMA0GA1UEChMGTmV4ZWRpMB4XDTExMDkxNTA5
lxml = 2.3.2
MDAwMloXDTEyMDkxNTA5MDAwMlowOTELMAkGA1UEBhMCRlIxGTAXBgNVBAgTEERl
meld3 = 0.6.7
ZmF1bHQgUHJvdmluY2UxDzANBgNVBAoTBk5leGVkaTCBnzANBgkqhkiG9w0BAQEF
plone.recipe.command = 1.1
AAOBjQAwgYkCgYEApYZv6OstoqNzxG1KI6iE5U4Ts2Xx9lgLeUGAMyfJLyMmRLhw
slapos.recipe.template = 2.2
boKOyJ9Xke4dncoBAyNPokUR6iWOcnPHtMvNOsBFZ2f7VA28em3+E1JRYdeNUEtX
z3c.recipe.scripts = 1.0.1
Z0s3HjcouaNAnPfjFTXHYj4um1wOw2cURSPuU5dpzKBbV+/QCb5DLheynisCAwEA
ATANBgkqhkiG9w0BAQsFAAOBgQBCZLbTVdrw3RZlVVMFezSHrhBYKAukTwZrNmJX
# Required by:
mHqi2tN8tNo6FX+wmxUUAf3e8R2Ymbdbn2bfbPpcKQ2fG7PuKGvhwMG3BlF9paEC
# slapos.core==0.20
q7jdfWO18Zp/BG7tagz0jmmC4y/8akzHsVlruo2+2du2freE8dK746uoMlXlP93g
Flask = 0.8
QUUGLQ==
-----END CERTIFICATE-----
# Required by:
-----BEGIN CERTIFICATE-----
# slapos.cookbook==0.37
MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
PyXML = 0.8.4
BAMMCENPTVAtMjMyMCAXDTEyMDIxNjExMTAyM1oYDzIxMTIwMTIzMTExMDIzWjAT
MREwDwYDVQQDDAhDT01QLTIzMjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
# Required by:
wi/3Z8W9pUiegUXIk/AiFDQ0UJ4JFAwjqr+HSRUirlUsHHT+8DzH/hfcTDX1I5BB
# hexagonit.recipe.cmmi==1.5.0
D1ADk+ydXjMm3OZrQcXjn29OUfM5C+g+oqeMnYQImN0DDQIOcUyr7AJc4xhvuXQ1
hexagonit.recipe.download = 1.5.0
P2pJ5NOd3tbd0kexETa1LVhR6EgBC25LyRBRae76qosCAwEAAaNQME4wHQYDVR0O
BBYEFMDmW9aFy1sKTfCpcRkYnP6zUd1cMB8GA1UdIwQYMBaAFMDmW9aFy1sKTfCp
# Required by:
cRkYnP6zUd1cMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAskbFizHr
# slapos.cookbook==0.37
b6d3iIyN+wffxz/V9epbKIZVEGJd/6LrTdLiUfJPec7FaxVCWNyKBlCpINBM7cEV
netaddr = 0.7.6
Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby
If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY=
# Required by:
-----END CERTIFICATE-----
# slapos.core==0.20
netifaces = 0.6
# Required by:
# websockify==0.1-dev
numpy = 1.6.1
# Required by:
# slapos.cookbook==0.37
# slapos.core==0.20
# zc.buildout==1.5.3-dev-SlapOS-010
# zc.recipe.egg==1.3.2
setuptools = 0.6c12dev-r88846
# Required by:
# slapos.cookbook==0.37
slapos.core = 0.20
# Required by:
# slapos.core==0.20
supervisor = 3.0a10
# Required by:
# slapos.cookbook==0.37
xml-marshaller = 0.9.7
# Required by:
# slapos.cookbook==0.37
zc.recipe.egg = 1.3.2
# Required by:
# slapos.core==0.20
zope.interface = 3.8.0
\ No newline at end of file
software/nbd/instance.cfg
deleted
100644 → 0
View file @
cbba3f8c
[buildout]
parts =
nbdserverinstance
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
[nbdserverinstance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
qemu_path = ${nbdserver:location}/bin/qemu-nbd
onetimeupload_path = ${buildout:bin-directory}/onetimeupload
software/nbd/software.cfg
deleted
100644 → 0
View file @
cbba3f8c
[buildout]
extends =
../../stack/nbd.cfg
../../stack/shacache-client.cfg
parts +=
template
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
md5sum = 82e948e1c0cb0d5540ef185edeef3ec3
output = ${buildout:directory}/template.cfg
mode = 0644
[versions]
# XXX-CEDRIC Quick and dirty workaround to avoid m2crypto problems.
# should not be used elsewhere unless for urgent cases.
slapos.libnetworkcache = 0.2
stack/nodejs.cfg
0 → 100644
View file @
31615b44
[buildout]
extends =
../component/nodejs/buildout.cfg
../component/lxml-python/buildout.cfg
../stack/slapos.cfg
versions = versions
parts =
eggs
nodejs
npm
[eggs]
recipe = zc.recipe.egg
eggs =
slapos.cookbook
${lxml-python:egg}
stack/slapos.cfg
View file @
31615b44
...
@@ -18,6 +18,7 @@ exec-sitecustomize = false
...
@@ -18,6 +18,7 @@ exec-sitecustomize = false
# Add location for modified non-official slapos.buildout
# Add location for modified non-official slapos.buildout
find-links +=
find-links +=
http://www.nexedi.org/static/packages/source/slapos.buildout/
http://www.nexedi.org/static/packages/source/slapos.buildout/
http://www.nexedi.org/static/packages/source/hexagonit.recipe.download/
# Use only quite well working sites.
# Use only quite well working sites.
allow-hosts +=
allow-hosts +=
...
@@ -38,3 +39,12 @@ allow-hosts +=
...
@@ -38,3 +39,12 @@ allow-hosts +=
# Unzippig of eggs is required, as SlapOS do not yet provide nicely working
# Unzippig of eggs is required, as SlapOS do not yet provide nicely working
# development / fast switching environment for whole software
# development / fast switching environment for whole software
unzip = true
unzip = true
versions = versions
[versions]
# Use patched hexagonit.recipe.download from
# https://github.com/SlapOS/hexagonit.recipe.download
hexagonit.recipe.download = 1.5.1-dev-slapos-001
# Use SlapOS patched zc.buildout
zc.buildout = 1.6.0-dev-SlapOS-004
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