Remove heat-metadata service

Remove heat-metadata service, since the last remaining function
(waitcondition handle notification) is now handled via the CFN
API

blueprint metsrv-remove
Signed-off-by: Steven Hardy <shardy@redhat.com>
Change-Id: Ie36c86ce86f6c47e8d9f8accf8ec17084fb8cffd
This commit is contained in:
Steven Hardy 2012-11-28 15:50:41 +00:00
parent 6689711bfd
commit 6ae3ff0a4e
10 changed files with 12 additions and 255 deletions

View File

@ -1,61 +0,0 @@
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Heat Metadata Server.
This makes the instance metadata accessible both to the instance and Heat Engine.
"""
import gettext
import os
import sys
# If ../heat/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
os.pardir))
if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')):
sys.path.insert(0, possible_topdir)
gettext.install('heat', unicode=1)
from heat.common import config
from heat.common import wsgi
from heat.openstack.common import log as logging
from heat.openstack.common import cfg
LOG = logging.getLogger('heat.metadata')
if __name__ == '__main__':
try:
cfg.CONF(project='heat', prog='heat-metadata')
config.setup_logging()
config.register_metadata_opts()
app = config.load_paste_app()
port = cfg.CONF.bind_port
host = cfg.CONF.bind_host
LOG.info(('Starting Heat Metadata on %s:%s') % (host, port))
server = wsgi.Server()
server.start(app, cfg.CONF, default_port=port)
server.wait()
except RuntimeError, e:
sys.exit("ERROR: %s" % e)

View File

@ -314,38 +314,27 @@ Other Templates
=============== ===============
Check out the ``Wordpress_2_Instances_with_EBS_EIP.template``. This uses a few different APIs in OpenStack nova, such as the Volume API, the Floating IP API and the Security Groups API, as well as the general nova launching and monitoring APIs. Check out the ``Wordpress_2_Instances_with_EBS_EIP.template``. This uses a few different APIs in OpenStack nova, such as the Volume API, the Floating IP API and the Security Groups API, as well as the general nova launching and monitoring APIs.
Configure the Metadata server IPtables rules
----------------------------- --------------
Some templates require the ``heat-metadata`` server also. The metadata server must be configured to bind to the IP address of the host machine on the Nova network created above (``demonetbr0``). This allows the launched instances to access the metadata server. However, the bridge interface is not actually created until an instance is launched in Nova. If you have completed the preceding steps the bridge will now have been created, so you can proceed to edit the file ``/etc/heat/heat-metadata.conf`` to change the ``bind_host`` value from the default ``0.0.0.0`` to the correct IP address and launch the metadata server:: Some templates require the instances to be able to connect to the heat CFN API (for metadata update via cfn-hup and waitcondition notification via cfn-signal):
BIND_IP=`ifconfig demonetbr0 | sed -e 's/ *inet \(addr:\)\?\([0-9.]\+\).*/\2/' -e t -e d` Open up port 8000 so that the guests can communicate with the heat-api-cfn server::
sudo sed -i -e "/^bind_host *=/ s/0\.0\.0\.0/${BIND_IP:?}/" /etc/heat/heat-metadata.conf
sudo -E bash -c 'heat-metadata &'
Open up port 8002 so that the guests can communicate with the heat-metadata server::
sudo iptables -I INPUT -p tcp --dport 8002 -j ACCEPT -i demonetbr0
Note Instance/resource metadata is actually now served via the cloudformation API, so it is necessary to also open up port 8000 so that the guests can communicate with the heat-api-cfn server::
sudo iptables -I INPUT -p tcp --dport 8000 -j ACCEPT -i demonetbr0 sudo iptables -I INPUT -p tcp --dport 8000 -j ACCEPT -i demonetbr0
Note the above rules will not persist across reboot, so you may wish to add them to /etc/sysconfig/iptables
Configure Heat Cloudwatch server
--------------------------------
If you wish to try any of the HA or autoscaling templates (which collect stats from instances via the CloudWatch API), it is neccessary to start the heat-api-cloudwatch server::
sudo -E bash -c 'heat-api-cloudwatch &'
Open up port 8003 so that the guests can communicate with the heat-api-cloudwatch server:: Open up port 8003 so that the guests can communicate with the heat-api-cloudwatch server::
sudo iptables -I INPUT -p tcp --dport 8003 -j ACCEPT -i demonetbr0 sudo iptables -I INPUT -p tcp --dport 8003 -j ACCEPT -i demonetbr0
Note the above rule will not persist across reboot, so you may wish to add it to /etc/sysconfig/iptables Note the above rules will not persist across reboot, so you may wish to add them to /etc/sysconfig/iptables
Start the Heat Cloudwatch server
--------------------------------
If you wish to try any of the HA or autoscaling templates (which collect stats from instances via the CloudWatch API), it is neccessary to start the heat-api-cloudwatch server::
sudo -E bash -c 'heat-api-cloudwatch &'
Further information on using the heat cloudwatch features is available in the Using-Cloudwatch_ wiki page Further information on using the heat cloudwatch features is available in the Using-Cloudwatch_ wiki page

View File

@ -1,15 +0,0 @@
# Default minimal pipeline
[pipeline:heat-metadata]
pipeline = context metadatav1app
# Use the following pipeline for keystone auth
# i.e. in heat-metadata.conf:
# [paste_deploy]
# flavor = keystone
#
[app:metadatav1app]
paste.app_factory = heat.common.wsgi:app_factory
heat.app_factory = heat.metadata.api.v1:API
[filter:context]
paste.filter_factory = heat.common.context:ContextMiddleware_filter_factory

View File

@ -1,27 +0,0 @@
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
verbose = True
# Show debugging output in logs (sets DEBUG log level output)
debug = True
# Address to bind the server to
bind_host = 0.0.0.0
# Port the bind the server to
bind_port = 8002
# Log to this file. Make sure the user running heat-metadata has
# permissions to write to this file!
log_file = /var/log/heat/metadata.log
# ================= Syslog Options ============================
# Send logs to syslog (/dev/log) instead of to file specified
# by `log_file`
use_syslog = False
# Facility to use. If unset defaults to LOG_USER.
# syslog_log_facility = LOG_LOCAL0
rpc_backend=heat.openstack.common.rpc.impl_qpid

View File

@ -113,12 +113,6 @@ cfg.StrOpt('engine_topic',
] ]
def register_metadata_opts():
cfg.CONF.register_opts(service_opts)
cfg.CONF.register_opts(bind_opts)
cfg.CONF.register_opts(rpc_opts)
def register_api_opts(): def register_api_opts():
cfg.CONF.register_opts(bind_opts) cfg.CONF.register_opts(bind_opts)
cfg.CONF.register_opts(rpc_opts) cfg.CONF.register_opts(rpc_opts)

View File

@ -1,46 +0,0 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import routes
from heat.common import wsgi
from heat.metadata.api.v1 import metadata
from heat.openstack.common import log as logging
class API(wsgi.Router):
"""
WSGI router for Heat Metadata Server API v1 requests.
"""
def __init__(self, conf, **local_conf):
self.cong = conf
mapper = routes.Mapper()
metadata_controller = metadata.create_resource(conf)
mapper.connect('/',
controller=metadata_controller, action='entry_point',
conditions=dict(method=['GET']))
mapper.connect('/stacks/:stack_id/resources/:resource_name',
controller=metadata_controller,
action='update_metadata',
conditions=dict(method=['PUT']))
# TODO(shadower): make sure all responses are JSON-encoded
# currently, calling an unknown route uses the default handler which
# produces a HTML response.
super(API, self).__init__(mapper)

View File

@ -1,76 +0,0 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import json
from webob.exc import Response
from heat.common import wsgi
from heat.common import context
from heat.engine import rpcapi as engine_rpcapi
from heat.openstack.common import rpc
def json_response(http_status, data):
"""Create a JSON response with a specific HTTP code."""
response = Response(json.dumps(data))
response.status = http_status
response.content_type = 'application/json'
return response
def json_error(http_status, message):
"""Create a JSON error response."""
body = {'error': message}
return json_response(http_status, body)
class MetadataController:
def __init__(self, options):
self.options = options
self.engine_rpcapi = engine_rpcapi.EngineAPI()
def entry_point(self, req):
return {
'name': 'Heat Metadata Server API',
'version': '1',
}
def update_metadata(self, req, body, stack_id, resource_name):
con = context.get_admin_context()
[error, metadata] = self.engine_rpcapi.metadata_update(con,
stack_id=stack_id,
resource_name=resource_name,
metadata=body)
if error:
if error == 'stack':
return json_error(404,
'The stack "%s" does not exist.' % stack_id)
else:
return json_error(404,
'The resource "%s" does not exist.' % resource_name)
return json_response(201, {
'resource': resource_name,
'metadata': body,
})
def create_resource(options):
"""
Stacks resource factory method.
"""
deserializer = wsgi.JSONRequestDeserializer()
serializer = wsgi.JSONResponseSerializer()
return wsgi.Resource(MetadataController(options), deserializer, serializer)

View File

@ -48,7 +48,6 @@ setuptools.setup(
'bin/heat-api-cfn', 'bin/heat-api-cfn',
'bin/heat-api-cloudwatch', 'bin/heat-api-cloudwatch',
'bin/heat-boto', 'bin/heat-boto',
'bin/heat-metadata',
'bin/heat-engine', 'bin/heat-engine',
'bin/heat-watch', 'bin/heat-watch',
'bin/heat-db-setup', 'bin/heat-db-setup',