Exemple #1
0
 def device_def(dev_type, host, dev_port, devicename, zone):
     # device host has to be IP address
     host = utils.force_ip(host)
     fmt = ('\n@@%s { "%s:%s/%s":\n'
            '  zone   => %s,\n'
            '  weight => 10, }\n')
     return fmt % (dev_type, host, dev_port, devicename, zone)
Exemple #2
0
def create_builder_manifest(config, messages):
    global devices
    devices = parse_devices(config)
    # The ring file should be built and distributed before the storage services
    # come up. Specifically the replicator crashes if the ring isn't present

    def device_def(dev_type, host, dev_port, devicename, zone):
        # device host has to be IP address
        host = utils.force_ip(host)
        fmt = ('\n@@%s { "%s:%s/%s":\n'
               '  zone   => %s,\n'
               '  weight => 10, }\n')
        return fmt % (dev_type, host, dev_port, devicename, zone)

    # Add each device to the ring
    devicename = 0
    for configkey, dev_type, dev_port in (
        [('SWIFT_RING_OBJECT_DEVICES', 'ring_object_device', 6000),
         ('SWIFT_RING_CONTAINER_DEVICES', 'ring_container_device', 6001),
         ('SWIFT_RING_ACCOUNT_DEVICES', 'ring_account_device', 6002)]):
        swift_dev_details = dict()
        host = utils.force_ip(config['CONFIG_STORAGE_HOST_URL'])
        fstype = config["CONFIG_SWIFT_STORAGE_FSTYPE"]
        for device in devices:
            devicename = device['device_name']
            key = "dev_%s_%s" % (host, devicename)
            swift_dev_details.setdefault(key, {})
            zone = device['zone']
            swift_dev_details[key]['name'] = "%s:%s/%s" % (host, dev_port,
                                                           devicename)
            swift_dev_details[key]['weight'] = "%s" % 10
            swift_dev_details[key]['zone'] = "%s" % zone
        config[configkey] = swift_dev_details
Exemple #3
0
 def device_def(dev_type, host, dev_port, devicename, zone):
     # device host has to be IP address
     host = utils.force_ip(host)
     fmt = ('\n@@%s { "%s:%s/%s":\n'
            '  zone   => %s,\n'
            '  weight => 10, }\n')
     return fmt % (dev_type, host, dev_port, devicename, zone)
Exemple #4
0
def create_builder_manifest(config, messages):
    global devices
    devices = parse_devices(config)
    # The ring file should be built and distributed before the storage services
    # come up. Specifically the replicator crashes if the ring isn't present

    def device_def(dev_type, host, dev_port, devicename, zone):
        # device host has to be IP address
        host = utils.force_ip(host)
        fmt = ('\n@@%s { "%s:%s/%s":\n'
               '  zone   => %s,\n'
               '  weight => 10, }\n')
        return fmt % (dev_type, host, dev_port, devicename, zone)

    # Add each device to the ring
    devicename = 0
    for configkey, dev_type, dev_port in (
        [('SWIFT_RING_OBJECT_DEVICES', 'ring_object_device', 6000),
         ('SWIFT_RING_CONTAINER_DEVICES', 'ring_container_device', 6001),
         ('SWIFT_RING_ACCOUNT_DEVICES', 'ring_account_device', 6002)]):
        swift_dev_details = dict()
        host = utils.force_ip(config['CONFIG_STORAGE_HOST_URL'])
        fstype = config["CONFIG_SWIFT_STORAGE_FSTYPE"]
        for device in devices:
            devicename = device['device_name']
            key = "dev_%s_%s" % (host, devicename)
            swift_dev_details.setdefault(key, {})
            zone = device['zone']
            swift_dev_details[key]['name'] = "%s:%s/%s" % (host, dev_port,
                                                           devicename)
            swift_dev_details[key]['weight'] = "%s" % 10
            swift_dev_details[key]['zone'] = "%s" % zone
        config[configkey] = swift_dev_details
Exemple #5
0
def create_storage_manifest(config, messages):
    global devices

    devicename = 0
    swift_dev_details = dict()
    host = utils.force_ip(config['CONFIG_STORAGE_HOST_URL'])
    fstype = config["CONFIG_SWIFT_STORAGE_FSTYPE"]

    # this need to happen once per storage device
    for device in devices:
        if device['device'] is None:
            config['CONFIG_SWIFT_STORAGE_SEEK'] = get_storage_size(config)
        else:
            devicename = device['device_name']
            devicedev = device['device']
            key = "dev_%s_%s" % (host, devicename)
            swift_dev_details.setdefault(key, {})
            swift_dev_details[key]['device'] = "%s" % devicename
            swift_dev_details[key]['dev'] = "%s" % devicedev
            swift_dev_details[key]['fstype'] = "%s" % fstype
    config['CONFIG_SWIFT_STORAGE_DEVICES'] = swift_dev_details

    # set allowed hosts for firewall
    hosts = set([config['CONFIG_STORAGE_HOST']])
    if config['CONFIG_NOVA_INSTALL'] == 'y':
        hosts |= split_hosts(config['CONFIG_COMPUTE_HOSTS'])

    fw_details = dict()
    for host in hosts:
        key = "swift_storage_and_rsync_%s" % host
        fw_details.setdefault(key, {})
        fw_details[key]['host'] = "%s" % host
        fw_details[key]['service_name'] = "swift storage and rsync"
        fw_details[key]['chain'] = "INPUT"
        fw_details[key]['ports'] = ['6000', '6001', '6002', '873']
        fw_details[key]['proto'] = "tcp"
    config['FIREWALL_SWIFT_STORAGE_RULES'] = fw_details
Exemple #6
0
def create_storage_manifest(config, messages):
    global devices

    devicename = 0
    swift_dev_details = dict()
    host = utils.force_ip(config['CONFIG_STORAGE_HOST_URL'])
    fstype = config["CONFIG_SWIFT_STORAGE_FSTYPE"]

    # this need to happen once per storage device
    for device in devices:
        if device['device'] is None:
            config['CONFIG_SWIFT_STORAGE_SEEK'] = get_storage_size(config)
        else:
            devicename = device['device_name']
            devicedev = device['device']
            key = "dev_%s_%s" % (host, devicename)
            swift_dev_details.setdefault(key, {})
            swift_dev_details[key]['device'] = "%s" % devicename
            swift_dev_details[key]['dev'] = "%s" % devicedev
            swift_dev_details[key]['fstype'] = "%s" % fstype
    config['CONFIG_SWIFT_STORAGE_DEVICES'] = swift_dev_details

    # set allowed hosts for firewall
    hosts = set([config['CONFIG_STORAGE_HOST']])
    if config['CONFIG_NOVA_INSTALL'] == 'y':
        hosts |= split_hosts(config['CONFIG_COMPUTE_HOSTS'])

    fw_details = dict()
    for host in hosts:
        key = "swift_storage_and_rsync_%s" % host
        fw_details.setdefault(key, {})
        fw_details[key]['host'] = "%s" % host
        fw_details[key]['service_name'] = "swift storage and rsync"
        fw_details[key]['chain'] = "INPUT"
        fw_details[key]['ports'] = ['6000', '6001', '6002', '873']
        fw_details[key]['proto'] = "tcp"
    config['FIREWALL_SWIFT_STORAGE_RULES'] = fw_details