Coverage for nova/cmd/compute.py: 100%
36 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-04-24 11:16 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-04-24 11:16 +0000
1# Copyright 2010 United States Government as represented by the
2# Administrator of the National Aeronautics and Space Administration.
3# All Rights Reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License"); you may
6# not use this file except in compliance with the License. You may obtain
7# a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations
15# under the License.
17"""Starter script for Nova Compute."""
19import shlex
20import sys
22import os_brick
23import os_vif
24from oslo_log import log as logging
25from oslo_privsep import priv_context
26from oslo_reports import guru_meditation_report as gmr
27from oslo_reports import opts as gmr_opts
29from nova.compute import rpcapi as compute_rpcapi
30from nova.conductor import rpcapi as conductor_rpcapi
31import nova.conf
32from nova.conf import remote_debug
33from nova import config
34import nova.db.main.api
35from nova import objects
36from nova.objects import base as objects_base
37from nova import service
38from nova import utils
39from nova import version
41CONF = nova.conf.CONF
42remote_debug.register_cli_opts(CONF)
45def main():
46 config.parse_args(sys.argv)
47 logging.setup(CONF, 'nova')
48 priv_context.init(root_helper=shlex.split(utils.get_root_helper()))
49 objects.register_all()
50 gmr_opts.set_defaults(CONF)
51 os_brick.setup(CONF)
52 # Ensure os-vif objects are registered and plugins loaded
53 os_vif.initialize()
55 gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)
57 # disable database access for this service
58 nova.db.main.api.DISABLE_DB_ACCESS = True
59 objects_base.NovaObject.indirection_api = conductor_rpcapi.ConductorAPI()
60 objects.Service.enable_min_version_cache()
61 server = service.Service.create(binary='nova-compute',
62 topic=compute_rpcapi.RPC_TOPIC)
63 service.serve(server)
64 service.wait()