From 398cf93ef0fee5100af9955746c5749f43c5c4cc Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Fri, 14 Dec 2012 16:25:50 +0000 Subject: [PATCH] Revert "Some configurations require IP address" This reverts commit 713d1f4350d95b5eb145e51cd0d3bd325bf2ce17. this work is being done elsewhere --- packstack/modules/ospluginutils.py | 15 +------- packstack/plugins/global_000.py | 40 +--------------------- packstack/plugins/mysql_001.py | 5 --- packstack/plugins/nova_300.py | 4 +-- packstack/plugins/swift_600.py | 15 ++++---- packstack/puppet/templates/nova_common.pp | 2 +- packstack/puppet/templates/nova_compute.pp | 4 +-- 7 files changed, 13 insertions(+), 72 deletions(-) diff --git a/packstack/modules/ospluginutils.py b/packstack/modules/ospluginutils.py index 48d295679..d8ddbae93 100644 --- a/packstack/modules/ospluginutils.py +++ b/packstack/modules/ospluginutils.py @@ -1,5 +1,5 @@ -import os, socket +import os from packstack.installer import basedefs from packstack.installer.setup_controller import Controller @@ -73,16 +73,3 @@ def gethostlist(CONF): if host not in hosts: hosts.append(host) return hosts - -class PackStackException(BaseException): - def __init__(self, msg): - self.msg = msg - -# return the ip address correcponding to a hostname -_ips = {} -def getIP(h): - if _ips.get(h): - return _ips.get(h) - _ips[h] = socket.gethostbyname(h) - return _ips[h] - diff --git a/packstack/plugins/global_000.py b/packstack/plugins/global_000.py index b65f74243..f6fdcf7a5 100644 --- a/packstack/plugins/global_000.py +++ b/packstack/plugins/global_000.py @@ -7,8 +7,6 @@ import logging import packstack.installer.engine_validators as validate import packstack.installer.common_utils as utils -from packstack.modules.ospluginutils import gethostlist, PackStackException, getIP - # Controller object will be initialized from main flow controller = None @@ -104,40 +102,4 @@ def initConfig(controllerObject): controller.addGroup(groupDict, paramsList) def initSequences(controller): - preparesteps = [ - {'title': 'Sanitizing config variable', 'functions':[sanitize]} - ] - controller.addSequence("Global", [], [], preparesteps) - -# If either of localhost or 127.0.0.1 are anywhere in the list of hosts -# then this MUST be an all in one and all hosts MUST be loopback addresses -def dontMixloopback(): - hosts = gethostlist(controller.CONF) - - loopback = [h for h in hosts if h in ['127.0.0.1','localhost']] - if loopback: - if len(loopback) != len(hosts): - msg = "You must use 127.0.0.1 or localhost for All in One installs Only" - print msg - raise PackStackException(msg) - -# Parts of the puppet modules MUST have IP addresses, we translate them here -# availableto templates so they are -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) - -def sanitize(): - dontMixloopback() - translateIPs() + pass diff --git a/packstack/plugins/mysql_001.py b/packstack/plugins/mysql_001.py index 029f2df59..8acd4876e 100644 --- a/packstack/plugins/mysql_001.py +++ b/packstack/plugins/mysql_001.py @@ -80,11 +80,6 @@ def initSequences(controller): controller.addSequence("Installing MySQL", [], [], mysqlsteps) def createmanifest(): - # If localhost is used for the MySQL server, then mysql makes a socket connection - # we change this to a IP to force it to use TCP - if controller.CONF.get('CONFIG_MYSQL_HOST') == 'localhost': - controller.CONF['CONFIG_MYSQL_HOST'] = '127.0.0.1' - manifestfile = "%s_mysql.pp"%controller.CONF['CONFIG_MYSQL_HOST'] manifestdata = getManifestTemplate("mysql.pp") appendManifestFile(manifestfile, manifestdata, 'pre') diff --git a/packstack/plugins/nova_300.py b/packstack/plugins/nova_300.py index 91b1ffb00..91934368d 100644 --- a/packstack/plugins/nova_300.py +++ b/packstack/plugins/nova_300.py @@ -207,10 +207,8 @@ def createcertmanifest(): appendManifestFile(manifestfile, manifestdata) def createcomputemanifest(): - compute_ip_list = controller.CONF["CONFIG_NOVA_COMPUTE_IPS"].split(",") - for i, host in enumerate(controller.CONF["CONFIG_NOVA_COMPUTE_HOSTS"].split(",")): + for host in controller.CONF["CONFIG_NOVA_COMPUTE_HOSTS"].split(","): controller.CONF["CONFIG_NOVA_COMPUTE_HOST"] = host - controller.CONF["CONFIG_NOVA_COMPUTE_IP"] = compute_ip_list[i] manifestdata = getManifestTemplate("nova_compute.pp") manifestfile = "%s_nova.pp"%host diff --git a/packstack/plugins/swift_600.py b/packstack/plugins/swift_600.py index e52aba1b0..980c43c6f 100644 --- a/packstack/plugins/swift_600.py +++ b/packstack/plugins/swift_600.py @@ -9,7 +9,7 @@ import packstack.installer.engine_validators as validate from packstack.installer import basedefs import packstack.installer.common_utils as utils -from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile, manifestfiles, getIP +from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile, manifestfiles # Controller object will be initialized from main flow controller = None @@ -26,8 +26,8 @@ def initConfig(controllerObject): logging.debug("Adding Openstack swift configuration") paramsList = [ {"CMD_OPTION" : "os-swift-proxy", - "USAGE" : "The IP addresses on which to install the Swift proxy service", - "PROMPT" : "The IP addresses on which to install the Swift proxy service", + "USAGE" : "A comma seperated list of IP addresses on which to install the Swift proxy services", + "PROMPT" : "A comma seperated list of IP addresses on which to install the Swift proxy services", "OPTION_LIST" : [], "VALIDATION_FUNC" : validate.validatePing, "DEFAULT_VALUE" : "127.0.0.1", @@ -138,15 +138,14 @@ def createbuildermanifest(): # 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) + manifestdata = manifestdata + '\n@@ring_object_device { "%s:6000/%s":\n zone => %s,\n weight => 10, }'%(host, devicename, zone) + manifestdata = manifestdata + '\n@@ring_container_device { "%s:6001/%s":\n zone => %s,\n weight => 10, }'%(host, devicename, zone) + manifestdata = manifestdata + '\n@@ring_account_device { "%s:6002/%s":\n zone => %s,\n weight => 10, }'%(host, devicename, zone) appendManifestFile(manifestfile, manifestdata, 'swiftbuilder') @@ -162,7 +161,7 @@ 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) + controller.CONF["CONFIG_SWIFT_STORAGE_CURRENT"] = host manifestfile = "%s_swift.pp"%host manifestdata = getManifestTemplate("swift_storage.pp") appendManifestFile(manifestfile, manifestdata) diff --git a/packstack/puppet/templates/nova_common.pp b/packstack/puppet/templates/nova_common.pp index a00960f7d..73ad8bf81 100644 --- a/packstack/puppet/templates/nova_common.pp +++ b/packstack/puppet/templates/nova_common.pp @@ -1,5 +1,5 @@ nova_config{ - "metadata_host": value => "%(CONFIG_NOVA_API_IP)s"; + "metadata_host": value => "%(CONFIG_NOVA_API_HOST)s"; "qpid_hostname": value => "%(CONFIG_QPID_HOST)s"; "rpc_backend": value => "nova.rpc.impl_qpid"; } diff --git a/packstack/puppet/templates/nova_compute.pp b/packstack/puppet/templates/nova_compute.pp index d0b9fc327..34f488988 100644 --- a/packstack/puppet/templates/nova_compute.pp +++ b/packstack/puppet/templates/nova_compute.pp @@ -1,6 +1,6 @@ nova_config{ - "network_host": value => "%(CONFIG_NOVA_NETWORK_IP)s"; + "network_host": value => "%(CONFIG_NOVA_NETWORK_HOST)s"; "libvirt_inject_partition": value => "-1"; } @@ -12,7 +12,7 @@ class {"nova::compute": class { 'nova::compute::libvirt': libvirt_type => "%(CONFIG_LIBVIRT_TYPE)s", - vncserver_listen => "%(CONFIG_NOVA_COMPUTE_IP)s", + vncserver_listen => "%(CONFIG_NOVA_COMPUTE_HOST)s", } if "%(CONFIG_LIBVIRT_TYPE)s" == "qemu" and $::operatingsystem == "RedHat" {