Skip to content

Propagate client identity to exporter - #1939

Open
asher-pem-arm wants to merge 2 commits into
labgrid-project:masterfrom
ARM-software:propagate-client-identity-to-exporter
Open

asher-pem-arm wants to merge 2 commits into
labgrid-project:masterfrom
ARM-software:propagate-client-identity-to-exporter

Conversation

@asher-pem-arm

@asher-pem-arm asher-pem-arm commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Description
Exporters currently receive only the logical place name when acquiring or leasing a resource. They cannot identify which client initiated the operation in exporter-local logs. This improves per-resource diagnostics and traceability on distributed exporter hosts. The identity is used only for logging; authorization and resource ownership semantics are unchanged.

This PR:

  • Adds client identity fields to acquire and lease protobuf requests.
  • Forwards the existing hostname/username identity from the coordinator.
  • Logs successful acquisitions and leases at the exporter.

Builds on:
#1886

Checklist

  • Documentation for the feature
  • Tests for the feature
  • The arguments and description in doc/configuration.rst have been updated
  • Add a section on how to use the feature to doc/usage.rst
  • Add a section on how to use the feature to doc/development.rst
  • PR has been tested
  • Man pages have been regenerated

@codecov

codecov Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.8%. Comparing base (431e2b0) to head (af11bd4).
⚠️ Report is 53 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
labgrid/remote/coordinator.py 81.8% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1939     +/-   ##
========================================
- Coverage    62.8%   62.8%   -0.1%     
========================================
  Files         188     190      +2     
  Lines       15348   15457    +109     
========================================
+ Hits         9640    9708     +68     
- Misses       5708    5749     +41     
Flag Coverage Δ
3.10 ?
3.11 62.8% <84.6%> (+<0.1%) ⬆️
3.12 62.7% <84.6%> (+<0.1%) ⬆️
3.13 62.7% <84.6%> (+<0.1%) ⬆️
3.14 62.7% <84.6%> (+<0.1%) ⬆️
3.15 62.7% <84.6%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@asher-pem-arm

Copy link
Copy Markdown
Contributor Author

now #1886 has been merged, have rebased/tidied this ready for review cc @Emantor

Comment thread labgrid/remote/proto/labgrid-coordinator.proto Outdated
@Bastian-Krause

Copy link
Copy Markdown
Member

Except for the comment by @Emantor, this looks good to me.

@asher-pem-arm
asher-pem-arm requested a review from Emantor October 15, 2026 12:25
Emantor
Emantor previously approved these changes Oct 21, 2026
Comment thread labgrid/remote/coordinator.py Outdated
Comment on lines -1120 to +1135
f"Resource {group_name}/{resource_name} is already acquired by {resource.acquired}"
f"Resource {group_name}/{resource_name} is already in use by {resource.acquired}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you are changing this? Whats the difference between "acquired" and "in use"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a small but useful wording as part of future changes in which we can allow both acquire and lease (or similar), hopefully as part of #1884

Comment thread labgrid/remote/exporter.py Outdated
asher-pem-arm and others added 2 commits October 22, 2026 11:44
Add acquirer_identity to ExporterSetAcquiredRequest and regenerate its
Python bindings so exporters can identify the client behind resource
acquisition and release commands.

Send the place owner's identity on acquisition. For releases, use the
request's metadata identity or fall back to the legacy client session.
This records the releasing caller even when kicking another user's place.
Log the identity after successful acquisition or release.

Keep identity optional for callers without metadata or a client session,
and for internal cleanup. Send an empty identity in those cases so existing
release clients continue to work. The added protobuf field is compatible
with older coordinators and exporters.

Signed-off-by: Asher Pemberton <asher.pemberton@arm.com>
Reviewed-by: Asher Pemberton <asher.pemberton@arm.com> # gatekeeper
Co-authored-by: Luke Beardsmore <luke.beardsmore2@arm.com>
Co-authored-by: Idan Saadon <idan.saadon@arm.com>
Replace the identity string at field 4 of ExporterSetAcquiredRequest with
ClientIdentity.id, allowing more identity fields to be added in future.

Update coordinator and exporter accesses and regenerate the Python
bindings, preserving the existing identity values and log messages.

Signed-off-by: Asher Pemberton <asher.pemberton@arm.com>
Reviewed-by: Asher Pemberton <asher.pemberton@arm.com> # gatekeeper
Co-authored-by: Luke Beardsmore <luke.beardsmore2@arm.com>
Co-authored-by: Idan Saadon <idan.saadon@arm.com>

@ozan956 ozan956 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants