Revision c873d856

b/snf-deploy/files/etc/apt/sources.list.d/synnefo.wheezy.list
2 2

  
3 3
deb http://apt.dev.grnet.gr wheezy/
4 4
deb http://apt.dev.grnet.gr unstable/
5

  
6
deb http://eu.ceph.com/debian-dumpling/ wheezy main
b/snf-deploy/files/etc/archip/pithos.conf.py
1
# -*- coding: utf-8 -
2
#
3
# Copyright 2013 GRNET S.A. All rights reserved.
4
#
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
#
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
#
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
#
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
#
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35

  
36
from pithos.workers import glue
37
import pickle
38
from svipc import sem_init, sem_take, sem_give
39

  
40
def find_hole(WORKERS, FOLLOW_WORKERS):
41
        old_key = []
42
        old_age =  []
43
        for key in FOLLOW_WORKERS:
44
                if key not in WORKERS.keys():
45
                        old_age.append(FOLLOW_WORKERS[key] )
46
                        old_key.append( key )
47
                        break
48
        if len(old_age) and len(old_key):
49
                for key in old_key:
50
                        del FOLLOW_WORKERS[key]
51
                return old_age
52
        return old_age
53

  
54
def follow_workers(pid, wid, WORKERS):
55
        hole = None
56
        try:
57
                fd = open('/dev/shm/wid','rb')
58
                f = pickle.load(fd)
59
                hole = find_hole(WORKERS, f)
60
                if len(hole) > 0:
61
                    k = {pid: int(hole[0])}
62
                else:
63
                    k = {pid: wid}
64
                f.update(k)
65
                fd.close()
66
                fd = open('/dev/shm/wid','wb')
67
                pickle.dump(f, fd)
68
                fd.close()
69
        except:
70
                fd = open('/dev/shm/wid','wb')
71
                pickle.dump({pid:wid}, fd)
72
                fd.close()
73
        return hole
74

  
75
def allocate_wid(pid, wid, WORKERS):
76
        d = {pid: wid}
77
        hole = None
78
        if sem_init(88,nums=1) == 0:
79
                hole = follow_workers(pid, wid, WORKERS)
80
                sem_give(88,0)
81
        else:
82
                sem_take(88,0)
83
                hole = follow_workers(pid, wid, WORKERS)
84
                sem_give(88,0)
85
        return hole
86

  
87

  
88
def post_fork(server,worker):
89
        wid = allocate_wid(worker.pid,worker.worker_id, server.WORKERS)
90
        if wid:
91
                glue.WorkerGlue.setmap(worker.pid,wid[0])
92
        else:
93
                glue.WorkerGlue.setmap(worker.pid,worker.worker_id)
94

  
b/snf-deploy/files/etc/gunicorn.d/synnefo
4 4
   'DJANGO_SETTINGS_MODULE': 'synnefo.settings',
5 5
 },
6 6
 'working_dir': '/etc/synnefo',
7
 'user': 'www-data',
8
 'group': 'www-data',
7
 'user': 'root',
8
 'group': 'root',
9 9
 'args': (
10 10
   '--bind=127.0.0.1:8080',
11
   '--workers=6',
12
   '--worker-class=gevent',
11
   '--workers=8',
12
   '--worker-class=pithos.workers.gevent_archipelago.GeventArchipelagoWorker',
13
   '--config=/etc/synnefo/pithos.conf.py',
13 14
   # '--worker-class=sync',
14 15
   '--log-level=debug',
15 16
 ),
b/snf-deploy/snfdeploy/components.py
776 776

  
777 777
    def prepare(self):
778 778
        ret = []
779
        for d in [self.env.env.pithos_dir, self.env.env.image_dir]:
779
        dirs = [self.env.env.pithos_dir, self.env.env.image_dir, "/srv/archip"]
780
        for d in dirs:
780 781
            ret.append("mkdir -p %s" % d)
781 782
            cmd = """
782 783
cat >> /etc/fstab <<EOF
......
789 790

  
790 791
    def initialize(self):
791 792
        ret = []
792
        for d in [self.env.env.pithos_dir, self.env.env.image_dir]:
793
        dirs = [self.env.env.pithos_dir, self.env.env.image_dir, "/srv/archip"]
794
        for d in dirs:
793 795
            ret.append("mount %s" % d)
794 796
        return ret
795 797

  
......
810 812
        return [
811 813
            "mkdir -p %s" % self.env.env.image_dir,
812 814
            "mkdir -p %s/data" % p,
815
            "mdir -p /srv/archip/blocks",
816
            "mdir -p /srv/archip/maps",
813 817
            "chown www-data.www-data %s/data" % p,
814 818
            "chmod g+ws %s/data" % p,
815 819
            ] + self.prepare_image()
......
819 823
cat >> /etc/exports <<EOF
820 824
{0} {2}(rw,async,no_subtree_check,no_root_squash)
821 825
{1} {2}(rw,async,no_subtree_check,no_root_squash)
826
/srv/archip {2}(rw,async,no_subtree_check,no_root_squash)
822 827
EOF
823 828
""".format(self.env.env.pithos_dir, self.env.env.image_dir, node_info.ip)
824 829
        return [cmd] + self.restart()
......
1087 1092
            ("/etc/collectd/passwd", {}, {}),
1088 1093
            ("/etc/collectd/synnefo-ganeti.conf", r1, {}),
1089 1094
            ]
1095

  
1096

  
1097
class Archip(SynnefoComponent):
1098
    REQUIRED_PACKAGES = [
1099
        "librados2",
1100
        "archipelago",
1101
        "archipelago-dbg",
1102
        "archipelago-modules-dkms",
1103
        "archipelago-modules-source",
1104
        "archipelago-rados",
1105
        "archipelago-rados-dbg",
1106
        "libxseg0",
1107
        "libxseg0-dbg",
1108
        "python-archipelago",
1109
        "python-xseg",
1110
        ]
1111

  
1112
    def prepare(self):
1113
        return ["mkdir -p /etc/archip"]
1114

  
1115
    def configure(self):
1116
        return [
1117
            ("/etc/archip/pithos.conf.py", {}, {})
1118
            ]
1119

  
1120
    def initialize(self):
1121
        return [
1122
            "archipelago start"
1123
            ]
1124

  
1125
    def restart(self):
1126
        return [
1127
            "/etc/init.d/archipelago restart"
1128
            ]
1129

  
1130

  
1131
class ArchipGaneti(SynnefoComponent):
1132
    REQUIRED_PACKAGES = [
1133
        "archipelago-ganeti",
1134
        ]
b/snf-deploy/snfdeploy/roles.py
39 39
    "mq": [HW, SSH, DNS, APT, MQ],
40 40
    "nfs": [HW, SSH, DNS, APT, NFS],
41 41
    "astakos": [HW, SSH, DNS, APT, Apache, Gunicorn, Common, WEB, Astakos],
42
    "pithos": [HW, SSH, DNS, APT, Apache, Gunicorn, Common, WEB, Pithos],
42
    "pithos": [
43
        HW, SSH, DNS, APT, Apache,
44
        Gunicorn, Common, WEB, Pithos, Archip
45
        ],
43 46
    "cyclades": [
44 47
        HW, SSH, DNS, APT,
45
        Apache, Gunicorn, Common, WEB, Cyclades, VNC
48
        Apache, Gunicorn, Common, WEB, Cyclades, VNC, Archip
46 49
        ],
47 50
    "cms": [HW, SSH, DNS, APT, Apache, Gunicorn, Common, WEB, CMS],
48 51
    "stats": [
......
52 55
    "client": [HW, SSH, DNS, APT, Kamaki, Burnin],
53 56
    "ganeti": [
54 57
        HW, SSH, DNS, DDNS, APT, Mount,
55
        Ganeti, Image, Network, GTools, GanetiCollectd
58
        Ganeti, Image, Network, GTools, GanetiCollectd,
59
        Archip, ArchipGaneti
56 60
        ],
57 61
    "master": [
58 62
        HW, SSH, DNS, DDNS, APT, Mount,
59
        Ganeti, Master, Image, Network, GTools, GanetiCollectd
63
        Ganeti, Master, Image, Network, GTools, GanetiCollectd,
64
        Archip, ArchipGaneti
60 65
        ],
61 66
    }
62 67

  

Also available in: Unified diff