Skip to content

Commit 3bb2f95

Browse files
committed
tools/update: rename master/secondary to be more coherent
Signed-off-by: Olivier Hoareau <olivier.hoareau@vates.tech>
1 parent adab358 commit 3bb2f95

3 files changed

Lines changed: 14 additions & 13 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -641,17 +641,17 @@ uv run scripts/tools.py -h
641641
This command performs an update operation on remote targets.
642642

643643
```bash
644-
uv run scripts/tools.py update -H primary1 primary2
644+
uv run scripts/tools.py update -H master1 master2
645645
```
646646

647647
For each pool target :
648648

649-
1. Update master (primary) host of the pool:
649+
1. Update master host of the pool:
650650
* Clean cached metadata
651651
* Update with repository manager (yum): Optionally enables repositories
652652
* Reboot
653-
2. Get attached secondary hosts of the pool
654-
* Repeat step `1.` for each secondary
653+
2. Get other hosts of the pool
654+
* Repeat step `1.` for each host
655655

656656
**Inventory file**
657657

@@ -692,4 +692,4 @@ hosting_pool = "B"
692692
>
693693
> `{'ip_or_hostname-1': {'repositories': ['xcp-ng-base'], 'hosting_pool': 'A'}, 'ip_or_hostname-2': {'repositories': ['xcp-ng-updates'], 'hosting_pool': 'B'}}`
694694
>
695-
> * Using *enablerepo flag* `-e` with inventory is still possible, it won't be used though.
695+
> * When `--inventory` flag is present, repos passed to `-e` flag won't be considered.

lib/pool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class Pool:
1818
"""Pool
1919
20-
:raises NotAMasterHostError: if initial host is not a master (primary)
20+
:raises NotAMasterHostError: if initial host is not a master
2121
"""
2222
xe_prefix = "pool"
2323

@@ -300,4 +300,4 @@ def network_named(self, network_name: str) -> str:
300300
return self.master.xe('network-list', {'name-label': network_name}, minimal=True)
301301

302302
class NotAMasterHostError(Exception):
303-
"""Host must be a master (primary)."""
303+
"""Host must be a master."""

lib/tools/tasks/update.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def update_pools(inventory: Inventory) -> None:
1818
1919
Every non-master hosts in inventory will be ignored
2020
21-
*Update master hosts declared in inventory first, then, update secondary hosts attached to each master.*
21+
*Update each pool's master host declared in inventory first, then, update other hosts for each pool.*
2222
2323
:param dict inventory:
2424
Each host (key) holds its own config data (values, eg: `enablerepos`).
@@ -34,15 +34,16 @@ def update_pools(inventory: Inventory) -> None:
3434
except NotAMasterHostError:
3535
logger.warning(f"[{host}] Skipping: not a master host")
3636

37+
# update master hosts
3738
with ThreadPoolExecutor() as executor:
3839
for p in pools:
3940
executor.submit(p.master.update, inventory_hosts[p.master.hostname_or_ip]["repositories"])
4041

41-
# secondary hosts
42+
# update other hosts
4243
with ThreadPoolExecutor() as executor:
4344
for p in pools:
44-
# omit first item because it is a primary (master)
45-
for secondary in p.hosts[1:]:
46-
# repos are the same as the primary (master)
45+
# omit first item because it is the pool's master
46+
for other_host in p.hosts[1:]:
47+
# repos are the same as for the master host
4748
repos = inventory_hosts[p.master.hostname_or_ip]["repositories"]
48-
executor.submit(secondary.update, repos)
49+
executor.submit(other_host.update, repos)

0 commit comments

Comments
 (0)