From fa72d6e37df3c1c9e36fc297d735210f33c4280d Mon Sep 17 00:00:00 2001 From: Etienne Perot Date: Thu, 19 Jan 2023 14:38:22 -0800 Subject: [PATCH] `runsc/sandbox`: Make `OverlayFileUsage` follow convention for urpc methods. PiperOrigin-RevId: 503269077 --- runsc/sandbox/sandbox.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/runsc/sandbox/sandbox.go b/runsc/sandbox/sandbox.go index 8756d05b8..48b53d03b 100644 --- a/runsc/sandbox/sandbox.go +++ b/runsc/sandbox/sandbox.go @@ -1240,14 +1240,12 @@ func (s *Sandbox) ChangeLogging(args control.LoggingArgs) error { // OverlayFileUsage returns the current usage (bytes) of the overlay filestore. func (s *Sandbox) OverlayFileUsage() (uint64, error) { - conn, err := s.sandboxConnect() - if err != nil { - return 0, err - } - defer conn.Close() - + log.Debugf("Getting overlay file usage for sandbox %q", s.ID) var usage uint64 - return usage, conn.Call(boot.CongMgrOverlayFileUsage, nil, &usage) + if err := s.call(boot.CongMgrOverlayFileUsage, nil, &usage); err != nil { + return 0, fmt.Errorf("getting overlay file usage for sandbox %q: %w", s.ID, err) + } + return usage, nil } // DestroyContainer destroys the given container. If it is the root container,