Revision 458f92b3

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/snfdeploy/components.py
779 779

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

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

  
......
813 815
        return [
814 816
            "mkdir -p %s" % self.env.env.image_dir,
815 817
            "mkdir -p %s/data" % p,
818
            "mkdir -p /srv/archip/blocks",
819
            "mkdir -p /srv/archip/maps",
816 820
            "chown www-data.www-data %s/data" % p,
817 821
            "chmod g+ws %s/data" % p,
818 822
            ] + self.prepare_image()
......
822 826
cat >> /etc/exports <<EOF
823 827
{0} {2}(rw,async,no_subtree_check,no_root_squash)
824 828
{1} {2}(rw,async,no_subtree_check,no_root_squash)
829
/srv/archip {2}(rw,async,no_subtree_check,no_root_squash)
825 830
EOF
826 831
""".format(self.env.env.pithos_dir, self.env.env.image_dir, node_info.ip)
827 832
        return [cmd] + self.restart()
......
1109 1114
            ("/etc/collectd/passwd", {}, {}),
1110 1115
            ("/etc/collectd/synnefo-ganeti.conf", r1, {}),
1111 1116
            ]
1117

  
1118

  
1119
class Archip(SynnefoComponent):
1120
    REQUIRED_PACKAGES = [
1121
        "librados2",
1122
        "archipelago",
1123
        "archipelago-dbg",
1124
        "archipelago-modules-dkms",
1125
        "archipelago-modules-source",
1126
        "archipelago-rados",
1127
        "archipelago-rados-dbg",
1128
        "libxseg0",
1129
        "libxseg0-dbg",
1130
        "python-archipelago",
1131
        "python-xseg",
1132
        ]
1133

  
1134
    def prepare(self):
1135
        return ["mkdir -p /etc/archip"]
1136

  
1137
    def configure(self):
1138
        return [
1139
            ("/etc/archip/pithos.conf.py", {}, {})
1140
            ]
1141

  
1142
    def initialize(self):
1143
        return [
1144
            "archipelago start"
1145
            ]
1146

  
1147
    def restart(self):
1148
        return [
1149
            "/etc/init.d/archipelago restart"
1150
            ]
1151

  
1152

  
1153
class ArchipGaneti(SynnefoComponent):
1154
    REQUIRED_PACKAGES = [
1155
        "archipelago-ganeti",
1156
        ]
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