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: I9eb490c874efa0d752982f38f0971f80bcab14f3
changes/14/614714/3
gengchc2 4 years ago
parent 961af3f6cf
commit 43b64a1c63

@ -34,6 +34,10 @@
# Number of jobs that can be executed at the same time (integer value)
#concurrent_jobs = 1
# Use freezer-api v1 interface if enable_v1_api (boolean value). If
# enable_v1_api is set as True, otherwise use freezer-api v2 interface.
#enable_v1_api = False
#
# From oslo.log
#

@ -101,6 +101,12 @@ def get_common_opts():
dest='concurrent_jobs',
help='Number of jobs that can be executed at the'
' same time'),
cfg.BoolOpt('enable-v1-api',
default=False,
dest='enable_v1_api',
help='Use freezer-api v1 interface if enable_v1_api'
' is set as True, otherwise use freezer-api'
' v2 interface'),
]
return _COMMON

@ -208,7 +208,13 @@ def main():
apiclient = None
if CONF.no_api is False:
try:
apiclient = client_utils.get_client_instance(opts=CONF)
if CONF.enable_v1_api:
apiclient = client_utils.get_client_instance(opts=CONF,
api_version='1')
else:
apiclient = client_utils.get_client_instance(opts=CONF,
api_version='2')
if CONF.client_id:
apiclient.client_id = CONF.client_id
except Exception as e:

Loading…
Cancel
Save