Add copying of VIPs to node upgrade procedure
According to [1] seed cluster must have assigned nodes in order to copying of VIPs to take an effect. Thus needed command call added to upgrade node procedure. [1]: https://bugs.launchpad.net/fuel/+bug/1549254 Change-Id: I5ce2f50333e8993fde317d2853395e0d83260a51 Depends-On: I33670e8f2561be6fe18cec75bfc7ecc056ae2f6b Partial-Bug: #1552744
This commit is contained in:
parent
25235950ea
commit
e824b554f0
@ -53,6 +53,12 @@ def upgrade_node(env_id, node_ids, isolated=False, network_template=None):
|
|||||||
call_handlers('preupgrade')
|
call_handlers('preupgrade')
|
||||||
call_handlers('prepare')
|
call_handlers('prepare')
|
||||||
env_util.move_nodes(env, nodes)
|
env_util.move_nodes(env, nodes)
|
||||||
|
|
||||||
|
# NOTE(aroma): copying of VIPs must be done after node reassignment
|
||||||
|
# as according to [1] otherwise the operation will not take any effect
|
||||||
|
# [1]: https://bugs.launchpad.net/fuel/+bug/1549254
|
||||||
|
env_util.copy_vips(env)
|
||||||
|
|
||||||
call_handlers('predeploy')
|
call_handlers('predeploy')
|
||||||
if network_template:
|
if network_template:
|
||||||
env_util.set_network_template(env, network_template)
|
env_util.set_network_template(env, network_template)
|
||||||
|
35
octane/fuelclient/copy_vips.py
Normal file
35
octane/fuelclient/copy_vips.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
from fuelclient.commands import base
|
||||||
|
from fuelclient.commands import environment as env_commands
|
||||||
|
|
||||||
|
|
||||||
|
class CopyVIPs(env_commands.EnvMixIn, base.BaseCommand):
|
||||||
|
"""Copy VIPs to seed cluster"""
|
||||||
|
|
||||||
|
def get_parser(self, prog_name):
|
||||||
|
parser = super(CopyVIPs, self).get_parser(prog_name)
|
||||||
|
parser.add_argument('env_id',
|
||||||
|
type=str,
|
||||||
|
help='ID of the environment')
|
||||||
|
return parser
|
||||||
|
|
||||||
|
def take_action(self, parsed_args):
|
||||||
|
# NOTE(aroma): while copying of VIPs procedure is not a part of
|
||||||
|
# fuelclient.objects.Environment the connection will be called directly
|
||||||
|
self.client._entity_wrapper.connection.post_request(
|
||||||
|
"clusters/{0}/upgrade/vips".format(parsed_args.env_id))
|
||||||
|
|
||||||
|
msg = ('VIPs successfully copied from the original cluster to seed '
|
||||||
|
'cluster {0}'.format(parsed_args.env_id))
|
||||||
|
self.app.stdout.write(msg)
|
@ -124,3 +124,13 @@ TENANT_GET_SAMPLE = """
|
|||||||
| name | services |
|
| name | services |
|
||||||
+-------------+-----------------------------------+
|
+-------------+-----------------------------------+
|
||||||
"""[1:]
|
"""[1:]
|
||||||
|
|
||||||
|
|
||||||
|
def test_copy_vips(mock_subprocess):
|
||||||
|
env_id = -1
|
||||||
|
env = mock.Mock(data={'id': env_id})
|
||||||
|
env_util.copy_vips(env)
|
||||||
|
|
||||||
|
mock_subprocess.assert_called_once_with(
|
||||||
|
['fuel2', 'env', 'copy', 'vips', str(env_id)]
|
||||||
|
)
|
||||||
|
@ -235,6 +235,12 @@ def move_nodes(env, nodes):
|
|||||||
wait_for_nodes(nodes, "provisioned")
|
wait_for_nodes(nodes, "provisioned")
|
||||||
|
|
||||||
|
|
||||||
|
def copy_vips(env):
|
||||||
|
subprocess.call(
|
||||||
|
["fuel2", "env", "copy", "vips", str(env.data['id'])]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def provision_nodes(env, nodes):
|
def provision_nodes(env, nodes):
|
||||||
env.install_selected_nodes('provision', nodes)
|
env.install_selected_nodes('provision', nodes)
|
||||||
LOG.info("Nodes provision started. Please wait...")
|
LOG.info("Nodes provision started. Please wait...")
|
||||||
|
@ -59,3 +59,4 @@ fuelclient =
|
|||||||
env_clone = octane.fuelclient.clone_env:EnvClone
|
env_clone = octane.fuelclient.clone_env:EnvClone
|
||||||
env_move_node = octane.fuelclient.move_node:EnvMoveNode
|
env_move_node = octane.fuelclient.move_node:EnvMoveNode
|
||||||
env_clone-ips = octane.fuelclient.clone_ips:CloneIPs
|
env_clone-ips = octane.fuelclient.clone_ips:CloneIPs
|
||||||
|
env_copy_vips = octane.fuelclient.copy_vips:CopyVIPs
|
||||||
|
Loading…
Reference in New Issue
Block a user