mirror of
https://github.com/containers/podman.git
synced 2025-08-06 03:19:52 +08:00

The libpod/define code should not import any large dependencies, as it is intended to be structures and definitions only. It included the libpod/driver package for information on the storage driver, though, which brought in all of c/storage. Split the driver package so that define has the struct, and thus does not need to import Driver. And simplify the driver code while we're at it. Signed-off-by: Matthew Heon <mheon@redhat.com>
27 lines
625 B
Go
27 lines
625 B
Go
package driver
|
|
|
|
import (
|
|
"github.com/containers/podman/v2/libpod/define"
|
|
"github.com/containers/storage"
|
|
)
|
|
|
|
// GetDriverData returns information on a given store's running graph driver.
|
|
func GetDriverData(store storage.Store, layerID string) (*define.DriverData, error) {
|
|
driver, err := store.GraphDriver()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
metaData, err := driver.Metadata(layerID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if mountTimes, err := store.Mounted(layerID); mountTimes == 0 || err != nil {
|
|
delete(metaData, "MergedDir")
|
|
}
|
|
|
|
return &define.DriverData{
|
|
Name: driver.String(),
|
|
Data: metaData,
|
|
}, nil
|
|
}
|