diff --git a/pkg/pillar/Dockerfile b/pkg/pillar/Dockerfile index 1eef0ee57bc..88011a3edb9 100644 --- a/pkg/pillar/Dockerfile +++ b/pkg/pillar/Dockerfile @@ -10,7 +10,7 @@ ARG BUILD_PKGS_BASE="git gcc linux-headers libc-dev make linux-pam-dev m4 findut # we use the same image in several places ARG EVE_ALPINE_IMAGE=lfedge/eve-alpine:9fb9b9cbf7d90066a70e4704d04a6fe248ff52bb -FROM lfedge/eve-dom0-ztools:417d4ff6a57d2317c9e65166274b0ea6f6da16e2 as zfs +FROM lfedge/eve-dom0-ztools:81a7af28b32c7558e1c4622e60a9e3197075decd as zfs RUN mkdir /out # copy zfs-related files from dom0-ztools using prepared list of files RUN while read -r x; do \ diff --git a/pkg/pillar/cmd/zfsmanager/handlediskconfig.go b/pkg/pillar/cmd/zfsmanager/handlediskconfig.go index 00f7a627ec0..0d34260b1de 100644 --- a/pkg/pillar/cmd/zfsmanager/handlediskconfig.go +++ b/pkg/pillar/cmd/zfsmanager/handlediskconfig.go @@ -9,7 +9,7 @@ import ( "strings" "time" - libzfs "github.com/bicomsystems/go-libzfs" + libzfs "github.com/andrewd-zededa/go-libzfs" "github.com/lf-edge/eve/pkg/pillar/types" "github.com/lf-edge/eve/pkg/pillar/utils/disks" "github.com/lf-edge/eve/pkg/pillar/vault" diff --git a/pkg/pillar/cmd/zfsmanager/zfsstoragemetrics.go b/pkg/pillar/cmd/zfsmanager/zfsstoragemetrics.go index 84034fbda1b..87757be5bf2 100644 --- a/pkg/pillar/cmd/zfsmanager/zfsstoragemetrics.go +++ b/pkg/pillar/cmd/zfsmanager/zfsstoragemetrics.go @@ -6,7 +6,7 @@ package zfsmanager import ( "time" - libzfs "github.com/bicomsystems/go-libzfs" + libzfs "github.com/andrewd-zededa/go-libzfs" "github.com/lf-edge/eve/pkg/pillar/types" "github.com/lf-edge/eve/pkg/pillar/vault" "github.com/lf-edge/eve/pkg/pillar/zfs" diff --git a/pkg/pillar/cmd/zfsmanager/zfsstoragestatus.go b/pkg/pillar/cmd/zfsmanager/zfsstoragestatus.go index 7d5bf564cb3..11c617c03bf 100644 --- a/pkg/pillar/cmd/zfsmanager/zfsstoragestatus.go +++ b/pkg/pillar/cmd/zfsmanager/zfsstoragestatus.go @@ -7,7 +7,7 @@ import ( "strconv" "time" - libzfs "github.com/bicomsystems/go-libzfs" + libzfs "github.com/andrewd-zededa/go-libzfs" "github.com/lf-edge/eve/pkg/pillar/types" "github.com/lf-edge/eve/pkg/pillar/vault" "github.com/lf-edge/eve/pkg/pillar/zfs" diff --git a/pkg/pillar/go.mod b/pkg/pillar/go.mod index e0661459a4c..a2cdcc813c2 100644 --- a/pkg/pillar/go.mod +++ b/pkg/pillar/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/anatol/smart.go v0.0.0-20220615232124-371056cd18c3 - github.com/bicomsystems/go-libzfs v0.4.0 + github.com/andrewd-zededa/go-libzfs v0.0.0-20240304231806-6a64e99da97d github.com/containerd/cgroups v1.1.0 github.com/containerd/containerd v1.7.13 github.com/containerd/typeurl v1.0.2 diff --git a/pkg/pillar/go.sum b/pkg/pillar/go.sum index 3a4608d3e45..464be5a3550 100644 --- a/pkg/pillar/go.sum +++ b/pkg/pillar/go.sum @@ -631,6 +631,10 @@ github.com/anatol/vmtest v0.0.0-20220413190228-7a42f1f6d7b8 h1:t4JGeY9oaF5LB4Rdx github.com/anatol/vmtest v0.0.0-20220413190228-7a42f1f6d7b8/go.mod h1:oPm5wWoqTSkeoPe1Q3sPryTK8o24Jcbwh8dKOiiIobk= github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092 h1:aM1rlcoLz8y5B2r4tTLMiVTrMtpfY0O8EScKJxaSaEc= github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092/go.mod h1:rYqSE9HbjzpHTI74vwPvae4ZVYZd1lue2ta6xHPdblA= +github.com/andrewd-zededa/go-libzfs v0.0.0-20240304220234-b1d1e139a96f h1:h3NlPxTPz+1d4h9Ti3DOpvzi6ZQv+vtoNJLlSsvG/uQ= +github.com/andrewd-zededa/go-libzfs v0.0.0-20240304220234-b1d1e139a96f/go.mod h1:vr7ylGirAMvXzO7cdSQkMKFn0k9XDij67ZgDfPXsKKg= +github.com/andrewd-zededa/go-libzfs v0.0.0-20240304231806-6a64e99da97d h1:/L/7th+IDBOJVHUEBuCOr4aurp5t5cMT2mRrARuMsPU= +github.com/andrewd-zededa/go-libzfs v0.0.0-20240304231806-6a64e99da97d/go.mod h1:vr7ylGirAMvXzO7cdSQkMKFn0k9XDij67ZgDfPXsKKg= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= @@ -656,8 +660,6 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bicomsystems/go-libzfs v0.4.0 h1:rezv5ZTVe31o2MbACEDrTYAeRO4rSHm70DHOTTas/yU= -github.com/bicomsystems/go-libzfs v0.4.0/go.mod h1:/ABUjxseIy72AxJV8ROgSfeZ5YA8/ZSp1mMzfDKi0Mw= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= diff --git a/pkg/pillar/vault/handler_zfs.go b/pkg/pillar/vault/handler_zfs.go index ec365d62b31..1cecd022b85 100644 --- a/pkg/pillar/vault/handler_zfs.go +++ b/pkg/pillar/vault/handler_zfs.go @@ -10,7 +10,7 @@ import ( "strings" "time" - libzfs "github.com/bicomsystems/go-libzfs" + libzfs "github.com/andrewd-zededa/go-libzfs" "github.com/lf-edge/eve-api/go/info" "github.com/lf-edge/eve/pkg/pillar/base" etpm "github.com/lf-edge/eve/pkg/pillar/evetpm" diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/.gitignore b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/.gitignore similarity index 100% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/.gitignore rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/.gitignore diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/LICENSE.md b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/LICENSE.md similarity index 100% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/LICENSE.md rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/LICENSE.md diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/README.md b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/README.md similarity index 100% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/README.md rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/README.md diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/common.c b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/common.c similarity index 100% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/common.c rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/common.c diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/common.go b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/common.go similarity index 97% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/common.go rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/common.go index 645b6c220ab..f88100711b9 100644 --- a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/common.go +++ b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/common.go @@ -4,8 +4,6 @@ // // TODO: Adding to the pool. (Add the given vdevs to the pool) // TODO: Scan for pools. -// -// package zfs /* @@ -182,12 +180,15 @@ const ( PoolPropLeaked PoolPropMaxBlockSize PoolPropTName - PoolPropMaxNodeSize + PoolPropMaxDNodeSize PoolPropMultiHost PoolPropCheckpoint PoolPropLoadGUID PoolPropAutotrim PoolPropCompatibility + PoolPropBcloneUsed + PoolPropBcloneSaved + PoolPropBcloneRatio PoolNumProps ) @@ -295,6 +296,7 @@ const ( DatasetPropIVSetGuid /* not exposed to the user */ DatasetPropRedacted DatasetPropRedactSnaps + DatasetPropSnapshotsChanged DatasetNumProps ) @@ -410,6 +412,11 @@ const ( ENoResilverDefer /* pool doesn't support resilver_defer */ EExportInProgress /* currently exporting the pool */ ERebuilding /* resilvering (sequential reconstrution) */ + EVdevNotSup /* ops not supported for this type of vdev */ + ENotUserNamespace /* a file is not a user namespace */ + ECksum /* insufficient replicas */ + EResumeExists /* resume on existing dataset without force */ + EShareFailed /* filesystem share failed */ EUnknown ) diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/common.h b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/common.h similarity index 100% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/common.h rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/common.h diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/sendrecv.go b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/sendrecv.go similarity index 100% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/sendrecv.go rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/sendrecv.go diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/sort.go b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/sort.go similarity index 100% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/sort.go rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/sort.go diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zfs.c b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zfs.c similarity index 99% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zfs.c rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zfs.c index 8d93de1e364..c8297806c20 100644 --- a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zfs.c +++ b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zfs.c @@ -192,8 +192,8 @@ property_list_t *read_user_property(dataset_list_t *dataset, const char* prop) { nvlist_t *user_props = zfs_get_user_props(dataset->zh); nvlist_t *propval; zprop_source_t sourcetype; - char *strval; - char *sourceval; + const char *strval; + const char *sourceval; // char source[ZFS_MAX_DATASET_NAME_LEN]; property_list_ptr list = new_property_list(); diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zfs.go b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zfs.go similarity index 100% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zfs.go rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zfs.go diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zfs.h b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zfs.h similarity index 100% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zfs.h rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zfs.h diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zpool.c b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zpool.c similarity index 98% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zpool.c rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zpool.c index 9a0a48ac35c..97783eaa7ed 100644 --- a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zpool.c +++ b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zpool.c @@ -370,7 +370,7 @@ int refresh_stats(zpool_list_t *pool) } const char *get_vdev_type(nvlist_ptr nv) { - char *value = NULL; + const char *value = NULL; int r = nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &value); if(r != 0) { return NULL; @@ -441,7 +441,7 @@ vdev_children_ptr get_vdev_l2cache(nvlist_t *nv) { } const char *get_vdev_path(nvlist_ptr nv) { - char *path = NULL; + const char *path = NULL; uint64_t notpresent = 0; int r = nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, ¬present); if (r == 0 || notpresent != 0) { @@ -473,7 +473,7 @@ uint64_t get_zpool_guid(nvlist_ptr nv) { } const char *get_zpool_name(nvlist_ptr nv) { - char *name = NULL; + const char *name = NULL; if (0 != nvlist_lookup_string(nv, ZPOOL_CONFIG_POOL_NAME, &name)) { return NULL; } @@ -481,7 +481,7 @@ const char *get_zpool_name(nvlist_ptr nv) { } const char *get_zpool_comment(nvlist_ptr nv) { - char *comment = NULL; + const char *comment = NULL; if (0 != nvlist_lookup_string(nv, ZPOOL_CONFIG_COMMENT, &comment)) { return NULL; } @@ -510,7 +510,12 @@ nvlist_ptr go_zpool_search_import(libzfs_handle_ptr zfsh, int paths, char **path if (t == NULL) return NULL; - pools = zpool_search_import(zfsh, &idata, &libzfs_config_ops); + libpc_handle_t lpch = { + .lpc_lib_handle = zfsh, + .lpc_ops = &libzfs_config_ops, + .lpc_printerr = B_TRUE + }; + pools = zpool_search_import(&lpch, &idata); tpool_wait(t); tpool_destroy(t); diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zpool.go b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zpool.go similarity index 99% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zpool.go rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zpool.go index 35086465024..f295637bf0a 100644 --- a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zpool.go +++ b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zpool.go @@ -100,7 +100,6 @@ type PoolScanStat struct { EndTime uint64 // Scan end time ToExamine uint64 // Total bytes to scan Examined uint64 // Total bytes scaned - ToProcess uint64 // Total bytes to processed Processed uint64 // Total bytes processed Errors uint64 // Scan errors // Values not stored on disk @@ -214,7 +213,6 @@ func poolGetConfig(name string, nv C.nvlist_ptr) (vdevs VDevTree, err error) { vdevs.ScanStat.EndTime = uint64(ps.pss_end_time) vdevs.ScanStat.ToExamine = uint64(ps.pss_to_examine) vdevs.ScanStat.Examined = uint64(ps.pss_examined) - vdevs.ScanStat.ToProcess = uint64(ps.pss_to_process) vdevs.ScanStat.Processed = uint64(ps.pss_processed) vdevs.ScanStat.Errors = uint64(ps.pss_errors) vdevs.ScanStat.PassExam = uint64(ps.pss_pass_exam) diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zpool.h b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zpool.h similarity index 100% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zpool.h rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zpool.h diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zpool_vdev.c b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zpool_vdev.c similarity index 100% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zpool_vdev.c rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zpool_vdev.c diff --git a/pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zpool_vdev.go b/pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zpool_vdev.go similarity index 100% rename from pkg/pillar/vendor/github.com/bicomsystems/go-libzfs/zpool_vdev.go rename to pkg/pillar/vendor/github.com/andrewd-zededa/go-libzfs/zpool_vdev.go diff --git a/pkg/pillar/vendor/modules.txt b/pkg/pillar/vendor/modules.txt index ad3d9bebb9a..00aa24e20c2 100644 --- a/pkg/pillar/vendor/modules.txt +++ b/pkg/pillar/vendor/modules.txt @@ -81,6 +81,9 @@ github.com/anatol/smart.go # github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092 ## explicit; go 1.18 github.com/anchore/go-struct-converter +# github.com/andrewd-zededa/go-libzfs v0.0.0-20240304231806-6a64e99da97d +## explicit; go 1.13 +github.com/andrewd-zededa/go-libzfs # github.com/aws/aws-sdk-go v1.44.82 ## explicit; go 1.11 github.com/aws/aws-sdk-go/aws @@ -137,9 +140,6 @@ github.com/aws/aws-sdk-go/service/sts/stsiface # github.com/beorn7/perks v1.0.1 ## explicit; go 1.11 github.com/beorn7/perks/quantile -# github.com/bicomsystems/go-libzfs v0.4.0 -## explicit; go 1.13 -github.com/bicomsystems/go-libzfs # github.com/bugsnag/bugsnag-go v1.4.1 ## explicit # github.com/bugsnag/panicwrap v1.2.0 diff --git a/pkg/pillar/zfs/zfs.go b/pkg/pillar/zfs/zfs.go index 7772b74b975..60e65c0d283 100644 --- a/pkg/pillar/zfs/zfs.go +++ b/pkg/pillar/zfs/zfs.go @@ -11,7 +11,7 @@ import ( "strings" "time" - libzfs "github.com/bicomsystems/go-libzfs" + libzfs "github.com/andrewd-zededa/go-libzfs" "github.com/lf-edge/eve/pkg/pillar/base" "github.com/lf-edge/eve/pkg/pillar/hardware" "github.com/lf-edge/eve/pkg/pillar/types"