libpod: use GraphRoot for overlay upper dir

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2023-01-27 17:16:43 +01:00
parent 427d69cc32
commit 0e949bfd37
2 changed files with 9 additions and 1 deletions

View File

@ -1527,7 +1527,7 @@ func (c *Container) mountStorage() (_ string, deferredErr error) {
mountPoint := c.config.Rootfs mountPoint := c.config.Rootfs
// Check if overlay has to be created on top of Rootfs // Check if overlay has to be created on top of Rootfs
if c.config.RootfsOverlay { if c.config.RootfsOverlay {
overlayDest := c.runtime.RunRoot() overlayDest := c.runtime.GraphRoot()
contentDir, err := overlay.GenerateStructure(overlayDest, c.ID(), "rootfs", c.RootUID(), c.RootGID()) contentDir, err := overlay.GenerateStructure(overlayDest, c.ID(), "rootfs", c.RootUID(), c.RootGID())
if err != nil { if err != nil {
return "", fmt.Errorf("rootfs-overlay: failed to create TempDir in the %s directory: %w", overlayDest, err) return "", fmt.Errorf("rootfs-overlay: failed to create TempDir in the %s directory: %w", overlayDest, err)

View File

@ -973,6 +973,14 @@ func (r *Runtime) RunRoot() string {
return r.store.RunRoot() return r.store.RunRoot()
} }
// GraphRoot retrieves the current c/storage directory in use by Libpod.
func (r *Runtime) GraphRoot() string {
if r.store == nil {
return ""
}
return r.store.GraphRoot()
}
// GetName retrieves the name associated with a given full ID. // GetName retrieves the name associated with a given full ID.
// This works for both containers and pods, and does not distinguish between the // This works for both containers and pods, and does not distinguish between the
// two. // two.