[glusterfs] preliminary 3.3.1-2 Synchronize with openstack-swift-1.4.8 packaging changes, including systemd .ser

Kaleb S. KEITHLEY kkeithle at fedoraproject.org
Wed Oct 31 16:01:53 UTC 2012


commit eaf4a0f2e246d2a732b7939049c731897baf6d39
Author: Kaleb S. KEITHLEY <kkeithle at redhat.com>
Date:   Wed Oct 31 12:00:44 2012 -0400

    preliminary 3.3.1-2
    Synchronize with openstack-swift-1.4.8 packaging changes, including
    systemd .service files and align with the matching sets of patches

 .gitignore                                         |    1 +
 ...pickle-for-serialization-in-memcache-but-.patch |  351 ++++++++++++++++++++
 ...bug-where-serialization_format-is-ignored.patch |   70 ++++
 gluster-swift-account.service                      |   11 +
 gluster-swift-account at .service                     |   11 +
 gluster-swift-container.service                    |   11 +
 gluster-swift-container at .service                   |   11 +
 gluster-swift-object.service                       |   11 +
 gluster-swift-object at .service                      |   11 +
 gluster-swift-proxy.service                        |   11 +
 gluster-swift.tmpfs                                |    6 +
 glusterfs.spec                                     |  140 ++++++---
 12 files changed, 599 insertions(+), 46 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 0d23fb7..0aaa0b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@ glusterfs-3.2.7.tar.gz
 glusterfs-3.3.0.tar.gz
 glusterfs-3.3.1.tar.gz
 swift-1.4.8.tar.gz
+*.src.rpm
diff --git a/0001-Do-not-use-pickle-for-serialization-in-memcache-but-.patch b/0001-Do-not-use-pickle-for-serialization-in-memcache-but-.patch
new file mode 100644
index 0000000..6179ced
--- /dev/null
+++ b/0001-Do-not-use-pickle-for-serialization-in-memcache-but-.patch
@@ -0,0 +1,351 @@
+From c0619bd0c5eeb3d2f8af8b37575e11847664272c Mon Sep 17 00:00:00 2001
+From: Vincent Untz <vuntz at suse.com>
+Date: Thu, 21 Jun 2012 14:37:41 +0200
+Subject: [PATCH] Do not use pickle for serialization in memcache, but JSON
+
+We don't want to use pickle as it can execute arbitrary code. JSON is
+safer. However, note that it supports serialization for only some
+specific subset of object types; this should be enough for what we need,
+though.
+
+To avoid issues on upgrades (unability to read pickled values, and cache
+poisoning for old servers not understanding JSON), we add a
+memcache_serialization_support configuration option, with the following
+values:
+
+ 0 = older, insecure pickle serialization (compatible, default in this release)
+ 1 = json serialization but pickles can still be read (still insecure)
+ 2 = json serialization only (secure, suggested, and the future default)
+
+To avoid an instant full cache flush, existing installations should
+upgrade with 0, then set to 1 and reload, then after some time (24
+hours) set to 2 and reload. Support for 0 and 1 will be removed in
+future versions.
+
+Part of bug 1006414.
+
+Patch Set 2: Added Vincent Untz <vuntz at suse.com> to AUTHORS
+
+Change-Id: Id7d6d547b103b4f23ebf5be98b88f09ec6027ce4
+---
+ doc/manpages/proxy-server.conf.5             |   15 ++++++++
+ etc/memcache.conf-sample                     |   10 +++++
+ etc/proxy-server.conf-sample                 |   12 ++++++
+ swift/common/memcached.py                    |   48 +++++++++++++++++++++-----
+ swift/common/middleware/memcache.py          |   30 ++++++++++++----
+ test/unit/common/middleware/test_memcache.py |    5 ++-
+ test/unit/common/test_memcached.py           |   22 ++++++++++++
+ 7 files changed, 125 insertions(+), 17 deletions(-)
+
+diff --git a/doc/manpages/proxy-server.conf.5 b/doc/manpages/proxy-server.conf.5
+index 4979e4d..5cf5a7e 100644
+--- a/doc/manpages/proxy-server.conf.5
++++ b/doc/manpages/proxy-server.conf.5
+@@ -205,6 +205,21 @@ Enables the ability to log request headers. The default is False.
+ .IP \fBmemcache_servers\fR
+ The memcache servers that are available. This can be a list separated by commas. The default 
+ is 127.0.0.1:11211.
++.IP \fBmemcache_serialization_support\fR
++This sets how memcache values are serialized and deserialized:
++.RE
++
++.PD 0
++.RS 10
++.IP "0 = older, insecure pickle serialization (default)"
++.IP "1 = json serialization but pickles can still be read (still insecure)"
++.IP "2 = json serialization only (secure)"
++.RE
++
++.RS 10
++To avoid an instant full cache flush, existing installations should upgrade with 0, then set to 1 and reload, then after some time (24 hours) set to 2 and reload. In the future, the ability to use pickle serialization will be removed.
++
++If not set in the configuration file, the value for memcache_serialization_support will be read from /etc/swift/memcache.conf if it exists (see memcache.conf-sample). Otherwise, the default value as indicated above will be used.
+ .RE
+ 
+ 
+diff --git a/etc/memcache.conf-sample b/etc/memcache.conf-sample
+index 580d94a..cedfc19 100644
+--- a/etc/memcache.conf-sample
++++ b/etc/memcache.conf-sample
+@@ -3,3 +3,13 @@
+ # several other conf files under [filter:cache] for example. You can specify
+ # multiple servers separated with commas, as in: 10.1.2.3:11211,10.1.2.4:11211
+ # memcache_servers = 127.0.0.1:11211
++#
++# Sets how memcache values are serialized and deserialized:
++# 0 = older, insecure pickle serialization (compatible, default in this release)
++# 1 = json serialization but pickles can still be read (still insecure)
++# 2 = json serialization only (secure, suggested, and the future default)
++# To avoid an instant full cache flush, existing installations should
++# upgrade with 0, then set to 1 and reload, then after some time (24 hours)
++# set to 2 and reload.
++# In the future, the ability to use pickle serialization will be removed.
++# memcache_serialization_support = 0
+diff --git a/etc/proxy-server.conf-sample b/etc/proxy-server.conf-sample
+index 148616b..18f711a 100644
+--- a/etc/proxy-server.conf-sample
++++ b/etc/proxy-server.conf-sample
+@@ -122,6 +122,18 @@ use = egg:swift#memcache
+ # default to the value below. You can specify multiple servers separated with
+ # commas, as in: 10.1.2.3:11211,10.1.2.4:11211
+ # memcache_servers = 127.0.0.1:11211
++#
++# Sets how memcache values are serialized and deserialized:
++# 0 = older, insecure pickle serialization (compatible, default in this release)
++# 1 = json serialization but pickles can still be read (still insecure)
++# 2 = json serialization only (secure, suggested, and the future default)
++# If not set here, the value for memcache_serialization_support will be read
++# from /etc/swift/memcache.conf (see memcache.conf-sample).
++# To avoid an instant full cache flush, existing installations should
++# upgrade with 0, then set to 1 and reload, then after some time (24 hours)
++# set to 2 and reload.
++# In the future, the ability to use pickle serialization will be removed.
++# memcache_serialization_support = 0
+ 
+ [filter:ratelimit]
+ use = egg:swift#ratelimit
+diff --git a/swift/common/memcached.py b/swift/common/memcached.py
+index ecd9332..82ebb7a 100644
+--- a/swift/common/memcached.py
++++ b/swift/common/memcached.py
+@@ -27,11 +27,17 @@ import time
+ from bisect import bisect
+ from hashlib import md5
+ 
++try:
++    import simplejson as json
++except ImportError:
++    import json
++
+ DEFAULT_MEMCACHED_PORT = 11211
+ 
+ CONN_TIMEOUT = 0.3
+ IO_TIMEOUT = 2.0
+ PICKLE_FLAG = 1
++JSON_FLAG = 2
+ NODE_WEIGHT = 50
+ PICKLE_PROTOCOL = 2
+ TRY_COUNT = 3
+@@ -57,7 +63,8 @@ class MemcacheRing(object):
+     """
+ 
+     def __init__(self, servers, connect_timeout=CONN_TIMEOUT,
+-                 io_timeout=IO_TIMEOUT, tries=TRY_COUNT):
++                 io_timeout=IO_TIMEOUT, tries=TRY_COUNT,
++                 allow_pickle=False, allow_unpickle=False):
+         self._ring = {}
+         self._errors = dict(((serv, []) for serv in servers))
+         self._error_limited = dict(((serv, 0) for serv in servers))
+@@ -69,6 +76,8 @@ class MemcacheRing(object):
+         self._client_cache = dict(((server, []) for server in servers))
+         self._connect_timeout = connect_timeout
+         self._io_timeout = io_timeout
++        self._allow_pickle = allow_pickle
++        self._allow_unpickle = allow_unpickle or allow_pickle
+ 
+     def _exception_occurred(self, server, e, action='talking'):
+         if isinstance(e, socket.timeout):
+@@ -130,16 +139,21 @@ class MemcacheRing(object):
+ 
+         :param key: key
+         :param value: value
+-        :param serialize: if True, value is pickled before sending to memcache
++        :param serialize: if True, value is serialized with JSON before sending
++                          to memcache, or with pickle if configured to use
++                          pickle instead of JSON (to avoid cache poisoning)
+         :param timeout: ttl in memcache
+         """
+         key = md5hash(key)
+         if timeout > 0:
+             timeout += time.time()
+         flags = 0
+-        if serialize:
++        if serialize and self._allow_pickle:
+             value = pickle.dumps(value, PICKLE_PROTOCOL)
+             flags |= PICKLE_FLAG
++        elif serialize:
++            value = json.dumps(value)
++            flags |= JSON_FLAG
+         for (server, fp, sock) in self._get_conns(key):
+             try:
+                 sock.sendall('set %s %d %d %s noreply\r\n%s\r\n' % \
+@@ -151,8 +165,9 @@ class MemcacheRing(object):
+ 
+     def get(self, key):
+         """
+-        Gets the object specified by key.  It will also unpickle the object
+-        before returning if it is pickled in memcache.
++        Gets the object specified by key.  It will also unserialize the object
++        before returning if it is serialized in memcache with JSON, or if it
++        is pickled and unpickling is allowed.
+ 
+         :param key: key
+         :returns: value of the key in memcache
+@@ -168,7 +183,12 @@ class MemcacheRing(object):
+                         size = int(line[3])
+                         value = fp.read(size)
+                         if int(line[2]) & PICKLE_FLAG:
+-                            value = pickle.loads(value)
++                            if self._allow_unpickle:
++                                value = pickle.loads(value)
++                            else:
++                                value = None
++                        elif int(line[2]) & JSON_FLAG:
++                            value = json.loads(value)
+                         fp.readline()
+                     line = fp.readline().strip().split()
+                 self._return_conn(server, fp, sock)
+@@ -258,7 +278,9 @@ class MemcacheRing(object):
+         :param mapping: dictonary of keys and values to be set in memcache
+         :param servery_key: key to use in determining which server in the ring
+                             is used
+-        :param serialize: if True, value is pickled before sending to memcache
++        :param serialize: if True, value is serialized with JSON before sending
++                          to memcache, or with pickle if configured to use
++                          pickle instead of JSON (to avoid cache poisoning)
+         :param timeout: ttl for memcache
+         """
+         server_key = md5hash(server_key)
+@@ -268,9 +290,12 @@ class MemcacheRing(object):
+         for key, value in mapping.iteritems():
+             key = md5hash(key)
+             flags = 0
+-            if serialize:
++            if serialize and self._allow_pickle:
+                 value = pickle.dumps(value, PICKLE_PROTOCOL)
+                 flags |= PICKLE_FLAG
++            elif serialize:
++                value = json.dumps(value)
++                flags |= JSON_FLAG
+             msg += ('set %s %d %d %s noreply\r\n%s\r\n' %
+                     (key, flags, timeout, len(value), value))
+         for (server, fp, sock) in self._get_conns(server_key):
+@@ -302,7 +327,12 @@ class MemcacheRing(object):
+                         size = int(line[3])
+                         value = fp.read(size)
+                         if int(line[2]) & PICKLE_FLAG:
+-                            value = pickle.loads(value)
++                            if self._allow_unpickle:
++                                value = pickle.loads(value)
++                            else:
++                                value = None
++                        elif int(line[2]) & JSON_FLAG:
++                            value = json.loads(value)
+                         responses[line[1]] = value
+                         fp.readline()
+                     line = fp.readline().strip().split()
+diff --git a/swift/common/middleware/memcache.py b/swift/common/middleware/memcache.py
+index eb988bd..20121c9 100644
+--- a/swift/common/middleware/memcache.py
++++ b/swift/common/middleware/memcache.py
+@@ -27,20 +27,36 @@ class MemcacheMiddleware(object):
+     def __init__(self, app, conf):
+         self.app = app
+         self.memcache_servers = conf.get('memcache_servers')
+-        if not self.memcache_servers:
++        serialization_format = conf.get('memcache_serialization_support')
++
++        if not self.memcache_servers or serialization_format is None:
+             path = os.path.join(conf.get('swift_dir', '/etc/swift'),
+                                 'memcache.conf')
+             memcache_conf = ConfigParser()
+             if memcache_conf.read(path):
+-                try:
+-                    self.memcache_servers = \
+-                        memcache_conf.get('memcache', 'memcache_servers')
+-                except (NoSectionError, NoOptionError):
+-                    pass
++                if not self.memcache_servers:
++                    try:
++                        self.memcache_servers = \
++                            memcache_conf.get('memcache', 'memcache_servers')
++                    except (NoSectionError, NoOptionError):
++                        pass
++                if serialization_format is None:
++                    try:
++                        serialization_format = \
++                            memcache_conf.get('memcache',
++                                              'memcache_serialization_support')
++                    except (NoSectionError, NoOptionError):
++                        pass
++
+         if not self.memcache_servers:
+             self.memcache_servers = '127.0.0.1:11211'
++        if serialization_format is None:
++            serialization_format = 0
++
+         self.memcache = MemcacheRing(
+-            [s.strip() for s in self.memcache_servers.split(',') if s.strip()])
++            [s.strip() for s in self.memcache_servers.split(',') if s.strip()],
++            allow_pickle=(serialization_format == 0),
++            allow_unpickle=(serialization_format <= 1))
+ 
+     def __call__(self, env, start_response):
+         env['swift.cache'] = self.memcache
+diff --git a/test/unit/common/middleware/test_memcache.py b/test/unit/common/middleware/test_memcache.py
+index 6b94bd1..e217a96 100644
+--- a/test/unit/common/middleware/test_memcache.py
++++ b/test/unit/common/middleware/test_memcache.py
+@@ -47,6 +47,8 @@ class SetConfigParser(object):
+         if section == 'memcache':
+             if option == 'memcache_servers':
+                 return '1.2.3.4:5'
++            elif option == 'memcache_serialization_support':
++                return '2'
+             else:
+                 raise NoOptionError(option)
+         else:
+@@ -86,7 +88,8 @@ class TestCacheMiddleware(unittest.TestCase):
+         exc = None
+         try:
+             app = memcache.MemcacheMiddleware(
+-                    FakeApp(), {'memcache_servers': '1.2.3.4:5'})
++                    FakeApp(), {'memcache_servers': '1.2.3.4:5',
++                                'memcache_serialization_support': '2'})
+         except Exception, err:
+             exc = err
+         finally:
+diff --git a/test/unit/common/test_memcached.py b/test/unit/common/test_memcached.py
+index dff6e80..3016d10 100644
+--- a/test/unit/common/test_memcached.py
++++ b/test/unit/common/test_memcached.py
+@@ -1,3 +1,4 @@
++ # -*- coding: utf8 -*-
+ # Copyright (c) 2010-2012 OpenStack, LLC.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License");
+@@ -166,6 +167,9 @@ class TestMemcached(unittest.TestCase):
+         self.assertEquals(memcache_client.get('some_key'), [1, 2, 3])
+         memcache_client.set('some_key', [4, 5, 6])
+         self.assertEquals(memcache_client.get('some_key'), [4, 5, 6])
++        memcache_client.set('some_key', ['simple str', 'utf8 str éà'])
++        # As per http://wiki.openstack.org/encoding, we should expect to have unicode
++        self.assertEquals(memcache_client.get('some_key'), ['simple str', u'utf8 str éà'])
+         self.assert_(float(mock.cache.values()[0][1]) == 0)
+         esttimeout = time.time() + 10
+         memcache_client.set('some_key', [1, 2, 3], timeout=10)
+@@ -244,6 +248,24 @@ class TestMemcached(unittest.TestCase):
+         self.assertEquals(memcache_client.get_multi(('some_key2', 'some_key1',
+             'not_exists'), 'multi_key'), [[4, 5, 6], [1, 2, 3], None])
+ 
++    def test_serialization(self):
++        memcache_client = memcached.MemcacheRing(['1.2.3.4:11211'],
++                                                 allow_pickle=True)
++        mock = MockMemcached()
++        memcache_client._client_cache['1.2.3.4:11211'] = [(mock, mock)] * 2
++        memcache_client.set('some_key', [1, 2, 3])
++        self.assertEquals(memcache_client.get('some_key'), [1, 2, 3])
++        memcache_client._allow_pickle = False
++        memcache_client._allow_unpickle = True
++        self.assertEquals(memcache_client.get('some_key'), [1, 2, 3])
++        memcache_client._allow_unpickle = False
++        self.assertEquals(memcache_client.get('some_key'), None)
++        memcache_client.set('some_key', [1, 2, 3])
++        self.assertEquals(memcache_client.get('some_key'), [1, 2, 3])
++        memcache_client._allow_unpickle = True
++        self.assertEquals(memcache_client.get('some_key'), [1, 2, 3])
++        memcache_client._allow_pickle = True
++        self.assertEquals(memcache_client.get('some_key'), [1, 2, 3])
+ 
+ if __name__ == '__main__':
+     unittest.main()
diff --git a/0002-Fix-bug-where-serialization_format-is-ignored.patch b/0002-Fix-bug-where-serialization_format-is-ignored.patch
new file mode 100644
index 0000000..4f7e4b4
--- /dev/null
+++ b/0002-Fix-bug-where-serialization_format-is-ignored.patch
@@ -0,0 +1,70 @@
+From c38568f026853f64f2669f03bd56441b007f13be Mon Sep 17 00:00:00 2001
+From: gholt <z-launchpad at brim.net>
+Date: Tue, 18 Sep 2012 18:24:47 +0000
+Subject: [PATCH] Fix bug where serialization_format is ignored
+
+Change-Id: I5a5ac8b5f18e077105ab12e9b1f0ccafac3983f7
+---
+ swift/common/middleware/memcache.py          |    2 ++
+ test/unit/common/middleware/test_memcache.py |   12 ++++++++++--
+ 2 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/swift/common/middleware/memcache.py b/swift/common/middleware/memcache.py
+index 20121c9..06678c4 100644
+--- a/swift/common/middleware/memcache.py
++++ b/swift/common/middleware/memcache.py
+@@ -52,6 +52,8 @@ class MemcacheMiddleware(object):
+             self.memcache_servers = '127.0.0.1:11211'
+         if serialization_format is None:
+             serialization_format = 0
++        else:
++            serialization_format = int(serialization_format)
+ 
+         self.memcache = MemcacheRing(
+             [s.strip() for s in self.memcache_servers.split(',') if s.strip()],
+diff --git a/test/unit/common/middleware/test_memcache.py b/test/unit/common/middleware/test_memcache.py
+index e217a96..28c7b13 100644
+--- a/test/unit/common/middleware/test_memcache.py
++++ b/test/unit/common/middleware/test_memcache.py
+@@ -48,7 +48,7 @@ class SetConfigParser(object):
+             if option == 'memcache_servers':
+                 return '1.2.3.4:5'
+             elif option == 'memcache_serialization_support':
+-                return '2'
++                return '1'
+             else:
+                 raise NoOptionError(option)
+         else:
+@@ -104,6 +104,8 @@ class TestCacheMiddleware(unittest.TestCase):
+         finally:
+             memcache.ConfigParser = orig_parser
+         self.assertEquals(app.memcache_servers, '127.0.0.1:11211')
++        self.assertEquals(app.memcache._allow_pickle, True)
++        self.assertEquals(app.memcache._allow_unpickle, True)
+ 
+     def test_conf_from_extra_conf(self):
+         orig_parser = memcache.ConfigParser
+@@ -113,16 +115,22 @@ class TestCacheMiddleware(unittest.TestCase):
+         finally:
+             memcache.ConfigParser = orig_parser
+         self.assertEquals(app.memcache_servers, '1.2.3.4:5')
++        self.assertEquals(app.memcache._allow_pickle, False)
++        self.assertEquals(app.memcache._allow_unpickle, True)
+ 
+     def test_conf_from_inline_conf(self):
+         orig_parser = memcache.ConfigParser
+         memcache.ConfigParser = SetConfigParser
+         try:
+             app = memcache.MemcacheMiddleware(
+-                    FakeApp(), {'memcache_servers': '6.7.8.9:10'})
++                    FakeApp(),
++                    {'memcache_servers': '6.7.8.9:10',
++                     'serialization_format': '0'})
+         finally:
+             memcache.ConfigParser = orig_parser
+         self.assertEquals(app.memcache_servers, '6.7.8.9:10')
++        self.assertEquals(app.memcache._allow_pickle, False)
++        self.assertEquals(app.memcache._allow_unpickle, True)
+ 
+ 
+ if __name__ == '__main__':
diff --git a/gluster-swift-account.service b/gluster-swift-account.service
new file mode 100644
index 0000000..782b06a
--- /dev/null
+++ b/gluster-swift-account.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=OpenStack Object Storage (swift) - Account Server
+After=syslog.target network.target
+
+[Service]
+Type=simple
+User=swift
+ExecStart=/usr/bin/swift-account-server /etc/swift/account-server.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/gluster-swift-account at .service b/gluster-swift-account at .service
new file mode 100644
index 0000000..cae48c7
--- /dev/null
+++ b/gluster-swift-account at .service
@@ -0,0 +1,11 @@
+[Unit]
+Description=OpenStack Object Storage (swift) - Account Server instance %I
+After=syslog.target network.target
+
+[Service]
+Type=simple
+User=swift
+ExecStart=/usr/bin/swift-account-server /etc/swift/account-server/%i.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/gluster-swift-container.service b/gluster-swift-container.service
new file mode 100644
index 0000000..6db2b51
--- /dev/null
+++ b/gluster-swift-container.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=OpenStack Object Storage (swift) - Container Server
+After=syslog.target network.target
+
+[Service]
+Type=simple
+User=swift
+ExecStart=/usr/bin/swift-container-server /etc/swift/container-server.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/gluster-swift-container at .service b/gluster-swift-container at .service
new file mode 100644
index 0000000..4f51e3f
--- /dev/null
+++ b/gluster-swift-container at .service
@@ -0,0 +1,11 @@
+[Unit]
+Description=OpenStack Object Storage (swift) - Container Server instance %I
+After=syslog.target network.target
+
+[Service]
+Type=simple
+User=swift
+ExecStart=/usr/bin/swift-container-server /etc/swift/container-server/%i.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/gluster-swift-object.service b/gluster-swift-object.service
new file mode 100644
index 0000000..1cd5020
--- /dev/null
+++ b/gluster-swift-object.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=OpenStack Object Storage (swift) - Object Server
+After=syslog.target network.target
+
+[Service]
+Type=simple
+User=swift
+ExecStart=/usr/bin/swift-object-server /etc/swift/object-server.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/gluster-swift-object at .service b/gluster-swift-object at .service
new file mode 100644
index 0000000..172e322
--- /dev/null
+++ b/gluster-swift-object at .service
@@ -0,0 +1,11 @@
+[Unit]
+Description=OpenStack Object Storage (swift) - Object Server instance %I
+After=syslog.target network.target
+
+[Service]
+Type=simple
+User=swift
+ExecStart=/usr/bin/swift-object-server /etc/swift/object-server/%i.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/gluster-swift-proxy.service b/gluster-swift-proxy.service
new file mode 100644
index 0000000..4078f50
--- /dev/null
+++ b/gluster-swift-proxy.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=OpenStack Object Storage (swift) - Proxy Server
+After=syslog.target network.target
+
+[Service]
+Type=simple
+User=swift
+ExecStart=/usr/bin/swift-proxy-server /etc/swift/proxy-server.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/gluster-swift.tmpfs b/gluster-swift.tmpfs
new file mode 100644
index 0000000..8f4f5a5
--- /dev/null
+++ b/gluster-swift.tmpfs
@@ -0,0 +1,6 @@
+# swift needs a couple of directories in /var/run
+d /var/run/swift 0755 swift root
+d /var/run/swift/account-server 0755 swift root
+d /var/run/swift/container-server 0755 swift root
+d /var/run/swift/object-server 0755 swift root
+d /var/run/swift/proxy-server 0755 swift root
diff --git a/glusterfs.spec b/glusterfs.spec
index 58fd8f5..fd9b606 100644
--- a/glusterfs.spec
+++ b/glusterfs.spec
@@ -32,7 +32,7 @@
 Summary:          Cluster File System
 Name:             glusterfs
 Version:          3.3.1
-Release:          1%{?dist}
+Release:          2%{?dist}
 License:          GPLv3+ and (GPLv2 or LGPLv3+)
 Group:            System Environment/Base
 Vendor:           Red Hat
@@ -62,8 +62,7 @@ Requires(postun): systemd-units
 %define _init_restart() /bin/systemctl try-restart %1.service ;
 %define _init_stop()    /bin/systemctl stop %1.service ;
 %define _init_install() %{__install} -D -p -m 0644 %{1} %{buildroot}%{_unitdir}/%{2}.service ;
-%define _init_file1     %{_unitdir}/glusterd.service
-%define _init_file2     %{_unitdir}/glusterfsd.service
+%define _init_file()    %{_unitdir}/%{1}.service
 %else
 Source7:          glusterd.init
 Source8:          glusterfsd.init
@@ -76,8 +75,7 @@ Requires(postun): /sbin/service
 %define _init_restart() /sbin/service %1 condrestart &>/dev/null ;
 %define _init_stop()    /sbin/service %1 stop &>/dev/null ;
 %define _init_install() %{__install} -D -p -m 0755 %{1} %{buildroot}%{_sysconfdir}/init.d/%{2} ;
-%define _init_file1     %{_sysconfdir}/init.d/glusterd
-%define _init_file2     %{_sysconfdir}/init.d/glusterfsd
+%define _init_file()    %{_sysconfdir}/init.d/%{1}
 %endif
 
 BuildRequires:    bison flex
@@ -216,15 +214,30 @@ License:          ASL 2.0
 BuildArch:        noarch
 
 Source10:         http://launchpad.net/swift/essex/%{SWIFTVER}/+download/swift-%{SWIFTVER}.tar.gz
-Source11:         gluster-swift-functions
-Source12:         gluster-swift-account.init
-Source13:         gluster-swift-container.init
-Source14:         gluster-swift-object.init
-Source15:         gluster-swift-proxy.init
-Patch10:          openstack-swift-newdeps.patch
-Patch11:          openstack-swift-docmod.patch
-Patch12:          openstack-swift-nonet.patch
-Patch13:          glusterfs-3.3.0.swift.patch
+%if 0%{?_with_systemd:1}
+Source11:         gluster-swift-account.service
+Source12:         gluster-swift-account at .service
+Source13:         gluster-swift-container.service
+Source14:         gluster-swift-container at .service
+Source15:         gluster-swift-object.service
+Source16:         gluster-swift-object at .service
+Source17:         gluster-swift-proxy.service
+Source19:         gluster-swift.tmpfs
+%else
+Source11:         gluster-swift-account.init
+Source12:         gluster-swift-container.init
+Source13:         gluster-swift-object.init
+Source14:         gluster-swift-proxy.init
+Source18:         gluster-swift-functions
+%endif
+Patch10:          0001-Do-not-use-pickle-for-serialization-in-memcache-but-.patch
+Patch11:          0002-Fix-bug-where-serialization_format-is-ignored.patch
+%if ( 0%{?rhel} && 0%{?rhel} < 7 )
+Patch12:          openstack-swift-newdeps.patch
+Patch13:          openstack-swift-docmod.patch
+Patch14:          openstack-swift-nonet.patch
+%endif
+Patch15:          glusterfs-3.3.0.swift.patch
 #BuildRoot:        %(mktemp -ud %{_tmppath}/swift-%{SWIFTVER}-%{release}-XXXXXX)
 
 BuildRequires:    dos2unix
@@ -374,8 +387,12 @@ storage costs.
 cd swift-%{SWIFTVER}
 %patch10 -p1
 %patch11 -p1
+%if ( 0%{?rhel} && 0%{?rhel} < 7 )
 %patch12 -p1
 %patch13 -p1
+%patch14 -p1
+%endif
+%patch15 -p1
 dos2unix LICENSE
 %endif
 
@@ -499,13 +516,27 @@ touch %{buildroot}%{_sharedstatedir}/glusterd/glusterd.info
 %if 0%{?_with_swift:1}
 cd swift-%{SWIFTVER}
 %{__python} setup.py install -O1 --skip-build --root %{buildroot}
-# Init helper functions
-%{__install} -p -D -m 644 %{SOURCE11} %{buildroot}%{_datarootdir}/gluster-swift/functions
+%if 0%{?_with_systemd:1}
+# systemd .service files
+%_init_install %{SOURCE11} gluster-swift-account
+%_init_install %{SOURCE12} gluster-swift-account@
+%_init_install %{SOURCE13} gluster-swift-container
+%_init_install %{SOURCE14} gluster-swift-container@
+%_init_install %{SOURCE15} gluster-swift-object
+%_init_install %{SOURCE16} gluster-swift-object@
+%_init_install %{SOURCE17} gluster-swift-proxy
+# tmpfs conf
+%{__mkdir_p} %{buildroot}%{_sysconfdir}/tmpfiles.d
+install -p -m 0644 %{SOURCE19} %{buildroot}%{_sysconfdir}/tmpfiles.d/gluster-swift.conf
+%else
 # Init scripts
-%{__install} -p -D -m 755 %{SOURCE12} %{buildroot}%{_initrddir}/gluster-swift-account
-%{__install} -p -D -m 755 %{SOURCE13} %{buildroot}%{_initrddir}/gluster-swift-container
-%{__install} -p -D -m 755 %{SOURCE14} %{buildroot}%{_initrddir}/gluster-swift-object
-%{__install} -p -D -m 755 %{SOURCE15} %{buildroot}%{_initrddir}/gluster-swift-proxy
+%_init_install %{SOURCE11} gluster-swift-account
+%_init_install %{SOURCE12} gluster-swift-container
+%_init_install %{SOURCE13} gluster-swift-object
+%_init_install %{SOURCE14} gluster-swift-proxy
+# Init helper functions
+%{__install} -p -D -m 644 %{SOURCE18} %{buildroot}%{_datarootdir}/gluster-swift/functions
+%endif
 # Remove tests
 %{__rm} -rf %{buildroot}/%{python_sitelib}/test
 # Misc other
@@ -522,8 +553,8 @@ cd swift-%{SWIFTVER}
 %{__install} -d -m 755 %{buildroot}%{_localstatedir}/run/swift/proxy-server
 cd ..
 
-%{__mkdir -p} %{buildroot}%{python_sitelib}/swift/plugins
-#%{__mkdir -p} %{buildroot}%{_sysconfdir}/swift
+%{__mkdir_p} %{buildroot}%{python_sitelib}/swift/plugins
+#%{__mkdir_p} %{buildroot}%{_sysconfdir}/swift
 cd plugins
 %{__install} -p -D -m 755 constraints.py %{buildroot}%{python_sitelib}/swift/plugins
 %{__install} -p -D -m 755 DiskDir.py %{buildroot}%{python_sitelib}/swift/plugins
@@ -610,8 +641,8 @@ fi
 # Legacy configs
 %config(noreplace) %{_sysconfdir}/logrotate.d/glusterfsd
 %config(noreplace) %{_sysconfdir}/sysconfig/glusterfsd
-%_init_file1
-%_init_file2
+%_init_file glusterd
+%_init_file glusterfsd
 %{_sbindir}/gluster
 %{_sbindir}/glusterd
 %{_libdir}/glusterfs/%{version}/xlator/storage*
@@ -668,7 +699,11 @@ fi
 %doc swift-%{SWIFTVER}/etc/drive-audit.conf-sample
 %doc swift-%{SWIFTVER}/etc/object-expirer.conf-sample
 %doc swift-%{SWIFTVER}/etc/swift.conf-sample
+%if 0%{?_with_systemd:1}
+%config(noreplace) %{_sysconfdir}/tmpfiles.d/gluster-swift.conf
+%else
 %dir %{_datarootdir}/gluster-swift/functions
+%endif
 %dir %attr(0755, swift, swift) %{_localstatedir}/run/swift
 %dir %{_sysconfdir}/swift
 %dir %{python_sitelib}/swift
@@ -694,7 +729,10 @@ fi
 %files swift-account
 %defattr(-,root,root,-)
 %doc swift-%{SWIFTVER}/etc/account-server.conf-sample
-%dir %{_initrddir}/gluster-swift-account
+%_init_file gluster-swift-account
+%if 0%{?_with_systemd:1}
+%_init_file gluster-swift-account@
+%endif
 %dir %attr(0755, swift, swift) %{_localstatedir}/run/swift/account-server
 %dir %{_sysconfdir}/swift/account-server
 %{_bindir}/swift-account-auditor
@@ -706,7 +744,10 @@ fi
 %files swift-container
 %defattr(-,root,root,-)
 %doc swift-%{SWIFTVER}/etc/container-server.conf-sample
-%dir %{_initrddir}/gluster-swift-container
+%_init_file gluster-swift-container
+%if 0%{?_with_systemd:1}
+%_init_file gluster-swift-container@
+%endif
 %dir %attr(0755, swift, swift) %{_localstatedir}/run/swift/container-server
 %dir %{_sysconfdir}/swift/container-server
 %{_bindir}/swift-container-auditor
@@ -720,7 +761,10 @@ fi
 %defattr(-,root,root,-)
 %doc swift-%{SWIFTVER}/etc/object-server.conf-sample
 %doc swift-%{SWIFTVER}/etc/rsyncd.conf-sample
-%dir %{_initrddir}/gluster-swift-object
+%_init_file gluster-swift-object
+%if 0%{?_with_systemd:1}
+%_init_file gluster-swift-object@
+%endif
 %dir %attr(0755, swift, swift) %{_localstatedir}/run/swift/object-server
 %dir %{_sysconfdir}/swift/object-server
 %{_bindir}/swift-object-auditor
@@ -733,7 +777,7 @@ fi
 %files swift-proxy
 %defattr(-,root,root,-)
 %doc swift-%{SWIFTVER}/etc/proxy-server.conf-sample
-%dir %{_initrddir}/gluster-swift-proxy
+%_init_file gluster-swift-proxy
 %dir %attr(0755, swift, swift) %{_localstatedir}/run/swift/proxy-server
 %dir %{_sysconfdir}/swift/proxy-server
 %{_bindir}/swift-proxy-server
@@ -831,19 +875,19 @@ fi
 
 
 %post swift-account
-/sbin/chkconfig --add gluster-swift-account
+%_init_enable gluster-swift-account
 
 
 %preun swift-account
 if [ $1 = 0 ] ; then
-    /sbin/service gluster-swift-account stop >/dev/null 2>&1
-    /sbin/chkconfig --del gluster-swift-account
+    %_init_stop gluster-swift-account
+    %_init_disable gluster-swift-account
 fi
 
 
 %postun swift-account
 if [ "$1" -ge "1" ] ; then
-    /sbin/service gluster-swift-account condrestart >/dev/null 2>&1 || :
+    %_init_restart gluster-swift-account
 fi
 
 
@@ -856,19 +900,19 @@ fi
 
 
 %post swift-container
-/sbin/chkconfig --add gluster-swift-container
+%_init_enable gluster-swift-container
 
 
 %preun swift-container
 if [ $1 = 0 ] ; then
-    /sbin/service gluster-swift-container stop >/dev/null 2>&1
-    /sbin/chkconfig --del gluster-swift-container
+    %_init_stop gluster-swift-container
+    %_init_disable gluster-swift-container
 fi
 
 
 %postun swift-container
 if [ "$1" -ge "1" ] ; then
-    /sbin/service gluster-swift-container condrestart >/dev/null 2>&1 || :
+    %_init_restart gluster-swift-container
 fi
 
 
@@ -881,19 +925,19 @@ fi
 
 
 %post swift-object
-/sbin/chkconfig --add gluster-swift-object
+%_init_enable gluster-swift-object
 
 
 %preun swift-object
 if [ $1 = 0 ] ; then
-    /sbin/service gluster-swift-object stop >/dev/null 2>&1
-    /sbin/chkconfig --del gluster-swift-object
+    %_init_stop gluster-swift-object
+    %_init_disable gluster-swift-object
 fi
 
 
 %postun swift-object
 if [ "$1" -ge "1" ] ; then
-    /sbin/service gluster-swift-object condrestart >/dev/null 2>&1 || :
+    %_init_restart gluster-swift-object
 fi
 
 
@@ -906,24 +950,28 @@ fi
 
 
 %post swift-proxy
-/sbin/chkconfig --add gluster-swift-proxy
+%_init_enable gluster-swift-proxy
 
 
 %preun swift-proxy
 if [ $1 = 0 ] ; then
-    /sbin/service gluster-swift-proxy stop >/dev/null 2>&1
-    /sbin/chkconfig --del gluster-swift-proxy
+    %_init_stop gluster-swift-proxy
+    %_init_disable gluster-swift-proxy
 fi
 
 
 %postun swift-proxy
 if [ "$1" -ge "1" ] ; then
-    /sbin/service gluster-swift-proxy condrestart >/dev/null 2>&1 || :
+    %_init_restart gluster-swift-proxy
 fi
 %endif
 
 
 %changelog
+* Wed Oct 31 2012 Kaleb S. KEITHLEY <kkeithle[at]redhat.com> - 3.3.1-2
+- Synchronize with openstack-swift-1.4.8 packaging changes, including
+  systemd .service files and align with the matching sets of patches 
+
 * Mon Oct 11 2012 Kaleb S. KEITHLEY <kkeithle[at]redhat.com> - 3.3.1-1
 - GlusterFS-3.3.1
 - save swift .conf files correctly during upgrade
@@ -947,8 +995,8 @@ fi
 * Wed Sep 7 2012 Kaleb S. KEITHLEY <kkeithle[at]redhat.com> - 3.3.0-6
 - glusterfs.spec cleanup
 
--* Mon Aug 27 2012 Kaleb S. KEITHLEY <kkeithle[at]redhat.com> - 3.2.7-2
--- fix SEGV in glusterd-rpc-ops.c, BZ 837684, f17 only.
+* Mon Aug 27 2012 Kaleb S. KEITHLEY <kkeithle[at]redhat.com> - 3.2.7-2
+- fix SEGV in glusterd-rpc-ops.c, BZ 837684, f17 only.
 
 * Wed Aug 12 2012 Kaleb S. KEITHLEY <kkeithle[at]redhat.com> - 3.3.0-5
 - now with UFO (openstack-swift) except on el5


More information about the scm-commits mailing list