Update tox pylint/pep8 for dcorch
This commit enables the check of new pylint/pep8 violations. PYLINT - All convention related checks, except: - missing-class-docstring - missing-function-docstring - missing-module-docstring - consider-using-f-string - invalid-name - import-outside-toplevel - too-many-lines - consider-iterating-dictionary - unnecessary-lambda-assignment PEP8: - E117: over-indented - E123: closing bracket does not match indentation of opening bracket's line - E125: continuation line with the same indent as the next logical line - E305: expected 2 blank lines after class or function definition - E402: module level import not at top of file - E501: line too long - H216: flag use of third party mock Test Plan: 1. Verify that all Tox tests pass without errors: - tox -e py39,pylint,pep8 Partial-bug: 2033294 Change-Id: I834d15ae1df6b2b449502dcb0bcf0c359a99514f Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
This commit is contained in:
parent
827799658c
commit
3685223b28
|
@ -1,4 +1,5 @@
|
|||
# Copyright (c) 2015 Huawei, Tech. Co,. Ltd.
|
||||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -41,9 +42,9 @@ def setup_app(*args, **kwargs):
|
|||
'errors': {
|
||||
400: '/error',
|
||||
'__force_dict__': True
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pecan_config = pecan.configuration.conf_from_dict(config)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright (c) 2015 Huawei Tech. Co., Ltd.
|
||||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -40,13 +41,13 @@ class RootController(object):
|
|||
{
|
||||
"rel": "self",
|
||||
"href": pecan.request.application_url + "/v1.0/"
|
||||
}
|
||||
],
|
||||
}
|
||||
],
|
||||
"id": "v1.0",
|
||||
"updated": "2016-03-07"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@index.when(method='POST')
|
||||
@index.when(method='PUT')
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright (c) 2017 Ericsson AB.
|
||||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -13,9 +14,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import pecan
|
||||
|
||||
from dcorch.api.controllers.v1 import subcloud_manager
|
||||
import pecan
|
||||
|
||||
|
||||
class Controller(object):
|
||||
|
|
|
@ -13,17 +13,18 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Copyright (c) 2022 Wind River Systems, Inc.
|
||||
# Copyright (c) 2022, 2024 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
"""Policy Engine For DC."""
|
||||
|
||||
from dcorch.api import policies as controller_policies
|
||||
from oslo_config import cfg
|
||||
from oslo_policy import policy
|
||||
from webob import exc
|
||||
|
||||
from dcorch.api import policies as controller_policies
|
||||
|
||||
CONF = cfg.CONF
|
||||
_ENFORCER = None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2017-2023 Wind River
|
||||
# Copyright 2017-2024 Wind River
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -13,6 +13,8 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import routes
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
|
@ -29,13 +31,7 @@ from dcorch.api.proxy.apps.router import Router
|
|||
from dcorch.api.proxy.common import constants as proxy_consts
|
||||
from dcorch.common import consts
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2017-2023 Wind River
|
||||
# Copyright (c) 2017-2024 Wind River Systems, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -16,9 +16,15 @@
|
|||
import grp
|
||||
import json
|
||||
import os
|
||||
import psutil
|
||||
import pwd
|
||||
import shutil
|
||||
|
||||
from eventlet.green import subprocess
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_service.wsgi import Request
|
||||
from oslo_utils._i18n import _
|
||||
import psutil
|
||||
import tsconfig.tsconfig as tsc
|
||||
import webob.dec
|
||||
import webob.exc
|
||||
|
@ -34,16 +40,10 @@ from dcorch.api.proxy.common.service import Middleware
|
|||
from dcorch.api.proxy.common.service import Request as ProxyRequest
|
||||
from dcorch.api.proxy.common import utils as proxy_utils
|
||||
from dcorch.common import consts
|
||||
import dcorch.common.context as k_context
|
||||
from dcorch.common import context as k_context
|
||||
from dcorch.common import exceptions as exception
|
||||
from dcorch.common import utils
|
||||
from dcorch.rpc import client as rpc_client
|
||||
from eventlet.green import subprocess
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_service.wsgi import Request
|
||||
from oslo_utils._i18n import _
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -460,7 +460,8 @@ class SysinvAPIController(APIController):
|
|||
new_load = json.loads(response.body)
|
||||
self._save_load_to_vault(new_load['software_version'])
|
||||
else:
|
||||
sw_version = json.loads(response.body)['software_version']
|
||||
sw_version = \
|
||||
json.loads(response.body)['software_version']
|
||||
self._remove_load_from_vault(sw_version)
|
||||
elif resource_type == consts.RESOURCE_TYPE_SYSINV_DEVICE_IMAGE:
|
||||
notify = True
|
||||
|
@ -627,7 +628,7 @@ class SysinvAPIController(APIController):
|
|||
# file object type is different in Debian than CentOS and and
|
||||
# has fileno() attribute but is not a supported operation on Debian
|
||||
#
|
||||
# The check for st_size is required to determine the file size of iso image
|
||||
# The check for st_size is required to determine the file size of *.iso
|
||||
# It is not applicable to its signature file
|
||||
try:
|
||||
file_size = os.fstat(source_file.fileno()).st_size
|
||||
|
@ -637,14 +638,16 @@ class SysinvAPIController(APIController):
|
|||
if file_size >= 0:
|
||||
# Only proceed if there is space available for copying
|
||||
avail_space = psutil.disk_usage('/scratch').free
|
||||
if (avail_space < file_size):
|
||||
LOG.error("Failed to upload load file %s, not enough space on /scratch"
|
||||
" partition: %d bytes available "
|
||||
% (staging_file, avail_space))
|
||||
if avail_space < file_size:
|
||||
LOG.error(
|
||||
"Failed to upload load file %s, not enough space on /scratch"
|
||||
" partition: %d bytes available " % (staging_file,
|
||||
avail_space))
|
||||
return None
|
||||
|
||||
# Large iso file, allocate the required space
|
||||
subprocess.check_call(["/usr/bin/fallocate", # pylint: disable=not-callable
|
||||
# pylint: disable-next=not-callable
|
||||
subprocess.check_call(["/usr/bin/fallocate",
|
||||
"-l " + str(file_size), staging_file])
|
||||
|
||||
with open(staging_file, 'wb') as destination_file:
|
||||
|
@ -753,7 +756,8 @@ class SysinvAPIController(APIController):
|
|||
# stores device image in the vault storage
|
||||
file_item = request.POST['file']
|
||||
try:
|
||||
resource = json.loads(response.body)[consts.RESOURCE_TYPE_SYSINV_DEVICE_IMAGE]
|
||||
resource = json.loads(response.body)[
|
||||
consts.RESOURCE_TYPE_SYSINV_DEVICE_IMAGE]
|
||||
dst_filename = self._get_device_image_filename(resource)
|
||||
self._store_image_file(file_item, dst_filename)
|
||||
except Exception:
|
||||
|
@ -921,7 +925,7 @@ class IdentityAPIController(APIController):
|
|||
resource_type = consts.RESOURCE_TYPE_IDENTITY_USERS
|
||||
elif (resource_type == consts.RESOURCE_TYPE_IDENTITY_GROUPS
|
||||
and operation_type != consts.OPERATION_TYPE_POST):
|
||||
if("users" in request_header):
|
||||
if "users" in request_header:
|
||||
# Requests for adding a user (PUT) and removing a user (DELETE)
|
||||
# should be converted to a PUT request
|
||||
# The url in this case looks like /groups/{group_id}/users/{user_id}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2018, 2021 Wind River
|
||||
# Copyright (c) 2018, 2021, 2024 Wind River Systems, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -77,8 +77,9 @@ class ApiFiller(Middleware):
|
|||
msg = _(
|
||||
"Insufficient space on /scratch for request %s, "
|
||||
"/scratch must have at least %d bytes of free space. "
|
||||
"You can delete unused files from /scratch or increase the size of it "
|
||||
"with: 'system host-fs-modify <hostname> scratch=<new_size_in_GiB>'"
|
||||
"You can delete unused files from /scratch or increase the "
|
||||
"size of it with: 'system host-fs-modify <hostname> "
|
||||
"scratch=<new_size_in_GiB>'"
|
||||
) % (req.path, 3 * req.content_length)
|
||||
|
||||
raise webob.exc.HTTPInternalServerError(explanation=msg)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2021 Wind River Systems, Inc
|
||||
# Copyright (c) 2021, 2024 Wind River Systems, Inc
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -14,13 +14,13 @@
|
|||
# limitations under the License.
|
||||
|
||||
import json
|
||||
import six
|
||||
import webob
|
||||
from xml import etree as et
|
||||
|
||||
from dcorch.api.proxy.common.service import Middleware
|
||||
|
||||
from oslo_log import log
|
||||
import six
|
||||
import webob
|
||||
|
||||
from dcorch.api.proxy.common.service import Middleware
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2018-2023 Wind River
|
||||
# Copyright (c) 2018-2024 Wind River Systems, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -19,23 +19,23 @@ import json
|
|||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
from cgcs_patch.patch_functions import get_release_from_patch
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_service.wsgi import Request
|
||||
from oslo_utils._i18n import _
|
||||
import webob.dec
|
||||
import webob.exc
|
||||
|
||||
from cgcs_patch.patch_functions import get_release_from_patch
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
from dcmanager.rpc import client as dcmanager_rpc_client
|
||||
from dcorch.api.proxy.apps.dispatcher import APIDispatcher
|
||||
from dcorch.api.proxy.common import constants as proxy_consts
|
||||
from dcorch.api.proxy.common.service import Middleware
|
||||
from dcorch.api.proxy.common import utils as proxy_utils
|
||||
from dcorch.common import context
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_service.wsgi import Request
|
||||
from oslo_utils._i18n import _
|
||||
|
||||
from dcmanager.rpc import client as dcmanager_rpc_client
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2017-2022 Wind River
|
||||
# Copyright (c) 2017-2022, 2024 Wind River Systems, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -13,10 +13,11 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from dcorch.api.proxy.common.service import Application
|
||||
from oslo_log import log as logging
|
||||
from paste.proxy import TransparentProxy
|
||||
|
||||
from dcorch.api.proxy.common.service import Application
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2017-2021 Wind River Systems, Inc.
|
||||
# Copyright (c) 2017-2021, 2024 Wind River Systems, Inc.
|
||||
#
|
||||
# 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
|
||||
|
@ -56,7 +56,8 @@ class Middleware(Application):
|
|||
|
||||
def _factory(app):
|
||||
# https://bugs.launchpad.net/starlingx/+bug/1865085
|
||||
return cls(app, global_config, **local_config) # pylint: disable=too-many-function-args
|
||||
# pylint: disable-next=too-many-function-args
|
||||
return cls(app, global_config, **local_config)
|
||||
return _factory
|
||||
|
||||
def __init__(self, application):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright 2015 Huawei Technologies Co., Ltd.
|
||||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -17,23 +18,23 @@
|
|||
# see http://git.openstack.org/cgit/openstack/ironic/tree/ironic/cmd/api.py
|
||||
|
||||
|
||||
import logging as std_logging
|
||||
import sys
|
||||
|
||||
import eventlet
|
||||
eventlet.monkey_patch(os=False)
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_service import systemd
|
||||
from oslo_service import wsgi
|
||||
# pylint: disable=wrong-import-position
|
||||
from oslo_config import cfg # noqa: E402
|
||||
from oslo_log import log as logging # noqa: E402
|
||||
from oslo_service import systemd # noqa: E402
|
||||
from oslo_service import wsgi # noqa: E402
|
||||
|
||||
import logging as std_logging
|
||||
|
||||
from dcorch.api import api_config
|
||||
from dcorch.api import app
|
||||
|
||||
from dcorch.common import config
|
||||
from dcorch.common import messaging
|
||||
from dcorch.api import api_config # noqa: E402
|
||||
from dcorch.api import app # noqa: E402
|
||||
from dcorch.common import config # noqa: E402
|
||||
from dcorch.common import messaging # noqa: E402
|
||||
# pylint: enable=wrong-import-position
|
||||
|
||||
CONF = cfg.CONF
|
||||
config.register_options()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright 2015 Huawei Technologies Co., Ltd.
|
||||
# Copyright (c) 2018-2022 Wind River Systems, Inc.
|
||||
# Copyright (c) 2018-2022, 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -17,31 +17,28 @@
|
|||
# Much of this module is based on the work of the Ironic team
|
||||
# see http://git.openstack.org/cgit/openstack/ironic/tree/ironic/cmd/api.py
|
||||
|
||||
|
||||
import eventlet
|
||||
|
||||
eventlet.monkey_patch(os=False)
|
||||
|
||||
import logging as std_logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_service import systemd
|
||||
from oslo_service import wsgi
|
||||
import eventlet
|
||||
eventlet.monkey_patch(os=False)
|
||||
|
||||
import logging as std_logging
|
||||
# pylint: disable=wrong-import-position
|
||||
from oslo_config import cfg # noqa: E402
|
||||
from oslo_log import log as logging # noqa: E402
|
||||
from oslo_service import systemd # noqa: E402
|
||||
from oslo_service import wsgi # noqa: E402
|
||||
|
||||
from dccommon import consts
|
||||
from dcmanager.common import messaging as dcmanager_messaging
|
||||
from dcorch.api import api_config
|
||||
from dcorch.api import app
|
||||
from dcorch.api.proxy.common import constants
|
||||
|
||||
from dcorch.common import config
|
||||
from dcorch.common import messaging
|
||||
|
||||
from dcorch.api.proxy.common import utils
|
||||
from dccommon import consts # noqa: E402
|
||||
from dcmanager.common import messaging as dcmanager_messaging # noqa: E402
|
||||
from dcorch.api import api_config # noqa: E402
|
||||
from dcorch.api import app # noqa: E402
|
||||
from dcorch.api.proxy.common import constants # noqa: E402
|
||||
from dcorch.api.proxy.common import utils # noqa: E402
|
||||
from dcorch.common import config # noqa: E402
|
||||
from dcorch.common import messaging # noqa: E402
|
||||
# pylint: enable=wrong-import-position
|
||||
|
||||
proxy_opts = [
|
||||
cfg.StrOpt('bind_host',
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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
|
||||
|
@ -19,16 +21,18 @@ DC Orchestrators Engine Server.
|
|||
import eventlet
|
||||
eventlet.monkey_patch()
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_i18n import _lazy
|
||||
from oslo_log import log as logging
|
||||
from oslo_service import service
|
||||
# pylint: disable=wrong-import-position
|
||||
from oslo_config import cfg # noqa: E402
|
||||
from oslo_i18n import _lazy # noqa: E402
|
||||
from oslo_log import log as logging # noqa: E402
|
||||
from oslo_service import service # noqa: E402
|
||||
|
||||
from dcmanager.common import messaging as dmanager_messaging
|
||||
from dcorch.common import config
|
||||
from dcorch.common import consts
|
||||
from dcorch.common import messaging
|
||||
from dcorch.engine import service as engine
|
||||
from dcmanager.common import messaging as dmanager_messaging # noqa: E402
|
||||
from dcorch.common import config # noqa: E402
|
||||
from dcorch.common import consts # noqa: E402
|
||||
from dcorch.common import messaging # noqa: E402
|
||||
from dcorch.engine import service as engine # noqa: E402
|
||||
# pylint: enable=wrong-import-position
|
||||
|
||||
_lazy.enable_lazy()
|
||||
config.register_options()
|
||||
|
@ -54,5 +58,6 @@ def main():
|
|||
# srv.create_periodic_tasks()
|
||||
launcher.wait()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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
|
||||
|
@ -92,5 +95,6 @@ def main():
|
|||
except Exception as e:
|
||||
sys.exit("ERROR: %s" % e)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright 2016 Ericsson AB
|
||||
# Copyright (c) 2020-2023 Wind River Systems, Inc.
|
||||
# Copyright (c) 2020-2024 Wind River Systems, Inc.
|
||||
# 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
|
||||
|
@ -220,14 +220,13 @@ usm_opts = [
|
|||
]
|
||||
|
||||
usm_proxy_opts = [
|
||||
cfg.StrOpt('bind_host',
|
||||
default="0.0.0.0",
|
||||
cfg.StrOpt('bind_host', default="0.0.0.0",
|
||||
help='IP address for API proxy to listen for incoming connections'),
|
||||
cfg.IntOpt('bind_port',
|
||||
default=25497,
|
||||
cfg.IntOpt('bind_port', default=25497,
|
||||
help='listen port for API proxy'),
|
||||
cfg.StrOpt('remote_host', default='0.0.0.0',
|
||||
help="The remote host address used for outgoing API proxy connection"),
|
||||
help="The remote host address used for outgoing API proxy "
|
||||
"connection"),
|
||||
cfg.IntOpt('remote_port', default=5497,
|
||||
help="The remote port used for outgoing API proxy connection")
|
||||
]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# Copyright 2015 Huawei Technologies Co., Ltd.
|
||||
# Copyright 2015 Ericsson AB.
|
||||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -40,14 +41,14 @@ class OrchestratorException(Exception):
|
|||
|
||||
def __init__(self, **kwargs):
|
||||
try:
|
||||
super(OrchestratorException, self).__init__(self.message % kwargs) # pylint: disable=W1645
|
||||
self.msg = self.message % kwargs # pylint: disable=W1645
|
||||
super(OrchestratorException, self).__init__(self.message % kwargs)
|
||||
self.msg = self.message % kwargs
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception() as ctxt:
|
||||
if not self.use_fatal_exceptions():
|
||||
ctxt.reraise = False
|
||||
# at least get the core message out if something happened
|
||||
super(OrchestratorException, self).__init__(self.message) # pylint: disable=W1645
|
||||
super(OrchestratorException, self).__init__(self.message)
|
||||
|
||||
if six.PY2:
|
||||
def __unicode__(self):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright 2015 Huawei Technologies Co., Ltd.
|
||||
# Copyright (c) 2020-2022 Wind River Systems, Inc.
|
||||
# Copyright (c) 2020-2022, 2024 Wind River Systems, Inc.
|
||||
# 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
|
||||
|
@ -25,6 +25,7 @@ class Mapping(object):
|
|||
for key, value in mapping.items():
|
||||
self.reverse_mapping[value] = key
|
||||
|
||||
|
||||
_SINGLETON_MAPPING = Mapping({
|
||||
ATTR_NOT_SPECIFIED: "@@**ATTR_NOT_SPECIFIED**@@",
|
||||
})
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright 2015 Huawei Technologies Co., Ltd.
|
||||
# Copyright (c) 2018-2022 Wind River Systems, Inc.
|
||||
# Copyright (c) 2018-2022, 2024 Wind River Systems, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -15,6 +15,9 @@
|
|||
# limitations under the License.
|
||||
|
||||
import itertools
|
||||
|
||||
from oslo_db import exception as oslo_db_exception
|
||||
from oslo_log import log as logging
|
||||
import six.moves
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
|
@ -24,8 +27,6 @@ from dcorch.objects import orchjob
|
|||
from dcorch.objects import orchrequest
|
||||
from dcorch.objects import resource
|
||||
from dcorch.objects import subcloud as subcloud_obj
|
||||
from oslo_db import exception as oslo_db_exception
|
||||
from oslo_log import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -138,7 +139,8 @@ def enqueue_work(context, endpoint_type,
|
|||
master_id=source_resource_id)
|
||||
rsrc.create()
|
||||
LOG.info("Resource created in DB {}/{}/{}/{}".format(
|
||||
rsrc.id, # pylint: disable=E1101
|
||||
# pylint: disable-next=no-member
|
||||
rsrc.id,
|
||||
resource_type, source_resource_id, operation_type))
|
||||
except oslo_db_exception.DBDuplicateEntry:
|
||||
# In case of discrepancies found during audit, resource might
|
||||
|
@ -150,7 +152,8 @@ def enqueue_work(context, endpoint_type,
|
|||
rsrc = resource.Resource.get_by_type_and_master_id(
|
||||
context, resource_type, source_resource_id)
|
||||
LOG.info("Resource already in DB {}/{}/{}/{}".format(
|
||||
rsrc.id, resource_type, source_resource_id, operation_type)) # pylint: disable=E1101
|
||||
# pylint: disable-next=no-member
|
||||
rsrc.id, resource_type, source_resource_id, operation_type))
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
return
|
||||
|
@ -168,10 +171,10 @@ def enqueue_work(context, endpoint_type,
|
|||
rsrc.create()
|
||||
|
||||
# todo: user_id and project_id are not used, to be removed from model
|
||||
# pylint: disable=E1101
|
||||
orch_job = orchjob.OrchJob(
|
||||
context=context, user_id='', project_id='',
|
||||
endpoint_type=endpoint_type, source_resource_id=source_resource_id,
|
||||
# pylint: disable-next=no-member
|
||||
operation_type=operation_type, resource_id=rsrc.id,
|
||||
resource_info=resource_info)
|
||||
orch_job.create()
|
||||
|
@ -183,7 +186,9 @@ def enqueue_work(context, endpoint_type,
|
|||
orch_req = orchrequest.OrchRequest(
|
||||
context=context, state=consts.ORCH_REQUEST_QUEUED,
|
||||
target_region_name=sc.region_name,
|
||||
orch_job_id=orch_job.id) # pylint: disable=E1101
|
||||
# pylint: disable-next=no-member
|
||||
orch_job_id=orch_job.id)
|
||||
orch_req.create()
|
||||
LOG.info("Work order created for {}:{}/{}/{}/{}".format(
|
||||
subcloud, rsrc.id, resource_type, source_resource_id, operation_type)) # pylint: disable=E1101
|
||||
# pylint: disable-next=no-member
|
||||
subcloud, rsrc.id, resource_type, source_resource_id, operation_type))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2017-2018 Wind River Inc.
|
||||
# Copyright (c) 2017-2018, 2024 Wind River Inc.
|
||||
# All Rights Reserved.
|
||||
# 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
|
||||
|
@ -108,7 +108,9 @@ def upgrade(migrate_engine):
|
|||
meta.drop_all(tables=tables[:index])
|
||||
raise
|
||||
|
||||
rows = quota_classes.count().where(quota_classes.c.class_name == 'default').execute().scalar() # pylint: disable=E1120
|
||||
# pylint: disable-next=no-value-for-parameter
|
||||
rows = quota_classes.count().where(
|
||||
quota_classes.c.class_name == 'default').execute().scalar()
|
||||
|
||||
# Do not add entries if there are already 'default' entries. We don't
|
||||
# want to write over something the user added.
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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
|
||||
|
@ -12,13 +15,12 @@
|
|||
|
||||
from collections import defaultdict
|
||||
|
||||
from neutronclient.neutron import client
|
||||
from oslo_log import log
|
||||
|
||||
from dcorch.common import exceptions
|
||||
from dcorch.drivers import base
|
||||
|
||||
from neutronclient.neutron import client
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
API_VERSION = '2.0'
|
||||
|
||||
|
@ -31,7 +33,7 @@ class NeutronClient(base.DriverBase):
|
|||
API_VERSION, session=session,
|
||||
region_name=region,
|
||||
endpoint_type=endpoint_type,
|
||||
)
|
||||
)
|
||||
self.extension_list = self.neutron.list_extensions()
|
||||
self.disabled_quotas = disabled_quotas
|
||||
self.no_network = True if 'floatingip' in self.disabled_quotas \
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright 2016 Ericsson AB
|
||||
# Copyright (c) 2018-2022 Wind River Systems, Inc.
|
||||
# Copyright (c) 2018-2022, 2024 Wind River Systems, Inc.
|
||||
#
|
||||
# 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
|
||||
|
@ -14,14 +14,13 @@
|
|||
# under the License.
|
||||
import collections
|
||||
|
||||
from novaclient import client
|
||||
from oslo_log import log
|
||||
|
||||
from dccommon import consts
|
||||
from dcorch.common import exceptions
|
||||
from dcorch.drivers import base
|
||||
|
||||
from novaclient import client
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
API_VERSION = '2.37'
|
||||
|
||||
|
@ -88,11 +87,8 @@ class NovaClient(base.DriverBase):
|
|||
except exceptions.InternalError:
|
||||
raise
|
||||
|
||||
# Since additional parameter variables are added on top of abc class previously defined
|
||||
# Pylint will raise a warning (W0237) saying parameter got renamed. Added suppress to ignore
|
||||
# Since alarm W0237 was not introduced until pylint 2.1x, the CentOS pylint (running 2.3) will
|
||||
# raise an alarm (E0012) on W0237 suggesting it is invalid, Another suppress is added for E0012
|
||||
def update_quota_limits(self, project_id, user_id, **new_quota): # pylint: disable=E0012,W0237
|
||||
# pylint: disable-next=arguments-renamed
|
||||
def update_quota_limits(self, project_id, user_id, **new_quota):
|
||||
"""Update quota limits for a given project.
|
||||
|
||||
:params: project_id, dictionary with the quota limits to update
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright 2016 Ericsson AB
|
||||
# Copyright (c) 2021 Wind River Systems, Inc.
|
||||
# Copyright (c) 2021, 2024 Wind River Systems, Inc.
|
||||
# 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
|
||||
|
@ -71,7 +71,8 @@ class OpenStackDriver(object):
|
|||
region_name] = collections.defaultdict(dict)
|
||||
|
||||
try:
|
||||
sysinv_endpoint = self.keystone_client.endpoint_cache.get_endpoint('sysinv')
|
||||
sysinv_endpoint = self.keystone_client.endpoint_cache.get_endpoint(
|
||||
'sysinv')
|
||||
self.sysinv_client = SysinvClient(region_name,
|
||||
self.keystone_client.session,
|
||||
endpoint=sysinv_endpoint)
|
||||
|
@ -139,7 +140,7 @@ class OpenStackDriver(object):
|
|||
LOG.error('Error Occurred : %s', str(exception))
|
||||
|
||||
def get_resource_usages(self, project_id, user_id):
|
||||
raise(NotImplementedError)
|
||||
raise NotImplementedError
|
||||
|
||||
# # If one of the resources is unavailable we still want to return
|
||||
# # any usage information we have for the others.
|
||||
|
@ -165,7 +166,7 @@ class OpenStackDriver(object):
|
|||
# return nova_usages, neutron_usages, cinder_usages
|
||||
|
||||
def get_quota_limits(self, project_id, user_id):
|
||||
raise(NotImplementedError)
|
||||
raise NotImplementedError
|
||||
|
||||
# # If one of the resources is unavailable we still want to return
|
||||
# # any limit information we have for the others.
|
||||
|
@ -191,7 +192,7 @@ class OpenStackDriver(object):
|
|||
# return nova_limits, neutron_limits, cinder_limits
|
||||
|
||||
def write_quota_limits(self, project_id, user_id, limits_to_write):
|
||||
raise(NotImplementedError)
|
||||
raise NotImplementedError
|
||||
|
||||
# try:
|
||||
# self.nova_client.update_quota_limits(project_id, user_id,
|
||||
|
@ -211,7 +212,7 @@ class OpenStackDriver(object):
|
|||
# LOG.error('Error Occurred: %s', exception.message)
|
||||
|
||||
def delete_quota_limits(self, project_id):
|
||||
raise(NotImplementedError)
|
||||
raise NotImplementedError
|
||||
|
||||
# try:
|
||||
# self.nova_client.delete_quota_limits(project_id)
|
||||
|
@ -225,7 +226,7 @@ class OpenStackDriver(object):
|
|||
# LOG.error('Error Occurred: %s', exception.message)
|
||||
|
||||
def _get_disabled_quotas(self, region):
|
||||
raise(NotImplementedError)
|
||||
raise NotImplementedError
|
||||
|
||||
# disabled_quotas = []
|
||||
# if not self.keystone_client.is_service_enabled('volume') and \
|
||||
|
@ -247,8 +248,7 @@ class OpenStackDriver(object):
|
|||
if not region_lists:
|
||||
# If endpoint filter is not used for the project, then
|
||||
# return all regions
|
||||
region_lists = \
|
||||
KeystoneClient().endpoint_cache.get_all_regions()
|
||||
region_lists = KeystoneClient().endpoint_cache.get_all_regions()
|
||||
# nova, cinder, and neutron have no endpoints in consts.CLOUD_0
|
||||
if dccommon_consts.CLOUD_0 in region_lists:
|
||||
region_lists.remove(dccommon_consts.CLOUD_0)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2018-2022 Wind River
|
||||
# Copyright (c) 2018-2022, 2024 Wind River Systems, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -13,9 +13,9 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from eventlet.green import subprocess
|
||||
import os
|
||||
|
||||
from eventlet.green import subprocess
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
|
@ -95,9 +95,10 @@ class FernetKeyManager(manager.Manager):
|
|||
# No cached client is required as it is called during the initial
|
||||
# sync and after weekly key rotation
|
||||
ks_client = KeystoneClient(dccommon_consts.CLOUD_0)
|
||||
sysinv_client = SysinvClient(dccommon_consts.CLOUD_0,
|
||||
ks_client.session,
|
||||
endpoint=ks_client.endpoint_cache.get_endpoint('sysinv'))
|
||||
sysinv_client = SysinvClient(
|
||||
dccommon_consts.CLOUD_0,
|
||||
ks_client.session,
|
||||
endpoint=ks_client.endpoint_cache.get_endpoint('sysinv'))
|
||||
keys = sysinv_client.get_fernet_keys()
|
||||
except (exceptions.ConnectionRefused, exceptions.NotAuthorized,
|
||||
exceptions.TimeOut):
|
||||
|
@ -142,9 +143,10 @@ class FernetKeyManager(manager.Manager):
|
|||
# No cached client is required as it is only called during the
|
||||
# initial sync
|
||||
ks_client = KeystoneClient(subcloud_name)
|
||||
sysinv_client = SysinvClient(subcloud_name,
|
||||
ks_client.session,
|
||||
endpoint=ks_client.endpoint_cache.get_endpoint('sysinv'))
|
||||
sysinv_client = SysinvClient(
|
||||
subcloud_name,
|
||||
ks_client.session,
|
||||
endpoint=ks_client.endpoint_cache.get_endpoint('sysinv'))
|
||||
sysinv_client.post_fernet_repo(key_list)
|
||||
except (exceptions.ConnectionRefused, exceptions.NotAuthorized,
|
||||
exceptions.TimeOut):
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Copyright 2017 Ericsson AB.
|
||||
# Copyright (c) 2020-2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -12,14 +14,11 @@
|
|||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Copyright (c) 2020-2023 Wind River Systems, Inc.
|
||||
#
|
||||
|
||||
import eventlet
|
||||
import collections # noqa: H306
|
||||
import collections
|
||||
import random
|
||||
|
||||
import eventlet
|
||||
from keystoneauth1 import exceptions as keystone_exceptions
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
|
@ -227,7 +226,8 @@ class GenericSyncManager(object):
|
|||
sc = sc.create()
|
||||
for endpoint_type in endpoint_type_list:
|
||||
db_api.subcloud_sync_create(context, name, endpoint_type,
|
||||
values={'subcloud_id': sc.id}) # pylint: disable=E1101
|
||||
# pylint: disable-next=no-member
|
||||
values={'subcloud_id': sc.id})
|
||||
# Create the sync object for this engine
|
||||
self.create_sync_objects(name, capabilities)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright 2016 Ericsson AB
|
||||
# Copyright (c) 2018-2022 Wind River Systems, Inc.
|
||||
# Copyright (c) 2018-2022, 2024 Wind River Systems, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -17,12 +17,12 @@
|
|||
import collections
|
||||
import copy
|
||||
import re
|
||||
from six.moves.queue import Queue
|
||||
import threading
|
||||
import time
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from six.moves.queue import Queue
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
from dccommon import endpoint_cache
|
||||
|
@ -347,7 +347,7 @@ class QuotaManager(manager.Manager):
|
|||
|
||||
total_project_usages, regions_usage_dict = self.quota_usage_update(
|
||||
project_id, user_id)
|
||||
if ((total_project_usages, regions_usage_dict) == (None, None)):
|
||||
if (total_project_usages, regions_usage_dict) == (None, None):
|
||||
return
|
||||
|
||||
# Get the global limit for this project from the master subcloud.
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright (c) 2020-2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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
|
||||
|
@ -9,18 +12,18 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Copyright (c) 2020-2023 Wind River Systems, Inc.
|
||||
#
|
||||
|
||||
import six
|
||||
import time
|
||||
|
||||
import functools
|
||||
import resource
|
||||
import time
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
import resource
|
||||
from oslo_service import service
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
from dcorch.common import consts
|
||||
|
@ -35,9 +38,6 @@ from dcorch.engine.initial_sync_manager import InitialSyncManager
|
|||
from dcorch.engine.quota_manager import QuotaManager
|
||||
from dcorch.engine import scheduler
|
||||
from dcorch.objects import service as service_obj
|
||||
from oslo_service import service
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
CONF = cfg.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# Copyright 2017-2018, 2022 Wind River
|
||||
|
||||
# Copyright (c) 2017-2018, 2022, 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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
|
||||
|
@ -308,52 +309,49 @@ class ComputeSyncThread(SyncThread):
|
|||
switcher[action](rsrc, action, action_dict, subcloud_rsrc)
|
||||
|
||||
def add_tenant_access(self, rsrc, action, action_dict, subcloud_rsrc):
|
||||
tenant_id = action_dict[action]['tenant']
|
||||
try:
|
||||
self.sc_nova_client.flavor_access.add_tenant_access(
|
||||
subcloud_rsrc.subcloud_resource_id, tenant_id)
|
||||
except novaclient_exceptions.Conflict:
|
||||
LOG.info("Flavor-access already present {}:{}"
|
||||
.format(rsrc, action_dict),
|
||||
extra=self.log_extra)
|
||||
tenant_id = action_dict[action]['tenant']
|
||||
try:
|
||||
self.sc_nova_client.flavor_access.add_tenant_access(
|
||||
subcloud_rsrc.subcloud_resource_id, tenant_id)
|
||||
except novaclient_exceptions.Conflict:
|
||||
LOG.info("Flavor-access already present {}:{}".format(rsrc, action_dict),
|
||||
extra=self.log_extra)
|
||||
|
||||
def remove_tenant_access(self, rsrc, action, action_dict, subcloud_rsrc):
|
||||
tenant_id = action_dict[action]['tenant']
|
||||
try:
|
||||
self.sc_nova_client.flavor_access.remove_tenant_access(
|
||||
subcloud_rsrc.subcloud_resource_id, tenant_id)
|
||||
except novaclient_exceptions.NotFound:
|
||||
LOG.info("Flavor-access already deleted {}:{}"
|
||||
.format(rsrc, action_dict),
|
||||
extra=self.log_extra)
|
||||
tenant_id = action_dict[action]['tenant']
|
||||
try:
|
||||
self.sc_nova_client.flavor_access.remove_tenant_access(
|
||||
subcloud_rsrc.subcloud_resource_id, tenant_id)
|
||||
except novaclient_exceptions.NotFound:
|
||||
LOG.info("Flavor-access already deleted {}:{}".format(rsrc, action_dict),
|
||||
extra=self.log_extra)
|
||||
|
||||
def set_extra_specs(self, rsrc, action, action_dict, subcloud_rsrc):
|
||||
flavor = novaclient_utils.find_resource(
|
||||
self.sc_nova_client.flavors,
|
||||
subcloud_rsrc.subcloud_resource_id, is_public=None)
|
||||
flavor.set_keys(action_dict[action])
|
||||
# No need to handle "extra-spec already exists" case.
|
||||
# Nova throws no exception for that.
|
||||
flavor = novaclient_utils.find_resource(
|
||||
self.sc_nova_client.flavors,
|
||||
subcloud_rsrc.subcloud_resource_id, is_public=None)
|
||||
flavor.set_keys(action_dict[action])
|
||||
# No need to handle "extra-spec already exists" case.
|
||||
# Nova throws no exception for that.
|
||||
|
||||
def unset_extra_specs(self, rsrc, action, action_dict, subcloud_rsrc):
|
||||
flavor = novaclient_utils.find_resource(
|
||||
self.sc_nova_client.flavors,
|
||||
subcloud_rsrc.subcloud_resource_id, is_public=None)
|
||||
flavor = novaclient_utils.find_resource(
|
||||
self.sc_nova_client.flavors,
|
||||
subcloud_rsrc.subcloud_resource_id, is_public=None)
|
||||
|
||||
es_metadata = action_dict[action]
|
||||
metadata = {}
|
||||
# extra_spec keys passed in could be of format "key1"
|
||||
# or "key1;key2;key3"
|
||||
for metadatum in es_metadata.split(';'):
|
||||
if metadatum:
|
||||
metadata[metadatum] = None
|
||||
es_metadata = action_dict[action]
|
||||
metadata = {}
|
||||
# extra_spec keys passed in could be of format "key1"
|
||||
# or "key1;key2;key3"
|
||||
for metadatum in es_metadata.split(';'):
|
||||
if metadatum:
|
||||
metadata[metadatum] = None
|
||||
|
||||
try:
|
||||
flavor.unset_keys(list(metadata.keys()))
|
||||
except novaclient_exceptions.NotFound:
|
||||
LOG.info("Extra-spec {} not found {}:{}"
|
||||
.format(list(metadata.keys()), rsrc, action_dict),
|
||||
extra=self.log_extra)
|
||||
try:
|
||||
flavor.unset_keys(list(metadata.keys()))
|
||||
except novaclient_exceptions.NotFound:
|
||||
LOG.info("Extra-spec {} not found {}:{}".format(
|
||||
list(metadata.keys()), rsrc, action_dict), extra=self.log_extra)
|
||||
|
||||
def get_flavor_resources(self, nc):
|
||||
try:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright 2018-2022 Wind River
|
||||
# Copyright (c) 2018-2022, 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -16,6 +17,10 @@
|
|||
import base64
|
||||
from collections import namedtuple
|
||||
|
||||
from keystoneauth1 import exceptions as keystone_exceptions
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
from dccommon.drivers.openstack import sdk_platform as sdk
|
||||
from dcdbsync.dbsyncclient import exceptions as dbsync_exceptions
|
||||
|
@ -24,12 +29,6 @@ from dcorch.common import exceptions
|
|||
from dcorch.engine.sync_thread import SyncThread
|
||||
from dcorch.objects import resource
|
||||
|
||||
from keystoneauth1 import exceptions as keystone_exceptions
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -155,7 +154,8 @@ class IdentitySyncThread(SyncThread):
|
|||
|
||||
def _initial_sync_groups(self, m_groups, sc_groups):
|
||||
# Particularly sync groups with same name but different ID.
|
||||
m_client = self.get_dbs_client(self.master_region_name).identity_group_manager
|
||||
m_client = self.get_dbs_client(
|
||||
self.master_region_name).identity_group_manager
|
||||
sc_client = self.get_dbs_client(self.region_name).identity_group_manager
|
||||
|
||||
for m_group in m_groups:
|
||||
|
@ -1555,7 +1555,7 @@ class IdentitySyncThread(SyncThread):
|
|||
consts.RESOURCE_TYPE_IDENTITY_GROUPS]
|
||||
|
||||
filtered_groups = [group for group in groups if
|
||||
all(group.name != filtered for # pylint: disable=comprehension-escape
|
||||
all(group.name != filtered for
|
||||
filtered in filtered_list)]
|
||||
return filtered_groups
|
||||
except (keystone_exceptions.connection.ConnectTimeout,
|
||||
|
@ -1582,7 +1582,7 @@ class IdentitySyncThread(SyncThread):
|
|||
consts.RESOURCE_TYPE_IDENTITY_ROLES]
|
||||
|
||||
filtered_roles = [role for role in roles if
|
||||
(all(role.name != filtered for # pylint: disable=comprehension-escape
|
||||
(all(role.name != filtered for
|
||||
filtered in filtered_list))]
|
||||
return filtered_roles
|
||||
except (keystone_exceptions.connection.ConnectTimeout,
|
||||
|
@ -1609,7 +1609,7 @@ class IdentitySyncThread(SyncThread):
|
|||
consts.RESOURCE_TYPE_IDENTITY_PROJECTS]
|
||||
|
||||
filtered_projects = [project for project in projects if
|
||||
all(project.name != filtered for # pylint: disable=comprehension-escape
|
||||
all(project.name != filtered for
|
||||
filtered in filtered_list)]
|
||||
return filtered_projects
|
||||
except (keystone_exceptions.connection.ConnectTimeout,
|
||||
|
@ -1640,7 +1640,8 @@ class IdentitySyncThread(SyncThread):
|
|||
# about syncing or auditing them for now
|
||||
continue
|
||||
role_id = assignment.role['id']
|
||||
actor_id = assignment.user['id'] if hasattr(assignment, 'user') else assignment.group['id']
|
||||
actor_id = assignment.user['id'] if hasattr(
|
||||
assignment, 'user') else assignment.group['id']
|
||||
project_id = assignment.scope['project']['id']
|
||||
assignment_dict = {}
|
||||
|
||||
|
@ -1873,12 +1874,12 @@ class IdentitySyncThread(SyncThread):
|
|||
# audit_find_missing(). same_resource() in audit_find_missing() is
|
||||
# actually redundant for assignment but it's the generic algorithm
|
||||
# for all types of resources.
|
||||
return((m.actor.name == sc.actor.name and
|
||||
m.actor.domain_id == sc.actor.domain_id) and
|
||||
(m.role.name == sc.role.name and
|
||||
m.role.domain_id == sc.role.domain_id) and
|
||||
(m.project.name == sc.project.name and
|
||||
m.project.domain_id == sc.project.domain_id))
|
||||
return ((m.actor.name == sc.actor.name and
|
||||
m.actor.domain_id == sc.actor.domain_id) and
|
||||
(m.role.name == sc.role.name and
|
||||
m.role.domain_id == sc.role.domain_id) and
|
||||
(m.project.name == sc.project.name and
|
||||
m.project.domain_id == sc.project.domain_id))
|
||||
|
||||
def _has_same_assignment_ids(self, m, sc):
|
||||
# For assignment the unique id is projectID_userID_roleID.
|
||||
|
@ -1893,18 +1894,18 @@ class IdentitySyncThread(SyncThread):
|
|||
# DB records. The DB records are from revocation_event tables.
|
||||
# Token revocation events are considered the same when all columns
|
||||
# match up.
|
||||
return(m.domain_id == sc.domain_id and
|
||||
m.project_id == sc.project_id and
|
||||
m.user_id == sc.user_id and
|
||||
m.role_id == sc.role_id and
|
||||
m.trust_id == sc.trust_id and
|
||||
m.consumer_id == sc.consumer_id and
|
||||
m.access_token_id == sc.access_token_id and
|
||||
m.issued_before == sc.issued_before and
|
||||
m.expires_at == sc.expires_at and
|
||||
m.revoked_at == sc.revoked_at and
|
||||
m.audit_id == sc.audit_id and
|
||||
m.audit_chain_id == sc.audit_chain_id)
|
||||
return (m.domain_id == sc.domain_id and
|
||||
m.project_id == sc.project_id and
|
||||
m.user_id == sc.user_id and
|
||||
m.role_id == sc.role_id and
|
||||
m.trust_id == sc.trust_id and
|
||||
m.consumer_id == sc.consumer_id and
|
||||
m.access_token_id == sc.access_token_id and
|
||||
m.issued_before == sc.issued_before and
|
||||
m.expires_at == sc.expires_at and
|
||||
m.revoked_at == sc.revoked_at and
|
||||
m.audit_id == sc.audit_id and
|
||||
m.audit_chain_id == sc.audit_chain_id)
|
||||
|
||||
def _has_same_revoke_event_ids(self, m, sc):
|
||||
# For token revoke events to have same ids, all columns must be
|
||||
|
@ -2155,7 +2156,6 @@ class IdentitySyncThread(SyncThread):
|
|||
consts.RESOURCE_TYPE_IDENTITY_PROJECTS,
|
||||
consts.RESOURCE_TYPE_IDENTITY_ROLES,
|
||||
consts.RESOURCE_TYPE_IDENTITY_TOKEN_REVOKE_EVENTS,
|
||||
consts.RESOURCE_TYPE_IDENTITY_TOKEN_REVOKE_EVENTS_FOR_USER
|
||||
]:
|
||||
consts.RESOURCE_TYPE_IDENTITY_TOKEN_REVOKE_EVENTS_FOR_USER]:
|
||||
return True
|
||||
return False
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright 2017-2022 Wind River
|
||||
# Copyright (c) 2017-2022, 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -139,7 +140,7 @@ class SysinvSyncThread(SyncThread):
|
|||
payload = dns_dict.get('payload')
|
||||
|
||||
nameservers = None
|
||||
if type(payload) is list:
|
||||
if isinstance(payload, list):
|
||||
for ipayload in payload:
|
||||
if ipayload.get('path') == '/nameservers':
|
||||
nameservers = ipayload.get('value')
|
||||
|
@ -350,7 +351,7 @@ class SysinvSyncThread(SyncThread):
|
|||
payload = user_dict.get('payload')
|
||||
|
||||
passwd_hash = None
|
||||
if type(payload) is list:
|
||||
if isinstance(payload, list):
|
||||
for ipayload in payload:
|
||||
if ipayload.get('path') == '/passwd_hash':
|
||||
passwd_hash = ipayload.get('value')
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright 2017-2023 Wind River
|
||||
# Copyright (c) 2017-2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -108,7 +109,7 @@ class SyncThread(object):
|
|||
def is_subcloud_managed(self):
|
||||
# is this subcloud managed
|
||||
subcloud = Subcloud.get_by_name(self.ctxt, self.subcloud_name)
|
||||
return subcloud.management_state == dccommon_consts.MANAGEMENT_MANAGED # pylint: disable=E1101
|
||||
return subcloud.management_state == dccommon_consts.MANAGEMENT_MANAGED
|
||||
|
||||
def is_subcloud_enabled(self):
|
||||
# is this subcloud enabled
|
||||
|
@ -116,8 +117,8 @@ class SyncThread(object):
|
|||
|
||||
# We only enable syncing if the subcloud is online and the initial
|
||||
# sync has completed.
|
||||
if subcloud.availability_status == dccommon_consts.AVAILABILITY_ONLINE and \
|
||||
subcloud.initial_sync_state == consts.INITIAL_SYNC_STATE_COMPLETED: # pylint: disable=E1101
|
||||
if subcloud.availability_status == dccommon_consts.AVAILABILITY_ONLINE and (
|
||||
subcloud.initial_sync_state == consts.INITIAL_SYNC_STATE_COMPLETED):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
@ -396,11 +397,10 @@ class SyncThread(object):
|
|||
request_aborted = False
|
||||
try:
|
||||
for request in actual_sync_requests:
|
||||
if not self.is_subcloud_enabled() or \
|
||||
self.should_exit():
|
||||
# Oops, someone disabled the endpoint while
|
||||
# we were processing work for it.
|
||||
raise exceptions.EndpointNotReachable()
|
||||
if not self.is_subcloud_enabled() or self.should_exit():
|
||||
# Oops, someone disabled the endpoint while
|
||||
# we were processing work for it.
|
||||
raise exceptions.EndpointNotReachable()
|
||||
request.state = consts.ORCH_REQUEST_STATE_IN_PROGRESS
|
||||
try:
|
||||
request.save() # save to DB
|
||||
|
@ -736,7 +736,7 @@ class SyncThread(object):
|
|||
# Resource implementation should handle this.
|
||||
num_of_audit_jobs += self.audit_dependants(
|
||||
resource_type, m_r, None)
|
||||
if(num_of_audit_jobs != 0):
|
||||
if (num_of_audit_jobs != 0):
|
||||
LOG.info("audit_find_missing {} num_of_audit_jobs".
|
||||
format(num_of_audit_jobs), extra=self.log_extra)
|
||||
return num_of_audit_jobs
|
||||
|
@ -837,7 +837,7 @@ class SyncThread(object):
|
|||
m_resources = None
|
||||
db_resources = None
|
||||
# Query subcloud first. If not reachable, abort audit.
|
||||
sc_resources = self.get_subcloud_resources(resource_type) # pylint: disable=E1128
|
||||
sc_resources = self.get_subcloud_resources(resource_type)
|
||||
if sc_resources is None:
|
||||
return m_resources, db_resources, sc_resources
|
||||
db_resources = self.get_db_master_resources(resource_type)
|
||||
|
@ -849,7 +849,7 @@ class SyncThread(object):
|
|||
if resource_type in SyncThread.master_resources_dict:
|
||||
m_resources = SyncThread.master_resources_dict[resource_type]
|
||||
else:
|
||||
m_resources = self.get_master_resources(resource_type) # pylint: disable=E1128
|
||||
m_resources = self.get_master_resources(resource_type)
|
||||
if m_resources is not None:
|
||||
SyncThread.master_resources_dict[resource_type] = m_resources
|
||||
return m_resources
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright (c) 2015 Ericsson AB.
|
||||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -15,10 +16,11 @@
|
|||
|
||||
"""OrchJob object."""
|
||||
|
||||
from oslo_versionedobjects import fields as ovo_fields
|
||||
|
||||
from dcorch.common import exceptions
|
||||
from dcorch.db import api as db_api
|
||||
from dcorch.objects import base
|
||||
from oslo_versionedobjects import fields as ovo_fields
|
||||
|
||||
|
||||
@base.OrchestratorObjectRegistry.register
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright (c) 2015 Ericsson AB.
|
||||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -15,12 +16,13 @@
|
|||
|
||||
"""OrchRequest object."""
|
||||
|
||||
from oslo_versionedobjects import base as ovo_base
|
||||
from oslo_versionedobjects import fields as ovo_fields
|
||||
|
||||
from dcorch.common import exceptions
|
||||
from dcorch.db import api as db_api
|
||||
from dcorch.objects import base
|
||||
from dcorch.objects import orchjob
|
||||
from oslo_versionedobjects import base as ovo_base
|
||||
from oslo_versionedobjects import fields as ovo_fields
|
||||
|
||||
|
||||
@base.OrchestratorObjectRegistry.register
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright (c) 2015 Ericsson AB.
|
||||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -15,11 +16,12 @@
|
|||
|
||||
"""Resource object."""
|
||||
|
||||
from oslo_versionedobjects import base as ovo_base
|
||||
from oslo_versionedobjects import fields as ovo_fields
|
||||
|
||||
from dcorch.common import exceptions
|
||||
from dcorch.db import api as db_api
|
||||
from dcorch.objects import base
|
||||
from oslo_versionedobjects import base as ovo_base
|
||||
from oslo_versionedobjects import fields as ovo_fields
|
||||
|
||||
|
||||
@base.OrchestratorObjectRegistry.register
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright (c) 2015 Ericsson AB.
|
||||
# Copyright (c) 2020-2022 Wind River Systems, Inc.
|
||||
# Copyright (c) 2020-2022, 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -16,9 +16,10 @@
|
|||
|
||||
"""Service object."""
|
||||
|
||||
from oslo_versionedobjects import fields as ovo_fields
|
||||
|
||||
from dcorch.db import api as db_api
|
||||
from dcorch.objects import base
|
||||
from oslo_versionedobjects import fields as ovo_fields
|
||||
|
||||
|
||||
@base.OrchestratorObjectRegistry.register
|
||||
|
@ -54,14 +55,9 @@ class Service(base.OrchestratorObject, base.VersionedObjectDictCompat):
|
|||
objs = db_api.service_get_all(context)
|
||||
return [cls._from_db_object(context, cls(), obj) for obj in objs]
|
||||
|
||||
# A function named update has been defined inside the base class (oslo_versionedobjects)
|
||||
# which was defined with different parameters and served a different purpose
|
||||
# Pylint was not able to distinguish the two thus raised an warning (W0237) suggesting
|
||||
# undesired parameter name change. Added suppress to ignore this check
|
||||
# Since alarm W0237 was not introduced until pylint 2.1x, the CentOS pylint (running 2.3) will
|
||||
# raise an alarm (E0012) on W0237 suggesting it is invalid, Another suppress is added for E0012
|
||||
@classmethod
|
||||
def update(cls, context, obj_id, values=None): # pylint: disable=E0012,W0237
|
||||
# pylint: disable-next=arguments-renamed
|
||||
def update(cls, context, obj_id, values=None):
|
||||
obj = db_api.service_update(context, obj_id, values=values)
|
||||
return cls._from_db_object(context, cls(), obj)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright (c) 2015 Ericsson AB.
|
||||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -18,12 +19,12 @@
|
|||
|
||||
"""Subcloud object."""
|
||||
from oslo_log import log as logging
|
||||
from oslo_versionedobjects import base as ovo_base
|
||||
from oslo_versionedobjects import fields as ovo_fields
|
||||
|
||||
from dcorch.common import exceptions
|
||||
from dcorch.db import api as db_api
|
||||
from dcorch.objects import base
|
||||
from oslo_versionedobjects import base as ovo_base
|
||||
from oslo_versionedobjects import fields as ovo_fields
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright (c) 2015 Ericsson AB.
|
||||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -15,14 +16,16 @@
|
|||
|
||||
"""SubcloudResource object."""
|
||||
|
||||
from oslo_versionedobjects import base as ovo_base
|
||||
from oslo_versionedobjects import fields as ovo_fields
|
||||
|
||||
from dcorch.common import consts
|
||||
from dcorch.common import exceptions
|
||||
from dcorch.db import api as db_api
|
||||
from dcorch.objects import base
|
||||
from oslo_versionedobjects import base as ovo_base
|
||||
from oslo_versionedobjects import fields as ovo_fields
|
||||
|
||||
|
||||
# pylint: disable=no-member
|
||||
@base.OrchestratorObjectRegistry.register
|
||||
class SubcloudResource(base.OrchestratorObject,
|
||||
base.VersionedObjectDictCompat):
|
||||
|
@ -56,7 +59,7 @@ class SubcloudResource(base.OrchestratorObject,
|
|||
return self._from_db_object(self._context, self, db_subcloud_resource)
|
||||
|
||||
def is_managed(self):
|
||||
return self.shared_config_state == consts.SHARED_CONFIG_STATE_MANAGED # pylint: disable=E1101
|
||||
return self.shared_config_state == consts.SHARED_CONFIG_STATE_MANAGED
|
||||
|
||||
@classmethod
|
||||
def get_by_id(cls, context, id):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright (c) 2015 Ericsson AB
|
||||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -15,19 +16,14 @@
|
|||
#
|
||||
# Copyright (c) 2020 Wind River Systems, Inc.
|
||||
#
|
||||
|
||||
|
||||
import sqlalchemy
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_db import options
|
||||
|
||||
from dcorch.db import api as api
|
||||
from dcorch.db.sqlalchemy import api as db_api
|
||||
|
||||
from dcorch.tests import utils
|
||||
from oslotest import base
|
||||
import sqlalchemy
|
||||
|
||||
from dcorch.db import api
|
||||
from dcorch.db.sqlalchemy import api as db_api
|
||||
from dcorch.tests import utils
|
||||
|
||||
get_engine = api.get_engine
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright (c) 2017 Ericsson AB
|
||||
# Copyright (c) 2018-2022 Wind River Systems, Inc.
|
||||
# Copyright (c) 2018-2022, 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -15,19 +15,19 @@
|
|||
# under the License.
|
||||
|
||||
import datetime
|
||||
import oslo_db
|
||||
import sqlalchemy
|
||||
|
||||
from oslo_config import cfg
|
||||
import oslo_db
|
||||
from oslo_db import options
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import sqlalchemy
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
from dcorch.common import config
|
||||
from dcorch.common import consts
|
||||
from dcorch.common import exceptions
|
||||
from dcorch.db import api as api
|
||||
from dcorch.db import api
|
||||
from dcorch.db.sqlalchemy import api as db_api
|
||||
from dcorch.tests import base
|
||||
from dcorch.tests import utils
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright (c) 2015 Ericsson AB
|
||||
# Copyright (c) 2017-2022 Wind River Systems, Inc.
|
||||
# Copyright (c) 2017-2022, 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -23,7 +23,7 @@ from oslo_db import options
|
|||
from dccommon import consts as dccommon_consts
|
||||
from dcorch.common import config
|
||||
from dcorch.common import exceptions
|
||||
from dcorch.db import api as api
|
||||
from dcorch.db import api
|
||||
from dcorch.db.sqlalchemy import api as db_api
|
||||
from dcorch.tests import base
|
||||
from dcorch.tests import utils
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright (c) 2017 Ericsson AB
|
||||
# Copyright (c) 2017-2021 Wind River Systems, Inc.
|
||||
# Copyright (c) 2017-2021, 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -14,17 +14,16 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import oslo_db
|
||||
import sqlalchemy
|
||||
|
||||
from oslo_config import cfg
|
||||
import oslo_db
|
||||
from oslo_db import options
|
||||
from oslo_utils import uuidutils
|
||||
import sqlalchemy
|
||||
|
||||
from dcorch.common import config
|
||||
from dcorch.common import consts
|
||||
from dcorch.common import exceptions
|
||||
from dcorch.db import api as api
|
||||
from dcorch.db import api
|
||||
from dcorch.db.sqlalchemy import api as db_api
|
||||
from dcorch.tests import base
|
||||
from dcorch.tests import utils
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2020-2022 Wind River Systems, Inc.
|
||||
# Copyright (c) 2020-2022, 2024 Wind River Systems, Inc.
|
||||
# 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
|
||||
|
@ -13,6 +13,7 @@
|
|||
#
|
||||
|
||||
import mock
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
from dcorch.common import consts
|
||||
|
@ -20,9 +21,7 @@ from dcorch.common import exceptions
|
|||
from dcorch.db.sqlalchemy import api as db_api
|
||||
from dcorch.engine import generic_sync_manager
|
||||
from dcorch.engine.sync_services import sysinv
|
||||
|
||||
from dcorch.tests import base
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
|
||||
class FakeSyncThread(object):
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Copyright (c) 2020-2022 Wind River Systems, Inc.
|
||||
# Copyright (c) 2020-2022, 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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
|
||||
|
@ -10,17 +12,15 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
import mock
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
from dcorch.common import consts
|
||||
from dcorch.db.sqlalchemy import api as db_api
|
||||
from dcorch.engine import initial_sync_manager
|
||||
|
||||
from dcorch.tests import base
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
|
||||
class FakeGSM(object):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright (c) 2015 Ericsson AB
|
||||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -13,19 +14,18 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import eventlet
|
||||
import random
|
||||
import sqlalchemy
|
||||
import string
|
||||
import uuid
|
||||
|
||||
import eventlet
|
||||
from oslo_config import cfg
|
||||
from oslo_db import options
|
||||
import sqlalchemy
|
||||
|
||||
from dcorch.common import context
|
||||
from dcorch.db import api as db_api
|
||||
|
||||
|
||||
get_engine = db_api.get_engine
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue