nova-api revision 2605
2605N/A#!/usr/bin/python2.6
2605N/A
2605N/A# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
2605N/A#
2605N/A# Licensed under the Apache License, Version 2.0 (the "License"); you may
2605N/A# not use this file except in compliance with the License. You may obtain
2605N/A# a copy of the License at
2605N/A#
2605N/A# http://www.apache.org/licenses/LICENSE-2.0
2605N/A#
2605N/A# Unless required by applicable law or agreed to in writing, software
2605N/A# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
2605N/A# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
2605N/A# License for the specific language governing permissions and limitations
2605N/A# under the License.
2605N/A
2605N/Aimport os
2605N/Aimport sys
2605N/A
2605N/Aimport smf_include
2605N/A
2605N/Afrom oslo.config import cfg
2605N/A
2605N/A
2605N/A# name to script mapping for nova API
2605N/AMAPPING = {
2605N/A "ec2": "/usr/lib/nova/nova-api-ec2",
2605N/A "metadata": "/usr/lib/nova/nova-api-metadata",
2605N/A "osapi_compute": "/usr/lib/nova/nova-api-os-compute"
2605N/A}
2605N/A
2605N/A
2605N/Adef start():
2605N/A conf = cfg.CONF
2605N/A conf.import_opt("enabled_apis", "nova.service")
2605N/A
2605N/A if sys.argv[2] in conf.enabled_apis:
2605N/A smf_include.smf_subprocess(MAPPING[sys.argv[2]])
2605N/A else:
2605N/A print "Not starting %s. 'enabled_apis' does not include %s" % \
2605N/A (os.environ["SMF_FMRI"], sys.argv[2])
2605N/A return smf_include.SMF_EXIT_TEMP_DISABLE
2605N/A
2605N/Aif __name__ == "__main__":
2605N/A os.putenv("LC_ALL", "C")
2605N/A smf_include.smf_main()