From 37d348ae6db2bf8522737287d805a100ed8245e5 Mon Sep 17 00:00:00 2001 From: David Sullivan Date: Thu, 6 May 2021 10:02:50 -0500 Subject: [PATCH] Limit etcd migration to swact actions Currently the etcd migration will take place whenever upgrade_swact_migration.py is called. Typically this is called during a swact as part of etcd start. However the script can also be called during etcd restart, which occurs as part of activating secured etcd. The solution is to limit the etcd migration to controller-0. This will ensure the action will only be taken during the swact to controller-0. Closes-Bug: 1927508 Signed-off-by: David Sullivan Change-Id: I893eeaa7ddb0b600baa051498a30ed737c688151 --- .../controllerconfig/scripts/upgrade_swact_migration.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/controllerconfig/controllerconfig/scripts/upgrade_swact_migration.py b/controllerconfig/controllerconfig/scripts/upgrade_swact_migration.py index a7cd017786..e65a03e406 100644 --- a/controllerconfig/controllerconfig/scripts/upgrade_swact_migration.py +++ b/controllerconfig/controllerconfig/scripts/upgrade_swact_migration.py @@ -10,6 +10,7 @@ import os import shutil +import socket import subprocess import sys import yaml @@ -73,6 +74,10 @@ def migrate_etcd_on_swact(): UPGRADE_ETCD_FILE) return + if socket.gethostname() != 'controller-0': + LOG.info("Skipping etcd migration, not running on controller-0") + return + with open(UPGRADE_ETCD_FILE, 'r') as f: document = yaml.safe_load(f)