mirror of
https://github.com/containers/podman.git
synced 2025-12-01 10:38:05 +08:00
system df: fix image-size calculations
Fix two bugs in `system df`:
1. The total size was calculated incorrectly as it was creating the sum
of all image sizes but did not consider that a) the same image may
be listed more than once (i.e., for each repo-tag pair), and that
b) images share layers.
The total size is now calculated directly in `libimage` by taking
multi-layer use into account.
2. The reclaimable size was calculated incorrectly. This number
indicates which data we can actually remove which means the total
size minus what containers use (i.e., the "unique" size of the image
in use by containers).
NOTE: The c/storage version is pinned back to the previous commit as it
is buggy. c/common already requires the buggy version, so use a
`replace` to force/pin.
Fixes: #16135
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
3
vendor/github.com/containers/common/libnetwork/cni/cni_conversion.go
generated
vendored
3
vendor/github.com/containers/common/libnetwork/cni/cni_conversion.go
generated
vendored
@@ -7,7 +7,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -329,7 +328,7 @@ func (n *cniNetwork) createCNIConfigListFromNetwork(network *types.Network, writ
|
||||
cniPathName := ""
|
||||
if writeToDisk {
|
||||
cniPathName = filepath.Join(n.cniConfigDir, network.Name+".conflist")
|
||||
err = ioutil.WriteFile(cniPathName, b, 0o644)
|
||||
err = os.WriteFile(cniPathName, b, 0o644)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
3
vendor/github.com/containers/common/libnetwork/netavark/network.go
generated
vendored
3
vendor/github.com/containers/common/libnetwork/netavark/network.go
generated
vendored
@@ -7,7 +7,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -174,7 +173,7 @@ func (n *netavarkNetwork) loadNetworks() error {
|
||||
n.networks = nil
|
||||
n.modTime = modTime
|
||||
|
||||
files, err := ioutil.ReadDir(n.networkConfigDir)
|
||||
files, err := os.ReadDir(n.networkConfigDir)
|
||||
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
return err
|
||||
}
|
||||
|
||||
10
vendor/github.com/containers/common/libnetwork/network/interface.go
generated
vendored
10
vendor/github.com/containers/common/libnetwork/network/interface.go
generated
vendored
@@ -6,7 +6,6 @@ package network
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -37,11 +36,12 @@ const (
|
||||
// NetworkBackend returns the network backend name and interface
|
||||
// It returns either the CNI or netavark backend depending on what is set in the config.
|
||||
// If the the backend is set to "" we will automatically assign the backend on the following conditions:
|
||||
// 1. read ${graphroot}/defaultNetworkBackend
|
||||
// 2. find netavark binary (if not installed use CNI)
|
||||
// 3. check containers, images and CNI networks and if there are some we have an existing install and should continue to use CNI
|
||||
// 1. read ${graphroot}/defaultNetworkBackend
|
||||
// 2. find netavark binary (if not installed use CNI)
|
||||
// 3. check containers, images and CNI networks and if there are some we have an existing install and should continue to use CNI
|
||||
//
|
||||
// revive does not like the name because the package is already called network
|
||||
//
|
||||
//nolint:revive
|
||||
func NetworkBackend(store storage.Store, conf *config.Config, syslog bool) (types.NetworkBackend, types.ContainerNetwork, error) {
|
||||
backend := types.NetworkBackend(conf.Network.NetworkBackend)
|
||||
@@ -100,7 +100,7 @@ func NetworkBackend(store storage.Store, conf *config.Config, syslog bool) (type
|
||||
func defaultNetworkBackend(store storage.Store, conf *config.Config) (backend types.NetworkBackend, err error) {
|
||||
// read defaultNetworkBackend file
|
||||
file := filepath.Join(store.GraphRoot(), defaultNetworkBackendFileName)
|
||||
b, err := ioutil.ReadFile(file)
|
||||
b, err := os.ReadFile(file)
|
||||
if err == nil {
|
||||
val := string(b)
|
||||
if val == string(types.Netavark) {
|
||||
|
||||
11
vendor/github.com/containers/common/libnetwork/resolvconf/resolvconf.go
generated
vendored
11
vendor/github.com/containers/common/libnetwork/resolvconf/resolvconf.go
generated
vendored
@@ -40,12 +40,11 @@ var (
|
||||
)
|
||||
|
||||
// filterResolvDNS cleans up the config in resolvConf. It has two main jobs:
|
||||
// 1. If a netns is enabled, it looks for localhost (127.*|::1) entries in the provided
|
||||
// resolv.conf, removing local nameserver entries, and, if the resulting
|
||||
// cleaned config has no defined nameservers left, adds default DNS entries
|
||||
// 2. Given the caller provides the enable/disable state of IPv6, the filter
|
||||
// code will remove all IPv6 nameservers if it is not enabled for containers
|
||||
//
|
||||
// 1. If a netns is enabled, it looks for localhost (127.*|::1) entries in the provided
|
||||
// resolv.conf, removing local nameserver entries, and, if the resulting
|
||||
// cleaned config has no defined nameservers left, adds default DNS entries
|
||||
// 2. Given the caller provides the enable/disable state of IPv6, the filter
|
||||
// code will remove all IPv6 nameservers if it is not enabled for containers
|
||||
func filterResolvDNS(resolvConf []byte, ipv6Enabled bool, netnsEnabled bool) []byte {
|
||||
// If we're using the host netns, we have nothing to do besides hash the file.
|
||||
if !netnsEnabled {
|
||||
|
||||
3
vendor/github.com/containers/common/libnetwork/types/network.go
generated
vendored
3
vendor/github.com/containers/common/libnetwork/types/network.go
generated
vendored
@@ -226,6 +226,9 @@ type NetworkOptions struct {
|
||||
// Networks contains all networks with the PerNetworkOptions.
|
||||
// The map should contain at least one element.
|
||||
Networks map[string]PerNetworkOptions `json:"networks"`
|
||||
// List of custom DNS server for podman's DNS resolver.
|
||||
// Priority order will be kept as defined by user in the configuration.
|
||||
DNSServers []string `json:"dns_servers,omitempty"`
|
||||
}
|
||||
|
||||
// PortMapping is one or more ports that will be mapped into the container.
|
||||
|
||||
Reference in New Issue
Block a user