Пример #1
0
def main():
    global_conf.logging()

    utils.default_flagfile("nova.conf")
    flags.FLAGS(sys.argv)
    FLAGS = flags.FLAGS
    conf = global_conf._conf
    for param in ("rabbit_host", "rabbit_port", "rabbit_userid",
                  "rabbit_password", "rabbit_virtual_host",
                  "rabbit_durable_queues", "control_exchange"):
        conf[param] = getattr(FLAGS, param)

    nova_api_config = ConfigParser()
    nova_api_config.read(["/etc/nova/api-paste.ini"])
    keystone_conf = {}
    conf_map = {
        "auth_uri": "auth_uri",
        "admin_tenant_name": "tenant_name",
        "admin_user": "******",
        "admin_password": "******"
    }
    for param_nova, param_client in conf_map.iteritems():
        try:
            value = nova_api_config.get("filter:authtoken", param_nova)
        except Exception as e:
            print e
        else:
            keystone_conf[param_client] = value
    conf["keystone_conf"] = keystone_conf
    json.dump(conf, open(CONFIG_FILE, "w"), indent=4, sort_keys=True)
Пример #2
0
def prepare_service(argv=[]):
    cfg.CONF(argv[1:])
    # FIXME(dhellmann): We must set up the nova.flags module in order
    # to have the RPC and DB access work correctly because we are
    # still using the Service object out of nova directly. We need to
    # move that into openstack.common.
    flags.FLAGS(argv[1:])
    log.setup('billing')
Пример #3
0
 def load_nova_conf(self):
     try:
         from nova import flags
         from nova import utils
         utils.default_flagfile(self.nova_conf)
         flags.FLAGS(sys.argv)
         self._FLAGS = flags.FLAGS
     except Exception:
         LOG.exception("cannot load nova flags")
Пример #4
0
def connect_db():
    keystone.manage.parse_args(None)

    from nova import flags
    from nova import utils
    FLAGS = flags.FLAGS
    utils.default_flagfile()
    flags.FLAGS(sys.argv)
    global nova_engine
    nova_engine = get_engine()
Пример #5
0
import datetime
import unittest
import sys

from dough import context as dough_context
from dough import db
from dough import exception

from nova import flags
from nova import utils
from nova.db.sqlalchemy.session import get_engine

utils.default_flagfile(filename='/etc/dough/dough.conf')
flags.FLAGS(sys.argv)

FLAGS = flags.FLAGS


class DBApiTestCase(unittest.TestCase):
    def setUp(self):
        super(DBApiTestCase, self).setUp()
        engine = get_engine()
        self.connection = engine.connect()
        self.tenant_id = 'atenant'
        self.context = dough_context.get_context(tenant_id=self.tenant_id)
        self.resource_uuid = 'a-fake-uuid-0'
        self.resource_name = 'a_fake_name_0'
        self.region_name = 'default'
        self.item_name = 'instance'
        self.item_type_name = 'm1.tiny'
        self.payment_type_name = 'hourly'
Пример #6
0
from nova import db
from nova import context
from nova import log as logging
from nova import utils
from nova import version
from nova.compute import manager as compute_manager

__worker__ = None
__lock__ = threading.Lock()

FLAGS = flags.FLAGS
args = ['compute-metrics']
utils.default_flagfile(args=args)
print args
flags.FLAGS(args)
print FLAGS.sql_connection


class UpdateComputeNodeStatusThread(threading.Thread):
    """Updates compute node status."""
    def __init__(self, params):
        print 'starting init'
        threading.Thread.__init__(self)
        self.manager = compute_manager.ComputeManager()
        self.running = False
        self.shuttingdown = False
        self.refresh_rate = int(params['refresh_rate'])
        self.status = {}
        self._update_hypervisor()
        print 'finished init'