Beispiel #1
0
#             because utils.LazyPluggable doesn't support reading from
#             option groups. See bug #1093043.
db_opts = [
    cfg.StrOpt('db_backend',
               default='sqlalchemy',
               help='The backend to use for bare-metal database'),
]

baremetal_group = cfg.OptGroup(name='baremetal', title='Baremetal Options')

CONF = cfg.CONF
CONF.register_group(baremetal_group)
CONF.register_opts(db_opts, baremetal_group)

IMPL = utils.LazyPluggable('db_backend',
                           config_group='baremetal',
                           sqlalchemy='nova.virt.baremetal.db.sqlalchemy.api')


def bm_node_get_all(context, service_host=None):
    return IMPL.bm_node_get_all(context, service_host=service_host)


def bm_node_get_associated(context, service_host=None):
    return IMPL.bm_node_get_associated(context, service_host=service_host)


def bm_node_get_unassociated(context, service_host=None):
    return IMPL.bm_node_get_unassociated(context, service_host=service_host)

Beispiel #2
0

FLAGS = flags.FLAGS
flags.DEFINE_string('db_backend', 'sqlalchemy',
                    'The backend to use for db')
flags.DEFINE_boolean('enable_new_services', True,
                     'Services to be added to the available pool on create')
flags.DEFINE_string('instance_name_template', 'instance-%08x',
                    'Template string to be used to generate instance names')
flags.DEFINE_string('volume_name_template', 'volume-%08x',
                    'Template string to be used to generate instance names')
flags.DEFINE_string('snapshot_name_template', 'snapshot-%08x',
                    'Template string to be used to generate snapshot names')


IMPL = utils.LazyPluggable(FLAGS['db_backend'],
                           sqlalchemy='nova.db.sqlalchemy.api')


class NoMoreBlades(exception.Error):
    """No more available blades."""
    pass


class NoMoreNetworks(exception.Error):
    """No more available networks."""
    pass


class NoMoreTargets(exception.Error):
    """No more available blades"""
    pass
Beispiel #3
0
def reset_backend():
    global IMPL
    IMPL = utils.LazyPluggable(
        'ipv6_backend',
        rfc2462='nova.ipv6.rfc2462',
        account_identifier='nova.ipv6.account_identifier')
Beispiel #4
0
#    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.
"""Database setup and migration commands."""

from nova import utils

IMPL = utils.LazyPluggable('backend',
                           config_group='database',
                           sqlalchemy='nova.db.sqlalchemy.migration')


def db_sync(version=None):
    """Migrate the database to `version` or the most recent version."""
    return IMPL.db_sync(version=version)


def db_version():
    """Display the current database version."""
    return IMPL.db_version()


def db_initial_version():
    """The starting version for the database."""
Beispiel #5
0
"""

from nova import flags
from nova.openstack.common import cfg
from nova import utils

db_opts = [
    cfg.StrOpt('baremetal_db_backend',
               default='sqlalchemy',
               help='The backend to use for db'),
]

FLAGS = flags.FLAGS
FLAGS.register_opts(db_opts)

IMPL = utils.LazyPluggable('baremetal_db_backend',
                           sqlalchemy='nova.virt.baremetal.db.sqlalchemy.api')


def bm_node_get_all(context,
                    service_host=None,
                    instantiated=None,
                    sort=None,
                    session=None):
    return IMPL.bm_node_get_all(context,
                                service_host=service_host,
                                instantiated=instantiated,
                                sort=sort,
                                session=session)


def bm_node_find_free(context,
Beispiel #6
0
#
#    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.
"""Database setup and migration commands."""

from nova import utils

IMPL = utils.LazyPluggable('db_backend',
                           sqlalchemy='nova.db.sqlalchemy.migration')

INIT_VERSION = 81


def db_sync(version=None):
    """Migrate the database to `version` or the most recent version."""
    return IMPL.db_sync(version=version)


def db_version():
    """Display the current database version."""
    return IMPL.db_version()
Beispiel #7
0
#    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.

"""Database setup and migration commands."""

from nova import utils

IMPL = utils.LazyPluggable('db_backend',
                           sqlalchemy='healthnmon.db.sqlalchemy.migration'
                           )


def db_sync(version=None):
    """Migrate the database to `version` or the most recent version."""

    return IMPL.db_sync(version=version)


def db_version():
    """Display the current database version."""

    return IMPL.db_version()
Beispiel #8
0
"""

from nova.openstack.common import cfg
from nova import utils
from nova.openstack.common import cfg

db_opts = [
    cfg.StrOpt('healthnmon_db_backend',
               default='sqlalchemy',
               help='The backend to use for db'),
]

CONF = cfg.CONF
CONF.register_opts(db_opts)

IMPL = utils.LazyPluggable('healthnmon_db_backend',
                           sqlalchemy='healthnmon.db.sqlalchemy.api')


#################################################

def vm_host_save(context, vmhost):
    """This API will create or update a VmHost object and its associations to DB. For the update to be working the VMHost object should have been one returned by DB API. Else it will be considered as a insert.
        Parameters:
        vmhost - VmHost type object to be saved
        context - nova.context.RequestContext object
    """

    return IMPL.vm_host_save(context, vmhost)


def vm_host_get_by_ids(context, ids):
#    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.

"""Database setup and migration commands."""

from nova import utils


IMPL = utils.LazyPluggable(
        'baremetal_db_backend',
        sqlalchemy='nova.virt.baremetal.bmdb.sqlalchemy.migration')

INIT_VERSION = 0


def db_sync(version=None):
    """Migrate the database to `version` or the most recent version."""
    return IMPL.db_sync(version=version)


def db_version():
    """Display the current database version."""
    return IMPL.db_version()