Commit 5d95eea0 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Christos Stavrakakis

deploy: Add Archipelago support

Extend snf-deploy to support installation and configuration of
Archipelago.

Archipelago related packages are found in apt.dev unstable an in
ceph's repo, which are added to the source.list.

A new nfs mount point is created /srv/archip and two new components,
Archip and ArchipGaneti are added to be included in pithos, cyclades,
ganeti and master roles.
parent 603d022a
......@@ -60,3 +60,17 @@ nfdhcpd = wheezy
kamaki =
python-bitarray = wheezy
python-nfqueue = 0.4+physindev-1~wheezy
[archip]
librados2 =
archipelago = experimental
archipelago-dbg = experimental
archipelago-modules-dkms = experimental
archipelago-modules-source = experimental
archipelago-rados = experimental
archipelago-rados-dbg = experimental
libxseg0 = experimental
libxseg0-dbg = experimental
python-archipelago = experimental
python-xseg = experimental
archipelago-ganeti = experimental
......@@ -60,3 +60,17 @@ nfdhcpd = wheezy
kamaki = wheezy
python-bitarray = wheezy
python-nfqueue = 0.4+physindev-1~wheezy
[archip]
librados2 =
archipelago = experimental
archipelago-dbg = experimental
archipelago-modules-dkms = experimental
archipelago-modules-source = experimental
archipelago-rados = experimental
archipelago-rados-dbg = experimental
libxseg0 = experimental
libxseg0-dbg = experimental
python-archipelago = experimental
python-xseg = experimental
archipelago-ganeti = experimental
......@@ -2,3 +2,7 @@ deb http://ftp.de.debian.org/debian wheezy main non-free contrib
deb http://apt.dev.grnet.gr wheezy/
deb http://apt.dev.grnet.gr unstable/
# This is for archipelago packages
deb http://apt.dev.grnet.gr experimental/
deb http://eu.ceph.com/debian-dumpling/ wheezy main
# -*- coding: utf-8 -
#
# Copyright 2013 GRNET S.A. All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above
# copyright notice, this list of conditions and the following
# disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and
# documentation are those of the authors and should not be
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
from pithos.workers import glue
import pickle
from svipc import sem_init, sem_take, sem_give
def find_hole(WORKERS, FOLLOW_WORKERS):
old_key = []
old_age = []
for key in FOLLOW_WORKERS:
if key not in WORKERS.keys():
old_age.append(FOLLOW_WORKERS[key] )
old_key.append( key )
break
if len(old_age) and len(old_key):
for key in old_key:
del FOLLOW_WORKERS[key]
return old_age
return old_age
def follow_workers(pid, wid, WORKERS):
hole = None
try:
fd = open('/dev/shm/wid','rb')
f = pickle.load(fd)
hole = find_hole(WORKERS, f)
if len(hole) > 0:
k = {pid: int(hole[0])}
else:
k = {pid: wid}
f.update(k)
fd.close()
fd = open('/dev/shm/wid','wb')
pickle.dump(f, fd)
fd.close()
except:
fd = open('/dev/shm/wid','wb')
pickle.dump({pid:wid}, fd)
fd.close()
return hole
def allocate_wid(pid, wid, WORKERS):
d = {pid: wid}
hole = None
if sem_init(88,nums=1) == 0:
hole = follow_workers(pid, wid, WORKERS)
sem_give(88,0)
else:
sem_take(88,0)
hole = follow_workers(pid, wid, WORKERS)
sem_give(88,0)
return hole
def post_fork(server,worker):
wid = allocate_wid(worker.pid,worker.worker_id, server.WORKERS)
if wid:
glue.WorkerGlue.setmap(worker.pid,wid[0])
else:
glue.WorkerGlue.setmap(worker.pid,worker.worker_id)
......@@ -4,12 +4,13 @@ CONFIG = {
'DJANGO_SETTINGS_MODULE': 'synnefo.settings',
},
'working_dir': '/etc/synnefo',
'user': 'www-data',
'group': 'www-data',
'user': 'root',
'group': 'root',
'args': (
'--bind=127.0.0.1:8080',
'--workers=6',
'--worker-class=gevent',
'--worker-class=pithos.workers.gevent_archipelago.GeventArchipelagoWorker',
'--config=/etc/synnefo/pithos.conf.py',
# '--worker-class=sync',
'--log-level=debug',
),
......
PITHOS_BACKEND_DB_CONNECTION = 'postgresql://%SYNNEFO_USER%:%SYNNEFO_DB_PASSWD%@%DB_NODE%:5432/snf_pithos'
PITHOS_BACKEND_BLOCK_PATH = '%PITHOS_DIR%/data'
PITHOS_BACKEND_QUOTA = 20 * 1024 * 1024 * 1024
PITHOS_AUTHENTICATION_URL = 'https://%ACCOUNTS%/im/authenticate'
PITHOS_AUTHENTICATION_USERS = None
PITHOS_BACKEND_DB_CONNECTION = 'postgresql://%SYNNEFO_USER%:%SYNNEFO_DB_PASSWD%@%DB_NODE%:5432/snf_pithos'
PITHOS_BACKEND_BLOCK_PATH = '%PITHOS_DIR%/data'
PITHOS_BACKEND_QUOTA = 20 * 1024 * 1024 * 1024
PITHOS_UPDATE_MD5 = False
PITHOS_SERVICE_TOKEN = '%PITHOS_SERVICE_TOKEN%'
......
# -*- coding: utf-8 -
#
# Copyright 2013 GRNET S.A. All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above
# copyright notice, this list of conditions and the following
# disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and
# documentation are those of the authors and should not be
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
from pithos.workers import glue
import pickle
from svipc import sem_init, sem_take, sem_give
def find_hole(WORKERS, FOLLOW_WORKERS):
old_key = []
old_age = []
for key in FOLLOW_WORKERS:
if key not in WORKERS.keys():
old_age.append(FOLLOW_WORKERS[key] )
old_key.append( key )
break
if len(old_age) and len(old_key):
for key in old_key:
del FOLLOW_WORKERS[key]
return old_age
return old_age
def follow_workers(pid, wid, WORKERS):
hole = None
try:
fd = open('/dev/shm/wid','rb')
f = pickle.load(fd)
hole = find_hole(WORKERS, f)
if len(hole) > 0:
k = {pid: int(hole[0])}
else:
k = {pid: wid}
f.update(k)
fd.close()
fd = open('/dev/shm/wid','wb')
pickle.dump(f, fd)
fd.close()
except:
fd = open('/dev/shm/wid','wb')
pickle.dump({pid:wid}, fd)
fd.close()
return hole
def allocate_wid(pid, wid, WORKERS):
d = {pid: wid}
hole = None
if sem_init(88,nums=1) == 0:
hole = follow_workers(pid, wid, WORKERS)
sem_give(88,0)
else:
sem_take(88,0)
hole = follow_workers(pid, wid, WORKERS)
sem_give(88,0)
return hole
def post_fork(server,worker):
wid = allocate_wid(worker.pid,worker.worker_id, server.WORKERS)
if wid:
glue.WorkerGlue.setmap(worker.pid,wid[0])
else:
glue.WorkerGlue.setmap(worker.pid,worker.worker_id)
......@@ -372,7 +372,10 @@ class Ganeti(SynnefoComponent):
] + self.prepare_net_infra()
def restart(self):
return ["/etc/init.d/ganeti restart"]
return ["/etc/init.d/ganeti restart",
"mkdir -p /srv/archip/blocks",
"mkdir -p /srv/archip/maps",
"archipelago restart"]
class Master(SynnefoComponent):
......@@ -427,7 +430,6 @@ EOF
class Image(SynnefoComponent):
REQUIRED_PACKAGES = [
"snf-pithos-backend",
"snf-image",
]
......@@ -785,7 +787,8 @@ class Mount(SynnefoComponent):
def prepare(self):
ret = []
for d in [self.env.env.pithos_dir, self.env.env.image_dir]:
dirs = [self.env.env.pithos_dir, self.env.env.image_dir, "/srv/archip"]
for d in dirs:
ret.append("mkdir -p %s" % d)
cmd = """
cat >> /etc/fstab <<EOF
......@@ -798,7 +801,8 @@ EOF
def initialize(self):
ret = []
for d in [self.env.env.pithos_dir, self.env.env.image_dir]:
dirs = [self.env.env.pithos_dir, self.env.env.image_dir, "/srv/archip"]
for d in dirs:
ret.append("mount %s" % d)
return ret
......@@ -819,6 +823,8 @@ class NFS(SynnefoComponent):
return [
"mkdir -p %s" % self.env.env.image_dir,
"mkdir -p %s/data" % p,
"mkdir -p /srv/archip/blocks",
"mkdir -p /srv/archip/maps",
"chown www-data.www-data %s/data" % p,
"chmod g+ws %s/data" % p,
] + self.prepare_image()
......@@ -828,6 +834,7 @@ class NFS(SynnefoComponent):
cat >> /etc/exports <<EOF
{0} {2}(rw,async,no_subtree_check,no_root_squash)
{1} {2}(rw,async,no_subtree_check,no_root_squash)
/srv/archip {2}(rw,async,no_subtree_check,no_root_squash)
EOF
""".format(self.env.env.pithos_dir, self.env.env.image_dir, node_info.ip)
return [cmd] + self.restart()
......@@ -839,7 +846,6 @@ EOF
class Pithos(SynnefoComponent):
REQUIRED_PACKAGES = [
"kamaki",
"snf-pithos-backend",
"snf-pithos-app",
"snf-pithos-webclient",
]
......@@ -875,11 +881,28 @@ class Pithos(SynnefoComponent):
return ["pithos-migrate stamp head"]
class PithosBackend(SynnefoComponent):
REQUIRED_PACKAGES = [
"snf-pithos-backend",
]
def configure(self):
r1 = {
"db_node": self.env.env.db.ip,
"synnefo_user": self.env.env.synnefo_user,
"synnefo_db_passwd": self.env.env.synnefo_db_passwd,
"pithos_dir": self.env.env.pithos_dir,
}
return [
("/etc/synnefo/backend.conf", r1, {}),
]
class Cyclades(SynnefoComponent):
REQUIRED_PACKAGES = [
"memcached",
"python-memcache",
"snf-pithos-backend",
"kamaki",
"snf-cyclades-app",
"python-django-south",
......@@ -1115,3 +1138,38 @@ class GanetiCollectd(SynnefoComponent):
("/etc/collectd/passwd", {}, {}),
("/etc/collectd/synnefo-ganeti.conf", r1, {}),
]
class Archip(SynnefoComponent):
REQUIRED_PACKAGES = [
"librados2",
"archipelago",
"archipelago-dbg",
"archipelago-modules-dkms",
"archipelago-modules-source",
"archipelago-rados",
"archipelago-rados-dbg",
"libxseg0",
"libxseg0-dbg",
"python-archipelago",
"python-xseg",
]
def prepare(self):
return ["mkdir -p /etc/archip"]
def configure(self):
return [
("/etc/archip/pithos.conf.py", {}, {})
]
def restart(self):
return [
"archipelago restart"
]
class ArchipGaneti(SynnefoComponent):
REQUIRED_PACKAGES = [
"archipelago-ganeti",
]
......@@ -238,7 +238,7 @@ class Conf(object):
"deploy": ["dirs", "packages", "keys", "options"],
"vcluster": ["cluster", "image", "network"],
"synnefo": ["cred", "synnefo", "roles"],
"wheezy": ["debian", "ganeti", "synnefo", "other"],
"wheezy": ["debian", "ganeti", "synnefo", "other", "archip"],
}
confdir = "/etc/snf-deploy"
......
......@@ -39,10 +39,13 @@ ROLES = {
"mq": [HW, SSH, DNS, APT, MQ],
"nfs": [HW, SSH, DNS, APT, NFS],
"astakos": [HW, SSH, DNS, APT, Apache, Gunicorn, Common, WEB, Astakos],
"pithos": [HW, SSH, DNS, APT, Apache, Gunicorn, Common, WEB, Pithos],
"pithos": [
HW, SSH, DNS, APT, Apache,
Gunicorn, Common, WEB, PithosBackend, Archip, Pithos
],
"cyclades": [
HW, SSH, DNS, APT,
Apache, Gunicorn, Common, WEB, Cyclades, VNC
Apache, Gunicorn, Common, WEB, Cyclades, VNC, PithosBackend, Archip
],
"cms": [HW, SSH, DNS, APT, Apache, Gunicorn, Common, WEB, CMS],
"stats": [
......@@ -52,11 +55,13 @@ ROLES = {
"client": [HW, SSH, DNS, APT, Kamaki, Burnin],
"ganeti": [
HW, SSH, DNS, DDNS, APT, Mount,
Ganeti, Image, Network, GTools, GanetiCollectd
Ganeti, PithosBackend, Archip, ArchipGaneti,
Image, Network, GTools, GanetiCollectd
],
"master": [
HW, SSH, DNS, DDNS, APT, Mount,
Ganeti, Master, Image, Network, GTools, GanetiCollectd
Ganeti, Master, PithosBackend, Archip, ArchipGaneti,
Image, Network, GTools, GanetiCollectd
],
}
......
......@@ -113,7 +113,7 @@ def install_package(package):
info = getattr(env.env, package)
if info in \
["squeeze-backports", "squeeze", "stable",
"testing", "unstable", "wheezy"]:
"testing", "unstable", "wheezy", "experimental"]:
apt_get += " -t %s %s " % (info, package)
elif info:
apt_get += " %s=%s " % (package, info)
......
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