Example #1
0
    def config_rsync(self):
        config = """
uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = {0}

[account]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/lock/account.lock

[container]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/lock/container.lock

[object]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/lock/object.lock
""".format(util.get_ip())
        with open('/etc/rsyncd.conf', 'w') as f:
            f.write(config)
Example #2
0
 def create_rings(self):
     replicas = CONF["CONFIG_SWIFT_STORAGE_REPLICAS"]
     ip = util.get_ip()
     for ringtype, port in [("object", "6000"), ("container", "6001"), ("account", 6002)]:
         cmd = "swift-ring-builder {0}.builder create 10 {1} 1".format(ringtype, replicas)
         util.run_command(cmd)
         for device in self._devices:
             cmd = (
                 "swift-ring-builder %s.builder add --region 1 "
                 "--zone %s --ip %s --port %s --device %s --weight 100"
                 % (ringtype, device["zone"], ip, port, device["name"])
             )
             util.run_command(cmd)
         cmd = "swift-ring-builder {0}.builder rebalance".format(ringtype)
         util.run_command(cmd)
         if os.path.isfile("/etc/swift/%s.ring.gz" % ringtype):
             os.remove("/etc/swift/%s.ring.gz" % ringtype)
         shutil.move("%s.ring.gz" % ringtype, "/etc/swift")
Example #3
0
 def create_rings(self):
     replicas = CONF['CONFIG_SWIFT_STORAGE_REPLICAS']
     ip = util.get_ip()
     for ringtype, port in [('object', '6000'),
                            ('container', '6001'),
                            ('account', 6002)]:
         LOG.debug("creating '{0}' ring with {1} "
                   "replicas".format(ringtype, replicas))
         cmd = ("swift-ring-builder {0}.builder create 10 {1} 1"
                .format(ringtype, replicas))
         util.run_command(cmd)
         for device in self._devices:
             LOG.debug("adding '{0}' storage node on ring "
                       "'{1}'".format(device['name'], ringtype))
             cmd = ("swift-ring-builder %s.builder add --region 1 "
                    "--zone %s --ip %s --port %s --device %s --weight 100"
                    % (ringtype, device['zone'], ip, port, device['name']))
             util.run_command(cmd)
         LOG.debug("rebalancing ring '{0}'".format(ringtype))
         cmd = "swift-ring-builder {0}.builder rebalance".format(ringtype)
         util.run_command(cmd)
         if os.path.isfile("/etc/swift/%s.ring.gz" % ringtype):
             os.remove("/etc/swift/%s.ring.gz" % ringtype)
         shutil.move("%s.ring.gz" % ringtype, "/etc/swift")