Correct errors about freezer-api supporting for V1 and V2 api
At present, the codes as follows: db/elastic/driver.py: Def get_engine (self): If not self._engine: Self._engine = db_session.ElasticSearchEngineV2(self.backend) Return self._engine There is that freezer-api can't support support v1. Actually, there is enable_v1_api ,but it is not used correctly. The documents will be modified in other patches. For example: 1)freezer-api v1: /etc/freezer/freezer-api.conf: [DEFAULT] enable_v1_api = True [storage] driver = elasticsearch backend = elasticsearch [elasticsearch] hosts = http://172.16.1.200:9200 number_of_replicas = 0 index = freezer /etc/freezer/scheduler.conf: [DEFAULT] enable_v1_api = True command: freezer --os-backup-api-version 1 job-list 2)freezer-api v2: /etc/freezer/freezer-api.conf: [DEFAULT] enable_v1_api = False or # enable_v1_api = False [storage] driver = elasticsearch backend = elasticsearch [elasticsearch] hosts = http://172.16.1.200:9200 number_of_replicas = 0 index = freezer /etc/freezer/scheduler.conf: [DEFAULT] enable_v1_api = False or # enable_v1_api = False command: freezer job-list Change-Id: Iccee3a7cde986d0ba2aaf018fafa6bca411c34bf
This commit is contained in:
parent
b09705d812
commit
d1a5e93b25
@ -12,36 +12,26 @@
|
|||||||
# Maximum value: 65535
|
# Maximum value: 65535
|
||||||
#bind_port = 9090
|
#bind_port = 9090
|
||||||
|
|
||||||
# Deploy the v1 OpenStack Freezer API.
|
# Deploy the OpenStack Freezer API.
|
||||||
# When this option is set to ``True``, Freezer-api service will respond to
|
# Default is the v2 Freezer API.
|
||||||
# requests on registered endpoints conforming to the v1 OpenStack Freezer API.
|
# When this option is set
|
||||||
# NOTES:
|
# to ``True``, Freezer-api service will respond
|
||||||
# * Multi-tenancy is not supported under this api version.
|
# to requests on registered endpoints conforming
|
||||||
# * Everything is user based.
|
# to the v1 OpenStack Freezer api.
|
||||||
# * Freezer api v1 doesn't support Oslo.db.
|
# The v1 OpenStack Freezer API:
|
||||||
# * Use elasticsearch db with v1 api version
|
# * Multi-tenancy is not supported under this
|
||||||
|
# api version.
|
||||||
|
# * Everything is user based.
|
||||||
|
# * Freezer api v1 doesn't support Oslo.db.
|
||||||
|
# * Use elasticsearch db with v1 api version
|
||||||
|
# The v2 OpenStack Freezer API:
|
||||||
|
# * Multi-tenancy is supported under this api version.
|
||||||
|
# * Freezer api v2 supports Oslo.db.
|
||||||
|
# * Recommended to use oslo.db with api v2
|
||||||
# Possible values:
|
# Possible values:
|
||||||
# * True
|
# * True
|
||||||
# * False
|
# * False
|
||||||
# Related options:
|
#enable_v1_api = False
|
||||||
# * enable_v2_api
|
|
||||||
# (boolean value)
|
|
||||||
#enable_v1_api = false
|
|
||||||
|
|
||||||
# Deploy the v2 OpenStack Freezer API.
|
|
||||||
# When this option is set to ``True``, Freezer-api service will respond to
|
|
||||||
# requests on registered endpoints conforming to the v2 OpenStack Freezer api.
|
|
||||||
# NOTES:
|
|
||||||
# * Multi-tenancy is supported under this api version.
|
|
||||||
# * Freezer api v2 supports Oslo.db.
|
|
||||||
# * Recommended to use oslo.db with api v2
|
|
||||||
# Possible values:
|
|
||||||
# * True
|
|
||||||
# * False
|
|
||||||
# Related options:
|
|
||||||
# * enable_v1_api
|
|
||||||
# (boolean value)
|
|
||||||
#enable_v2_api = true
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# From oslo.log
|
# From oslo.log
|
||||||
|
@ -51,7 +51,8 @@ def api_versions(conf=None):
|
|||||||
class Resource(object):
|
class Resource(object):
|
||||||
|
|
||||||
def _build_versions(self, host_url):
|
def _build_versions(self, host_url):
|
||||||
allowed_versions = {'v1': CONF.enable_v1_api, 'v2': CONF.enable_v2_api}
|
allowed_versions = {'v1': CONF.enable_v1_api,
|
||||||
|
'v2': False if CONF.enable_v1_api else True}
|
||||||
|
|
||||||
updated_versions = {'versions': []}
|
updated_versions = {'versions': []}
|
||||||
for version in VERSIONS['versions']:
|
for version in VERSIONS['versions']:
|
||||||
|
@ -61,35 +61,27 @@ def api_common_opts():
|
|||||||
),
|
),
|
||||||
cfg.BoolOpt('enable_v1_api',
|
cfg.BoolOpt('enable_v1_api',
|
||||||
default=False,
|
default=False,
|
||||||
help="""Deploy the v1 OpenStack Freezer API.
|
help="""Default False, That is the v2 Freezer API
|
||||||
When this option is set to ``True``, Freezer-api service will respond to
|
will be deployed. When this option is set
|
||||||
requests on registered endpoints conforming to the v1 OpenStack Freezer API.
|
to ``True``, Freezer-api service will respond
|
||||||
NOTES:
|
to requests on registered endpoints conforming
|
||||||
* Multi-tenancy is not supported under this api version.
|
to the v1 OpenStack Freezer api.
|
||||||
* Everything is user based.
|
The v1 OpenStack Freezer API functions
|
||||||
* Freezer api v1 doesn't support Oslo.db.
|
as follows:
|
||||||
* Use elasticsearch db with v1 api version
|
* Multi-tenancy is not supported under this
|
||||||
Possible values:
|
api version.
|
||||||
* True
|
* Everything is user based.
|
||||||
* False
|
* Freezer api v1 doesn't support Oslo.db.
|
||||||
Related options:
|
* Use elasticsearch db with v1 api version
|
||||||
* enable_v2_api
|
The v2 OpenStack Freezer API functions
|
||||||
"""),
|
as follows:
|
||||||
cfg.BoolOpt('enable_v2_api',
|
* Multi-tenancy is supported under this api version.
|
||||||
default=True,
|
* Freezer api v2 supports Oslo.db.
|
||||||
help="""Deploy the v2 OpenStack Freezer API.
|
* Recommended to use oslo.db with api v2
|
||||||
When this option is set to ``True``, Freezer-api service will respond to
|
Possible values:
|
||||||
requests on registered endpoints conforming to the v2 OpenStack Freezer api.
|
* True
|
||||||
NOTES:
|
* False
|
||||||
* Multi-tenancy is supported under this api version.
|
""")
|
||||||
* Freezer api v2 supports Oslo.db.
|
|
||||||
* Recommended to use oslo.db with api v2
|
|
||||||
Possible values:
|
|
||||||
* True
|
|
||||||
* False
|
|
||||||
Related options:
|
|
||||||
* enable_v1_api
|
|
||||||
""")
|
|
||||||
]
|
]
|
||||||
|
|
||||||
return _COMMON
|
return _COMMON
|
||||||
|
@ -19,8 +19,8 @@ from oslo_log import log
|
|||||||
from freezer_api.common import db_mappings
|
from freezer_api.common import db_mappings
|
||||||
from freezer_api.db import base as db_base
|
from freezer_api.db import base as db_base
|
||||||
from freezer_api.db.elasticsearch import es_manager
|
from freezer_api.db.elasticsearch import es_manager
|
||||||
from freezer_api.storage import elasticv2 as db_session
|
from freezer_api.storage import elastic as db_session_v1
|
||||||
|
from freezer_api.storage import elasticv2 as db_session_v2
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
@ -89,7 +89,12 @@ class ElasticSearchDB(db_base.DBDriver):
|
|||||||
|
|
||||||
def get_engine(self):
|
def get_engine(self):
|
||||||
if not self._engine:
|
if not self._engine:
|
||||||
self._engine = db_session.ElasticSearchEngineV2(self.backend)
|
if CONF.enable_v1_api:
|
||||||
|
self._engine = db_session_v1.\
|
||||||
|
ElasticSearchEngine(self.backend)
|
||||||
|
else:
|
||||||
|
self._engine = db_session_v2.\
|
||||||
|
ElasticSearchEngineV2(self.backend)
|
||||||
return self._engine
|
return self._engine
|
||||||
|
|
||||||
def get_api(self):
|
def get_api(self):
|
||||||
|
@ -33,13 +33,16 @@ FALCON_MINVERSION_MIDDLEWARE = pkg_resources.parse_version('0.2.0b1')
|
|||||||
|
|
||||||
|
|
||||||
def root_app_factory(loader, global_conf, **local_conf):
|
def root_app_factory(loader, global_conf, **local_conf):
|
||||||
"""Allows freezer to launch multiple applications at a time.
|
"""Freezer can manage multiple versions, but
|
||||||
It will allow freezer to manage multiple versions.
|
only launch one version at a time, Otherwise it is
|
||||||
|
easy to cause confusion. If there is a demand in the future
|
||||||
|
for a single freezer-api instance to support both v1 and v2 at a time,
|
||||||
|
you need to add a new patch to implement it.
|
||||||
"""
|
"""
|
||||||
if not CONF.enable_v1_api and '/v1' in local_conf:
|
if CONF.enable_v1_api and '/v1' in local_conf:
|
||||||
del local_conf['/v1']
|
|
||||||
if not CONF.enable_v2_api and '/v2' in local_conf:
|
|
||||||
del local_conf['/v2']
|
del local_conf['/v2']
|
||||||
|
else:
|
||||||
|
del local_conf['/v1']
|
||||||
return urlmap.urlmap_factory(loader, global_conf, **local_conf)
|
return urlmap.urlmap_factory(loader, global_conf, **local_conf)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user