diff --git a/dcmanager/api/controllers/v1/sw_update_options.py b/dcmanager/api/controllers/v1/sw_update_options.py index 1b083664e..d91b56297 100644 --- a/dcmanager/api/controllers/v1/sw_update_options.py +++ b/dcmanager/api/controllers/v1/sw_update_options.py @@ -136,8 +136,8 @@ class SwUpdateOptionsController(object): sw_update_opts_ref = db_api.sw_update_opts_default_update( context, payload['storage-apply-type'], - payload['compute-apply-type'], - payload['max-parallel-computes'], + payload['worker-apply-type'], + payload['max-parallel-workers'], payload['alarm-restriction-type'], payload['default-instance-action']) except Exception as e: @@ -149,8 +149,8 @@ class SwUpdateOptionsController(object): sw_update_opts_ref = db_api.sw_update_opts_default_create( context, payload['storage-apply-type'], - payload['compute-apply-type'], - payload['max-parallel-computes'], + payload['worker-apply-type'], + payload['max-parallel-workers'], payload['alarm-restriction-type'], payload['default-instance-action']) except Exception as e: @@ -186,8 +186,8 @@ class SwUpdateOptionsController(object): context, subcloud.id, payload['storage-apply-type'], - payload['compute-apply-type'], - payload['max-parallel-computes'], + payload['worker-apply-type'], + payload['max-parallel-workers'], payload['alarm-restriction-type'], payload['default-instance-action']) @@ -197,8 +197,8 @@ class SwUpdateOptionsController(object): context, subcloud.id, payload['storage-apply-type'], - payload['compute-apply-type'], - payload['max-parallel-computes'], + payload['worker-apply-type'], + payload['max-parallel-workers'], payload['alarm-restriction-type'], payload['default-instance-action']) diff --git a/dcmanager/db/api.py b/dcmanager/db/api.py index a48c705de..a50bedde0 100644 --- a/dcmanager/db/api.py +++ b/dcmanager/db/api.py @@ -289,8 +289,8 @@ def sw_update_opts_w_name_db_model_to_dict(sw_update_opts, subcloud_name): "name": subcloud_name, "subcloud-id": sw_update_opts.subcloud_id, "storage-apply-type": sw_update_opts.storage_apply_type, - "compute-apply-type": sw_update_opts.compute_apply_type, - "max-parallel-computes": sw_update_opts.max_parallel_computes, + "worker-apply-type": sw_update_opts.worker_apply_type, + "max-parallel-workers": sw_update_opts.max_parallel_workers, "alarm-restriction-type": sw_update_opts.alarm_restriction_type, "default-instance-action": sw_update_opts.default_instance_action, @@ -300,13 +300,13 @@ def sw_update_opts_w_name_db_model_to_dict(sw_update_opts, subcloud_name): def sw_update_opts_create(context, subcloud_id, storage_apply_type, - compute_apply_type, max_parallel_computes, + worker_apply_type, max_parallel_workers, alarm_restriction_type, default_instance_action): """Create sw update options.""" return IMPL.sw_update_opts_create(context, subcloud_id, storage_apply_type, - compute_apply_type, - max_parallel_computes, + worker_apply_type, + max_parallel_workers, alarm_restriction_type, default_instance_action) @@ -323,16 +323,16 @@ def sw_update_opts_get_all_plus_subcloud_info(context): def sw_update_opts_update(context, subcloud_id, storage_apply_type=None, - compute_apply_type=None, - max_parallel_computes=None, + worker_apply_type=None, + max_parallel_workers=None, alarm_restriction_type=None, default_instance_action=None): """Update sw update options or raise if it does not exist.""" return IMPL.sw_update_opts_update(context, subcloud_id, storage_apply_type, - compute_apply_type, - max_parallel_computes, + worker_apply_type, + max_parallel_workers, alarm_restriction_type, default_instance_action) @@ -344,14 +344,14 @@ def sw_update_opts_destroy(context, subcloud_id): ################### def sw_update_opts_default_create(context, storage_apply_type, - compute_apply_type, max_parallel_computes, + worker_apply_type, max_parallel_workers, alarm_restriction_type, default_instance_action): """Create default sw update options.""" return IMPL.sw_update_opts_default_create(context, storage_apply_type, - compute_apply_type, - max_parallel_computes, + worker_apply_type, + max_parallel_workers, alarm_restriction_type, default_instance_action) @@ -363,16 +363,16 @@ def sw_update_opts_default_get(context): def sw_update_opts_default_update(context, storage_apply_type=None, - compute_apply_type=None, - max_parallel_computes=None, + worker_apply_type=None, + max_parallel_workers=None, alarm_restriction_type=None, default_instance_action=None): """Update default sw update options.""" return IMPL.sw_update_opts_default_update(context, storage_apply_type, - compute_apply_type, - max_parallel_computes, + worker_apply_type, + max_parallel_workers, alarm_restriction_type, default_instance_action) diff --git a/dcmanager/db/sqlalchemy/api.py b/dcmanager/db/sqlalchemy/api.py index b1b1d86c2..245e3b985 100644 --- a/dcmanager/db/sqlalchemy/api.py +++ b/dcmanager/db/sqlalchemy/api.py @@ -398,16 +398,16 @@ def sw_update_opts_get_all_plus_subcloud_info(context): @require_admin_context def sw_update_opts_create(context, subcloud_id, storage_apply_type, - compute_apply_type, - max_parallel_computes, + worker_apply_type, + max_parallel_workers, alarm_restriction_type, default_instance_action): with write_session() as session: sw_update_opts_ref = models.SwUpdateOpts() sw_update_opts_ref.subcloud_id = subcloud_id sw_update_opts_ref.storage_apply_type = storage_apply_type - sw_update_opts_ref.compute_apply_type = compute_apply_type - sw_update_opts_ref.max_parallel_computes = max_parallel_computes + sw_update_opts_ref.worker_apply_type = worker_apply_type + sw_update_opts_ref.max_parallel_workers = max_parallel_workers sw_update_opts_ref.alarm_restriction_type = alarm_restriction_type sw_update_opts_ref.default_instance_action = default_instance_action session.add(sw_update_opts_ref) @@ -416,17 +416,17 @@ def sw_update_opts_create(context, subcloud_id, storage_apply_type, @require_admin_context def sw_update_opts_update(context, subcloud_id, storage_apply_type=None, - compute_apply_type=None, max_parallel_computes=None, + worker_apply_type=None, max_parallel_workers=None, alarm_restriction_type=None, default_instance_action=None): with write_session() as session: sw_update_opts_ref = sw_update_opts_get(context, subcloud_id) if storage_apply_type is not None: sw_update_opts_ref.storage_apply_type = storage_apply_type - if compute_apply_type is not None: - sw_update_opts_ref.compute_apply_type = compute_apply_type - if max_parallel_computes is not None: - sw_update_opts_ref.max_parallel_computes = max_parallel_computes + if worker_apply_type is not None: + sw_update_opts_ref.worker_apply_type = worker_apply_type + if max_parallel_workers is not None: + sw_update_opts_ref.max_parallel_workers = max_parallel_workers if alarm_restriction_type is not None: sw_update_opts_ref.alarm_restriction_type = alarm_restriction_type if default_instance_action is not None: @@ -458,17 +458,17 @@ def sw_update_opts_default_get(context): @require_admin_context def sw_update_opts_default_create(context, storage_apply_type, - compute_apply_type, - max_parallel_computes, + worker_apply_type, + max_parallel_workers, alarm_restriction_type, default_instance_action): with write_session() as session: sw_update_opts_default_ref = models.SwUpdateOptsDefault() sw_update_opts_default_ref.subcloud_id = 0 sw_update_opts_default_ref.storage_apply_type = storage_apply_type - sw_update_opts_default_ref.compute_apply_type = compute_apply_type - sw_update_opts_default_ref.max_parallel_computes = \ - max_parallel_computes + sw_update_opts_default_ref.worker_apply_type = worker_apply_type + sw_update_opts_default_ref.max_parallel_workers = \ + max_parallel_workers sw_update_opts_default_ref.alarm_restriction_type = \ alarm_restriction_type sw_update_opts_default_ref.default_instance_action = \ @@ -479,19 +479,19 @@ def sw_update_opts_default_create(context, storage_apply_type, @require_admin_context def sw_update_opts_default_update(context, storage_apply_type=None, - compute_apply_type=None, - max_parallel_computes=None, + worker_apply_type=None, + max_parallel_workers=None, alarm_restriction_type=None, default_instance_action=None): with write_session() as session: sw_update_opts_default_ref = sw_update_opts_default_get(context) if storage_apply_type is not None: sw_update_opts_default_ref.storage_apply_type = storage_apply_type - if compute_apply_type is not None: - sw_update_opts_default_ref.compute_apply_type = compute_apply_type - if max_parallel_computes is not None: - sw_update_opts_default_ref.max_parallel_computes = \ - max_parallel_computes + if worker_apply_type is not None: + sw_update_opts_default_ref.worker_apply_type = worker_apply_type + if max_parallel_workers is not None: + sw_update_opts_default_ref.max_parallel_workers = \ + max_parallel_workers if alarm_restriction_type is not None: sw_update_opts_default_ref.alarm_restriction_type = \ alarm_restriction_type diff --git a/dcmanager/db/sqlalchemy/migrate_repo/versions/002_rename_compute_to_worker.py b/dcmanager/db/sqlalchemy/migrate_repo/versions/002_rename_compute_to_worker.py new file mode 100644 index 000000000..261f47826 --- /dev/null +++ b/dcmanager/db/sqlalchemy/migrate_repo/versions/002_rename_compute_to_worker.py @@ -0,0 +1,42 @@ +# 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. +# +# Copyright (c) 2019 Wind River Systems, Inc. +# +# The right to copy, distribute, modify, or otherwise make use +# of this software may be licensed only pursuant to the terms +# of an applicable Wind River license agreement. +# + +from sqlalchemy import MetaData +from sqlalchemy import Table + + +def upgrade(migrate_engine): + meta = MetaData() + meta.bind = migrate_engine + + sw_update_opts_default = Table('sw_update_opts_default', meta, + autoload=True) + sw_update_opts = Table('sw_update_opts', meta, autoload=True) + + columns_to_rename = {'compute_apply_type': 'worker_apply_type', + 'max_parallel_computes': 'max_parallel_workers'} + for k, v in columns_to_rename.items(): + getattr(sw_update_opts_default.c, k).alter(name=v) + getattr(sw_update_opts.c, k).alter(name=v) + + return True + + +def downgrade(migrate_engine): + raise NotImplementedError('Database downgrade is unsupported.') diff --git a/dcmanager/db/sqlalchemy/models.py b/dcmanager/db/sqlalchemy/models.py index de892255f..2418a7447 100644 --- a/dcmanager/db/sqlalchemy/models.py +++ b/dcmanager/db/sqlalchemy/models.py @@ -130,8 +130,8 @@ class SwUpdateOpts(BASE, DCManagerBase): ForeignKey('subclouds.id', ondelete='CASCADE')) storage_apply_type = Column(String(255)) - compute_apply_type = Column(String(255)) - max_parallel_computes = Column(Integer) + worker_apply_type = Column(String(255)) + max_parallel_workers = Column(Integer) alarm_restriction_type = Column(String(255)) default_instance_action = Column(String(255)) @@ -145,8 +145,8 @@ class SwUpdateOptsDefault(BASE, DCManagerBase): subcloud_id = Column(Integer) storage_apply_type = Column(String(255)) - compute_apply_type = Column(String(255)) - max_parallel_computes = Column(Integer) + worker_apply_type = Column(String(255)) + max_parallel_workers = Column(Integer) alarm_restriction_type = Column(String(255)) default_instance_action = Column(String(255)) diff --git a/dcmanager/drivers/openstack/vim.py b/dcmanager/drivers/openstack/vim.py index 1ee40c6b4..594fc887d 100644 --- a/dcmanager/drivers/openstack/vim.py +++ b/dcmanager/drivers/openstack/vim.py @@ -45,8 +45,8 @@ ALARM_RESTRICTIONS_RELAXED = 'relaxed' SW_UPDATE_OPTS_CONST_DEFAULT = { "name": consts.SW_UPDATE_DEFAULT_TITLE, "storage-apply-type": APPLY_TYPE_PARALLEL, - "compute-apply-type": APPLY_TYPE_PARALLEL, - "max-parallel-computes": 10, + "worker-apply-type": APPLY_TYPE_PARALLEL, + "max-parallel-workers": 10, "default-instance-action": INSTANCE_ACTION_MIGRATE, "alarm-restriction-type": ALARM_RESTRICTIONS_RELAXED, "created-at": None, @@ -83,7 +83,7 @@ class VimClient(base.DriverBase): raise def create_strategy(self, strategy_name, storage_apply_type, - compute_apply_type, max_parallel_compute_hosts, + worker_apply_type, max_parallel_worker_hosts, default_instance_action, alarm_restrictions): """Create orchestration strategy""" @@ -94,8 +94,8 @@ class VimClient(base.DriverBase): controller_apply_type=APPLY_TYPE_SERIAL, storage_apply_type=storage_apply_type, swift_apply_type=APPLY_TYPE_IGNORE, - compute_apply_type=compute_apply_type, - max_parallel_compute_hosts=max_parallel_compute_hosts, + worker_apply_type=worker_apply_type, + max_parallel_worker_hosts=max_parallel_worker_hosts, default_instance_action=default_instance_action, alarm_restrictions=alarm_restrictions) if not strategy: diff --git a/dcmanager/manager/sw_update_manager.py b/dcmanager/manager/sw_update_manager.py index 9ddc0c356..78cbe475d 100644 --- a/dcmanager/manager/sw_update_manager.py +++ b/dcmanager/manager/sw_update_manager.py @@ -963,9 +963,9 @@ class PatchOrchThread(threading.Thread): subcloud_strategy = vim_client.create_strategy( strategy_name=vim.STRATEGY_NAME_SW_PATCH, storage_apply_type=opts_dict['storage-apply-type'], - compute_apply_type=opts_dict['compute-apply-type'], - max_parallel_compute_hosts=opts_dict[ - 'max-parallel-computes'], + worker_apply_type=opts_dict['worker-apply-type'], + max_parallel_worker_hosts=opts_dict[ + 'max-parallel-workers'], default_instance_action=opts_dict[ 'default-instance-action'], alarm_restrictions=opts_dict['alarm-restriction-type'])