Example #1
0
def translateIPs():
    hosts = []
    for key,value in controller.CONF.items():
        if key.endswith("_HOST"):
            host = value.split('/')[0] # some host have devices in the name eg 1.1.1.1/vdb
            controller.CONF[key.replace('_HOST','_IP')] = value.replace(host, getIP(host))
                
        if key.endswith("_HOSTS"):
            ips = []
            for host_dev in value.split(","):
                host_dev = host_dev.strip()
                host = host_dev.split('/')[0]
                ips.append(host_dev.replace(host, getIP(host)))
            controller.CONF[key.replace('_HOSTS','_IPS')] = ','.join(ips)
Example #2
0
def createstoragemanifest():

    # this need to happen once per storage host
    for host in set([device['host'] for device in devices]):
        controller.CONF["CONFIG_SWIFT_STORAGE_CURRENT"] = getIP(host)
        manifestfile = "%s_swift.pp"%host
        manifestdata = getManifestTemplate("swift_storage.pp")
        appendManifestFile(manifestfile, manifestdata)

    # this need to happen once per storage device
    for device in devices:
        host = device['host']
        devicename = device['device_name']
        device = device['device']
       
        server = utils.ScriptRunner(host)
        validate.r_validateDevice(server, device)
        server.execute()

        manifestfile = "%s_swift.pp"%host
        if device:
            manifestdata = "\n" + 'swift::storage::%s{"%s":\n  device => "/dev/%s",\n}'% (controller.CONF["CONFIG_SWIFT_STORAGE_FSTYPE"], devicename, device)
        else:
            controller.CONF["SWIFT_STORAGE_DEVICES"] = "'%s'"%devicename
            manifestdata = "\n" + getManifestTemplate("swift_loopback.pp")
        appendManifestFile(manifestfile, manifestdata)
Example #3
0
def createbuildermanifest():
    # TODO : put this on the proxy server, will need to change this later
    controller.CONF['CONFIG_SWIFT_BUILDER_HOST'] = controller.CONF['CONFIG_SWIFT_PROXY_HOSTS'].split(',')[0]
    manifestfile = "%s_ring_swift.pp"%controller.CONF['CONFIG_SWIFT_BUILDER_HOST']
    manifestdata = getManifestTemplate("swift_builder.pp")

    # Add each device to the ring
    devicename = 0
    
    for device in parseDevices(controller.CONF["CONFIG_SWIFT_STORAGE_HOSTS"]):
        host = device['host']
        devicename = device['device_name']
        zone = device['zone']
        
        manifestdata = manifestdata + '\n@@ring_object_device { "%s:6000/%s":\n zone        => %s,\n weight      => 10, }'%(getIP(host), devicename, zone)
        manifestdata = manifestdata + '\n@@ring_container_device { "%s:6001/%s":\n zone        => %s,\n weight      => 10, }'%(getIP(host), devicename, zone)
        manifestdata = manifestdata + '\n@@ring_account_device { "%s:6002/%s":\n zone        => %s,\n weight      => 10, }'%(getIP(host), devicename, zone)

    appendManifestFile(manifestfile, manifestdata, 'swiftbuilder')