|
|
911d2c |
commit f62ca0e78ff5b087c0cb49d858e040a5c5284eeb
|
|
|
911d2c |
Author: Michal Domonkos <mdomonko@redhat.com>
|
|
|
911d2c |
Date: Mon Jun 5 20:29:10 2017 +0200
|
|
|
911d2c |
|
|
|
911d2c |
fastestmirror: move the logic before MD retrieval. BZ 1428210
|
|
|
911d2c |
|
|
|
911d2c |
This plugin has had no effect on metadata downloads since commit a522869
|
|
|
911d2c |
in yum where we put a RepoStorage.retrieveAllMD() call before
|
|
|
911d2c |
postreposetup_hook used by this plugin. Let's change to using
|
|
|
911d2c |
prereposetup_hook instead so that retrieveAllMD() can make use of the
|
|
|
911d2c |
sorted urls.
|
|
|
911d2c |
|
|
|
911d2c |
In practice, though, mirrors would still be benchmarked and sorted
|
|
|
911d2c |
because of a similar mechanism present in urlgrabber (the timedhosts
|
|
|
911d2c |
option, always enabled in yum) with one exception: If the yum cache is
|
|
|
911d2c |
empty (no timedhosts file yet), the original order received from the
|
|
|
911d2c |
server would be retained (a property of stable sorting [1]) for the
|
|
|
911d2c |
repomd.xml download, which is still a bad situation that wouldn't happen
|
|
|
911d2c |
before a522869; this is fixed with this commit as it allows the plugin
|
|
|
911d2c |
to do its work beforehand.
|
|
|
911d2c |
|
|
|
911d2c |
Note that the stuff we do in yum/repos.py in between prereposetup_hook
|
|
|
911d2c |
and postreposetup_hook has nothing to do with our plugin anyway, so we
|
|
|
911d2c |
won't "miss" or break any configuration steps when we move our logic
|
|
|
911d2c |
from the latter to the former location.
|
|
|
911d2c |
|
|
|
911d2c |
[1] urlgrabber/mirror.py:275
|
|
|
911d2c |
|
|
|
911d2c |
diff --git a/plugins/fastestmirror/fastestmirror.py b/plugins/fastestmirror/fastestmirror.py
|
|
|
911d2c |
index fe79629..5887e32 100644
|
|
|
911d2c |
--- a/plugins/fastestmirror/fastestmirror.py
|
|
|
911d2c |
+++ b/plugins/fastestmirror/fastestmirror.py
|
|
|
911d2c |
@@ -146,7 +146,7 @@ def _len_non_ftp(urls):
|
|
|
911d2c |
num += 1
|
|
|
911d2c |
return num
|
|
|
911d2c |
|
|
|
911d2c |
-def postreposetup_hook(conduit):
|
|
|
911d2c |
+def prereposetup_hook(conduit):
|
|
|
911d2c |
"""
|
|
|
911d2c |
This function is called after Yum has initiliazed all the repository information.
|
|
|
911d2c |
|
|
|
911d2c |
@@ -255,7 +255,7 @@ def read_timedhosts():
|
|
|
911d2c |
communicate with other functions.
|
|
|
911d2c |
|
|
|
911d2c |
This function is referred by:
|
|
|
911d2c |
- - L{postreposetup_hook()}
|
|
|
911d2c |
+ - L{prereposetup_hook()}
|
|
|
911d2c |
|
|
|
911d2c |
@param timedhosts : A list of time intervals to reach different hosts
|
|
|
911d2c |
corresponding to the mirrors. The index of the list are hostnames.
|
|
|
911d2c |
@@ -281,7 +281,7 @@ def write_timedhosts():
|
|
|
911d2c |
communicate with other functions.
|
|
|
911d2c |
|
|
|
911d2c |
This function is referred by:
|
|
|
911d2c |
- - L{postreposetup_hook()}
|
|
|
911d2c |
+ - L{prereposetup_hook()}
|
|
|
911d2c |
|
|
|
911d2c |
@param timedhosts : A list of time intervals to reach different hosts
|
|
|
911d2c |
corresponding to the mirrors. The index of the list are hostnames.
|
|
|
911d2c |
@@ -359,7 +359,7 @@ class FastestMirror:
|
|
|
911d2c |
- L{FastestMirror._poll_mirrors()}
|
|
|
911d2c |
|
|
|
911d2c |
This function is referred by:
|
|
|
911d2c |
- - L{postreposetup_hook()}
|
|
|
911d2c |
+ - L{prereposetup_hook()}
|
|
|
911d2c |
- L{main()}
|
|
|
911d2c |
|
|
|
911d2c |
@rtype: List
|