Skip to content

Commit ea958ae

Browse files
committed
tools/update: create a snapshot after updating hosts
Signed-off-by: Olivier Hoareau <olivier.hoareau@vates.tech>
1 parent 2b5ef3d commit ea958ae

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

lib/tools/tasks/update.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
from concurrent.futures import ThreadPoolExecutor
88

9+
from lib.host import Host
910
from lib.pool import NotAMasterHostError, Pool
11+
from lib.tools.tasks.snapshot import create_snapshot
1012

1113
from .. import logger
1214

@@ -26,7 +28,7 @@ def update_pools(inventory: dict) -> None:
2628
inventory_hosts = inventory["hosts"]
2729
# init related pools
2830
pools = []
29-
nested_hosts = []
31+
nested_hosts: list[Host] = []
3032
for h in inventory_hosts:
3133
try:
3234
p = Pool(h)
@@ -49,3 +51,9 @@ def update_pools(inventory: dict) -> None:
4951
# repos are the same as the primary (master)
5052
repos = inventory_hosts[p.master.hostname_or_ip]["enablerepos"]
5153
executor.submit(h.update, repos)
54+
55+
# Snapshot creation
56+
# get ids of VMs for parent host
57+
vm_uuids = [h.get_system_uuid() for h in nested_hosts]
58+
parent_pool = Pool(inventory["parent"]) # mandatory for getting an host instance
59+
create_snapshot(parent_pool.master, vm_uuids)

0 commit comments

Comments
 (0)