patchpanel: Add support for getting all managed devices.
Adds a new dbus method - GetDevices - and the supporting implementation
in the arc and crostini services to acquire the list of devices
currently managed by patchpanel. This currently includes only the
virtual devices it creates for guests and excludes physical and virtual
(like VPN) devices tracked by shill.
BUG=b:174432555
TEST=units
Change-Id: I3e62c89836bf7bfbc0fade5260ea27eb1f60df9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2566852
Tested-by: Garrick Evans <garrick@chromium.org>
Commit-Queue: Garrick Evans <garrick@chromium.org>
Reviewed-by: Hugo Benichi <hugobenichi@google.com>
diff --git a/patchpanel/arc_service.cc b/patchpanel/arc_service.cc
index 60ee512..34311fa 100644
--- a/patchpanel/arc_service.cc
+++ b/patchpanel/arc_service.cc
@@ -587,4 +587,11 @@
return configs;
}
+
+void ArcService::ScanDevices(
+ base::RepeatingCallback<void(const Device&)> callback) const {
+ for (const auto& [_, d] : devices_)
+ callback.Run(*d.get());
+}
+
} // namespace patchpanel