From 9f3d6cb7657c3d338fd09039c6924f0be13421ae Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 7 Dec 2024 03:47:38 +0000 Subject: [PATCH] fix(deps): update patch digest dependencies --- go.mod | 6 +- go.sum | 8 +- .../longhorn/go-common-libs/sys/sys.go | 76 +++++++++++++++++++ .../longhorn/go-common-libs/types/error.go | 23 ++++++ .../longhorn/go-common-libs/types/nfs.go | 3 + .../longhorn/go-common-libs/types/sys.go | 5 ++ .../internal/resolver/dns/dns_resolver.go | 4 +- vendor/google.golang.org/grpc/version.go | 2 +- vendor/modules.txt | 6 +- 9 files changed, 121 insertions(+), 12 deletions(-) create mode 100644 vendor/github.com/longhorn/go-common-libs/types/error.go create mode 100644 vendor/github.com/longhorn/go-common-libs/types/nfs.go diff --git a/go.mod b/go.mod index 8fcc76cd..0b32a3c7 100644 --- a/go.mod +++ b/go.mod @@ -2,13 +2,13 @@ module github.com/longhorn/backing-image-manager go 1.22.7 -toolchain go1.23.3 +toolchain go1.23.4 require ( github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.1 github.com/longhorn/backupstore v0.0.0-20241130163459-2b482603a2c6 - github.com/longhorn/go-common-libs v0.0.0-20241128023039-4d6c3a880dbc + github.com/longhorn/go-common-libs v0.0.0-20241206085105-b60ef86c0b25 github.com/longhorn/longhorn-engine v1.8.0-dev-20241201 github.com/longhorn/sparse-tools v0.0.0-20241124090628-9499c1fb63d7 github.com/longhorn/types v0.0.0-20241123075624-48c550af4eab @@ -17,7 +17,7 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/urfave/cli v1.22.16 golang.org/x/net v0.31.0 - google.golang.org/grpc v1.68.0 + google.golang.org/grpc v1.68.1 google.golang.org/protobuf v1.35.2 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c ) diff --git a/go.sum b/go.sum index cb215c69..990bd20c 100644 --- a/go.sum +++ b/go.sum @@ -76,8 +76,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/longhorn/backupstore v0.0.0-20241130163459-2b482603a2c6 h1:hcIAm6c92I72O/ByrF9G1LjmB1DEiGOj5DQgBl28T4Y= github.com/longhorn/backupstore v0.0.0-20241130163459-2b482603a2c6/go.mod h1:cQXypqB6WonN0aIxWZWtUBPCOKlNNoi0hqkfYFsZlkI= -github.com/longhorn/go-common-libs v0.0.0-20241128023039-4d6c3a880dbc h1:Ok7qdNu2038Oj7tQNaKjFqP20NqokR31a3RVMV7ulms= -github.com/longhorn/go-common-libs v0.0.0-20241128023039-4d6c3a880dbc/go.mod h1:gSa+qB058kcNlCaOOwIFPHb3tvqMTmKcxtL7HPTS4o4= +github.com/longhorn/go-common-libs v0.0.0-20241206085105-b60ef86c0b25 h1:yAu164uaQUX/um0YqjEmMHUSX0JlnPRmwCQyE7Uit7o= +github.com/longhorn/go-common-libs v0.0.0-20241206085105-b60ef86c0b25/go.mod h1:gSa+qB058kcNlCaOOwIFPHb3tvqMTmKcxtL7HPTS4o4= github.com/longhorn/go-iscsi-helper v0.0.0-20241130163427-b18631536a86 h1:HBOE8N3yC8xR4469k3WenqcrD3Xw6SCXLvJFioXDNKY= github.com/longhorn/go-iscsi-helper v0.0.0-20241130163427-b18631536a86/go.mod h1:g58FKTRCU0uS3JDJGUmnPlWVcSW04TNi1q757ShJzYI= github.com/longhorn/longhorn-engine v1.8.0-dev-20241201 h1:64P8wCD58T5jT+94j/stACr4IQWtv+k+cOcnybA1XNI= @@ -177,8 +177,8 @@ golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0= -google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA= +google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0= +google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw= google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/vendor/github.com/longhorn/go-common-libs/sys/sys.go b/vendor/github.com/longhorn/go-common-libs/sys/sys.go index 076d3dcc..576ae86d 100644 --- a/vendor/github.com/longhorn/go-common-libs/sys/sys.go +++ b/vendor/github.com/longhorn/go-common-libs/sys/sys.go @@ -1,7 +1,10 @@ package sys import ( + "bufio" + "compress/gzip" "fmt" + "io" "os" "path/filepath" "strconv" @@ -12,6 +15,8 @@ import ( "golang.org/x/sys/unix" "github.com/longhorn/go-common-libs/types" + + commonio "github.com/longhorn/go-common-libs/io" ) // GetKernelRelease returns the kernel release string. @@ -127,3 +132,74 @@ func getSystemBlockDeviceInfo(sysClassBlockDirectory string, readDirFn func(stri } return deviceInfo, nil } + +// GetBootKernelConfigMap reads the kernel config into a key-value map. It tries to read kernel config from +// ${bootDir}/config-${kernelVersion}, and comments are ignored. If the bootDir is empty, it points to /boot by default. +func GetBootKernelConfigMap(bootDir, kernelVersion string) (configMap map[string]string, err error) { + if kernelVersion == "" { + return nil, fmt.Errorf("kernelVersion cannot be empty") + } + if bootDir == "" { + bootDir = types.SysBootDirectory + } + + defer func() { + err = errors.Wrapf(err, "failed to get kernel config map from %s", bootDir) + }() + + configPath := filepath.Join(bootDir, "config-"+kernelVersion) + configContent, err := commonio.ReadFileContent(configPath) + if err != nil { + return nil, err + } + return parseKernelModuleConfigMap(strings.NewReader(configContent)) +} + +// GetProcKernelConfigMap reads the kernel config into a key-value map. It tries to read kernel config from +// procfs mounted at procDir from the view of processName in namespace. If the procDir is empty, it points to /proc by +// default. +func GetProcKernelConfigMap(procDir string) (configMap map[string]string, err error) { + if procDir == "" { + procDir = types.SysProcDirectory + } + + defer func() { + err = errors.Wrapf(err, "failed to get kernel config map from %s", procDir) + }() + + configPath := filepath.Join(procDir, types.SysKernelConfigGz) + configFile, err := os.Open(configPath) + if err != nil { + return nil, err + } + defer configFile.Close() + gzReader, err := gzip.NewReader(configFile) + if err != nil { + return nil, err + } + defer gzReader.Close() + return parseKernelModuleConfigMap(gzReader) +} + +// parseKernelModuleConfigMap parses the kernel config into key-value map. All commented items will be ignored. +func parseKernelModuleConfigMap(contentReader io.Reader) (map[string]string, error) { + configMap := map[string]string{} + + scanner := bufio.NewScanner(contentReader) + for scanner.Scan() { + config := scanner.Text() + if !strings.HasPrefix(config, "CONFIG_") { + continue + } + key, val, parsable := strings.Cut(config, "=") + if !parsable { + return nil, fmt.Errorf("failed to parse kernel config %s", config) + } + configMap[strings.TrimSpace(key)] = strings.TrimSpace(val) + } + + if err := scanner.Err(); err != nil { + return nil, err + } + return configMap, nil +} diff --git a/vendor/github.com/longhorn/go-common-libs/types/error.go b/vendor/github.com/longhorn/go-common-libs/types/error.go new file mode 100644 index 00000000..a4aa19c2 --- /dev/null +++ b/vendor/github.com/longhorn/go-common-libs/types/error.go @@ -0,0 +1,23 @@ +package types + +import "github.com/pkg/errors" + +var ( + // It is recommended to wrap the following common errors with meaningful message, so that the error handler can unwrap + // the underlying error and compare directly using errors.Is. For example: + // + // func GetSysConfig(filePath string) (string, error) { + // configVal, err := readConfig(filePath) + // if os.IsNotExist(err) { + // return fmt.Errorf("config file %q not present: %w", filePath, ErrNotConfigured) + // } + // ... + // } + // + // configVal, err := GetSysConfig(filePath) + // if errors.Is(err, types.ErrNotConfigured) { + // configVal = defaultVal + // } + + ErrNotConfigured = errors.New("is not configured") +) diff --git a/vendor/github.com/longhorn/go-common-libs/types/nfs.go b/vendor/github.com/longhorn/go-common-libs/types/nfs.go new file mode 100644 index 00000000..a52ed150 --- /dev/null +++ b/vendor/github.com/longhorn/go-common-libs/types/nfs.go @@ -0,0 +1,3 @@ +package types + +const NFSMountFileName = "nfsmount.conf" diff --git a/vendor/github.com/longhorn/go-common-libs/types/sys.go b/vendor/github.com/longhorn/go-common-libs/types/sys.go index 15155b3b..b778210f 100644 --- a/vendor/github.com/longhorn/go-common-libs/types/sys.go +++ b/vendor/github.com/longhorn/go-common-libs/types/sys.go @@ -2,6 +2,11 @@ package types const OsReleaseFilePath = "/etc/os-release" const SysClassBlockDirectory = "/sys/class/block/" +const SysBootDirectory = "/boot/" +const SysProcDirectory = "/proc/" +const SysEtcDirectory = "/etc/" + +const SysKernelConfigGz = "config.gz" const OSDistroTalosLinux = "talos" diff --git a/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go b/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go index 8691698e..374c12fb 100644 --- a/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go +++ b/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go @@ -237,7 +237,9 @@ func (d *dnsResolver) watcher() { } func (d *dnsResolver) lookupSRV(ctx context.Context) ([]resolver.Address, error) { - if !EnableSRVLookups { + // Skip this particular host to avoid timeouts with some versions of + // systemd-resolved. + if !EnableSRVLookups || d.host == "metadata.google.internal." { return nil, nil } var newAddrs []resolver.Address diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index d50e8435..5a47094a 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.68.0" +const Version = "1.68.1" diff --git a/vendor/modules.txt b/vendor/modules.txt index 11669f04..74ee044c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -172,7 +172,7 @@ github.com/longhorn/backupstore/s3 github.com/longhorn/backupstore/types github.com/longhorn/backupstore/util github.com/longhorn/backupstore/vfs -# github.com/longhorn/go-common-libs v0.0.0-20241128023039-4d6c3a880dbc +# github.com/longhorn/go-common-libs v0.0.0-20241206085105-b60ef86c0b25 ## explicit; go 1.22.7 github.com/longhorn/go-common-libs/backup github.com/longhorn/go-common-libs/bitmap @@ -315,8 +315,8 @@ golang.org/x/text/unicode/norm # google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 ## explicit; go 1.21 google.golang.org/genproto/googleapis/rpc/status -# google.golang.org/grpc v1.68.0 -## explicit; go 1.22.7 +# google.golang.org/grpc v1.68.1 +## explicit; go 1.22 google.golang.org/grpc google.golang.org/grpc/attributes google.golang.org/grpc/backoff