Revert "Some configurations require IP address"

This reverts commit 713d1f4350d95b5eb145e51cd0d3bd325bf2ce17.

this work is being done elsewhere
This commit is contained in:
Derek Higgins 2012-12-14 16:25:50 +00:00
parent 713d1f4350
commit 398cf93ef0
7 changed files with 13 additions and 72 deletions

View File

@ -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]

View File

@ -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

View File

@ -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')

View File

@ -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

View File

@ -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)

View File

@ -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";
}

View File

@ -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" {