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
diff --git a/systemtests/state.py b/systemtests/state.py
index 67f2793..fd00e6c 100644
--- a/systemtests/state.py
+++ b/systemtests/state.py
@@ -44,6 +44,12 @@ def import_images_and_wait_until_synced(
44 osystems.add(power_config.get("osystem", "ubuntu"))44 osystems.add(power_config.get("osystem", "ubuntu"))
4545
46 authenticated_admin.update_architectures_in_boot_source_selections(architectures)46 authenticated_admin.update_architectures_in_boot_source_selections(architectures)
47 # TODO: Sometimes the region has already started importing images,
48 # arguably we should stop it before we configure the architectures
49 # (but then again, MAAS should do it for us). If it's already
50 # running though, we will wait a long time for the new start
51 # request to be processed.
52
47 # This waits for an event to be created for the import53 # This waits for an event to be created for the import
48 authenticated_admin.import_boot_resources()54 authenticated_admin.import_boot_resources()
49 windows_path = None55 windows_path = None
@@ -54,14 +60,8 @@ def import_images_and_wait_until_synced(
54 )60 )
5561
56 region_start_point = time.time()62 region_start_point = time.time()
57 # It takes a long time for images to be downloaded, give 5 minutes
58 # per architecture
59 # FIXME: When we are reusing the maas-container images should be already imported.
60 # and this sleep would not be needed.
61 sleep_time = 60 * 5 * len(architectures)
62 LOG.debug(f"Sleeping for {sleep_time}s for region image import")
63 time.sleep(sleep_time)
64 while authenticated_admin.is_importing_boot_resources():63 while authenticated_admin.is_importing_boot_resources():
64 LOG.debug("Sleeping for 10s for region image import")
65 time.sleep(10)65 time.sleep(10)
6666
67 region_time_taken = time.time() - region_start_point67 region_time_taken = time.time() - region_start_point
@@ -82,12 +82,11 @@ def import_images_and_wait_until_synced(
82 windows_time_taken = time.time() - windows_start_point82 windows_time_taken = time.time() - windows_start_point
83 LOG.info(f"Took {windows_time_taken:0.1f}s to upload Windows")83 LOG.info(f"Took {windows_time_taken:0.1f}s to upload Windows")
84 rack_start_point = time.time()84 rack_start_point = time.time()
85 LOG.debug(f"Sleeping for {sleep_time}s for rack image import")
86 time.sleep(sleep_time)
87 rack_controller = get_rack_controllers(authenticated_admin)[0]85 rack_controller = get_rack_controllers(authenticated_admin)[0]
88 boot_images = authenticated_admin.list_boot_images(rack_controller)86 boot_images = authenticated_admin.list_boot_images(rack_controller)
89 while boot_images["status"] != "synced":87 while boot_images["status"] != "synced":
90 time.sleep(10)88 LOG.debug("Sleeping for 30s to wait for rack to finish importing images")
89 time.sleep(30)
91 boot_images = authenticated_admin.list_boot_images(rack_controller)90 boot_images = authenticated_admin.list_boot_images(rack_controller)
92 if boot_images["status"] == "out-of-sync":91 if boot_images["status"] == "out-of-sync":
93 authenticated_admin.import_boot_resources_in_rack(rack_controller)92 authenticated_admin.import_boot_resources_in_rack(rack_controller)

Subscribers

People subscribed via source and target branches

to all changes: