Merge ~adam-collard/maas-ci/+git/system-tests:faster-image-import into ~maas-committers/maas-ci/+git/system-tests:master

Proposed by Adam Collard
Status: Merged
Approved by: Adam Collard
Approved revision: 4b2b12f48fc1ce16d376be5f6f335eaa4d9b3ce5
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~adam-collard/maas-ci/+git/system-tests:faster-image-import
Merge into: ~maas-committers/maas-ci/+git/system-tests:master
Diff against target: 48 lines (+9/-10)
1 file modified
systemtests/state.py (+9/-10)
Reviewer Review Type Date Requested Status
MAAS Lander Approve
Björn Tillenius Approve
Review via email: mp+409498@code.launchpad.net

Commit message

Remove unnecessary sleeps from image import

To post a comment you must log in.
Revision history for this message
Björn Tillenius (bjornt) wrote :

+1

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b faster-image-import lp:~adam-collard/maas-ci/+git/system-tests into -b master lp:~maas-committers/maas-ci/+git/system-tests

STATUS: SUCCESS
COMMIT: 4b2b12f48fc1ce16d376be5f6f335eaa4d9b3ce5

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/systemtests/state.py b/systemtests/state.py
2index 67f2793..fd00e6c 100644
3--- a/systemtests/state.py
4+++ b/systemtests/state.py
5@@ -44,6 +44,12 @@ def import_images_and_wait_until_synced(
6 osystems.add(power_config.get("osystem", "ubuntu"))
7
8 authenticated_admin.update_architectures_in_boot_source_selections(architectures)
9+ # TODO: Sometimes the region has already started importing images,
10+ # arguably we should stop it before we configure the architectures
11+ # (but then again, MAAS should do it for us). If it's already
12+ # running though, we will wait a long time for the new start
13+ # request to be processed.
14+
15 # This waits for an event to be created for the import
16 authenticated_admin.import_boot_resources()
17 windows_path = None
18@@ -54,14 +60,8 @@ def import_images_and_wait_until_synced(
19 )
20
21 region_start_point = time.time()
22- # It takes a long time for images to be downloaded, give 5 minutes
23- # per architecture
24- # FIXME: When we are reusing the maas-container images should be already imported.
25- # and this sleep would not be needed.
26- sleep_time = 60 * 5 * len(architectures)
27- LOG.debug(f"Sleeping for {sleep_time}s for region image import")
28- time.sleep(sleep_time)
29 while authenticated_admin.is_importing_boot_resources():
30+ LOG.debug("Sleeping for 10s for region image import")
31 time.sleep(10)
32
33 region_time_taken = time.time() - region_start_point
34@@ -82,12 +82,11 @@ def import_images_and_wait_until_synced(
35 windows_time_taken = time.time() - windows_start_point
36 LOG.info(f"Took {windows_time_taken:0.1f}s to upload Windows")
37 rack_start_point = time.time()
38- LOG.debug(f"Sleeping for {sleep_time}s for rack image import")
39- time.sleep(sleep_time)
40 rack_controller = get_rack_controllers(authenticated_admin)[0]
41 boot_images = authenticated_admin.list_boot_images(rack_controller)
42 while boot_images["status"] != "synced":
43- time.sleep(10)
44+ LOG.debug("Sleeping for 30s to wait for rack to finish importing images")
45+ time.sleep(30)
46 boot_images = authenticated_admin.list_boot_images(rack_controller)
47 if boot_images["status"] == "out-of-sync":
48 authenticated_admin.import_boot_resources_in_rack(rack_controller)

Subscribers

People subscribed via source and target branches

to all changes: