Sync feed repo to standby controller

Host-install for DX fails for RR patch because controller-1
tries to do a ostree pull from it's own feed ostree repo
which hasn't been synced. We need to have some mechanism in
place that would sync the feed ostree among the controllers
after each sw-patch command is issued.

This commit enables host-install in a duplex debian env.

Story: 2009969
Task: 45821
Depends-On: https://review.opendev.org/q/850779
Signed-off-by: Jessica Castelino <jessica.castelino@windriver.com>
Change-Id: I654848481f8bd85d4e40af2d115398e1e9583915
This commit is contained in:
Jessica Castelino 2022-07-14 21:54:38 +00:00
parent 3d0d3566c7
commit 2b8b639e68
1 changed files with 15 additions and 0 deletions

View File

@ -707,6 +707,21 @@ class PatchController(PatchService):
LOG.error("Failed to rsync: %s", output)
return False
try:
for neighbour in list(self.hosts):
if (self.hosts[neighbour].nodetype == "controller" and
self.hosts[neighbour].ip == host):
output = subprocess.check_output(["rsync",
"-acv",
"--delete",
"rsync://%s/feed/" % host_url,
"%s/" % constants.FEED_OSTREE_BASE_DIR],
stderr=subprocess.STDOUT)
LOG.info("Synced to mate feed via rsync: %s", output)
except subprocess.CalledProcessError:
LOG.error("Failed to rsync: %s", output)
return False
self.read_state_file()
self.patch_data_lock.acquire()