This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgNeels Hofmeyr has submitted this change and it was merged. Change subject: error log: clarify for using more resources than reserved ...................................................................... error log: clarify for using more resources than reserved Figure out how many resources were reserved, how many of those match the requirements, and how many are used, and log one of three matching error messages for that situation. For that purpose, allow find()ing reserved resources without logging anything, using a log_label=None arg. Change-Id: I1c67600ba69351859e46b8b2f368ee8106db0993 --- M src/osmo_gsm_tester/resource.py 1 file changed, 17 insertions(+), 6 deletions(-) Approvals: Pau Espin Pedrol: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py index 52b23c7..7cc32bb 100644 --- a/src/osmo_gsm_tester/resource.py +++ b/src/osmo_gsm_tester/resource.py @@ -301,7 +301,8 @@ # list item contains specifics for the particular BTS. my_list = self.get(key, []) - for_origin.log(log_label, len(want_list), 'x', key, '(candidates: %d)'%len(my_list)) + if log_label: + for_origin.log(log_label, len(want_list), 'x', key, '(candidates: %d)'%len(my_list)) # Try to avoid a less constrained item snatching away a resource # from a more detailed constrained requirement. @@ -472,11 +473,21 @@ available = available_dict.get(kind) self.dbg(available=len(available)) if not available: - raise NoResourceExn('When trying to reserve %r nr %d: No unused resource found%s' % - (kind, - self.count(kind) + 1, - (' matching %r' % specifics) if specifics else '') - ) + # cook up a detailed error message for the current situation + kind_reserved = self.reserved.get(kind, []) + used_count = len([r for r in kind_reserved if USED_KEY in r]) + matching = self.reserved.find(self.origin, want, raise_if_missing=False, log_label=None).get(kind, []) + if not matching: + msg = 'none of the reserved resources matches requirements %r' % specifics + elif not (used_count < len(kind_reserved)): + msg = 'suite.conf reserved only %d x %r.' % (len(kind_reserved), kind) + else: + msg = ('No unused resource left that matches the requirements;' + ' Of reserved %d x %r, %d match the requirements, but all are already in use;' + ' Requirements: %r' + % (len(kind_reserved), kind, len(matching), specifics)) + raise NoResourceExn('When trying to use instance nr %d of %r: %s' % (used_count + 1, kind, msg)) + pick = available[0] self.dbg(using=pick) assert not pick.get(USED_KEY) -- To view, visit https://gerrit.osmocom.org/2852 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1c67600ba69351859e46b8b2f368ee8106db0993 Gerrit-PatchSet: 4 Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de> Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>