chore: update the go-blockdevice package

the new version supports file based disk probing on darwin, so the logic
can be reused on macos systems as well.

Signed-off-by: Orzelius <33936483+Orzelius@users.noreply.github.com>
This commit is contained in:
Orzelius 2025-05-21 19:24:58 +09:00
parent 0b99631a0b
commit cd618dad0f
No known key found for this signature in database
GPG Key ID: C17C8E3962A0D9B1
5 changed files with 13 additions and 17 deletions

2
go.mod
View File

@ -145,7 +145,7 @@ require (
github.com/siderolabs/gen v0.8.1
github.com/siderolabs/go-api-signature v0.3.6
github.com/siderolabs/go-blockdevice v0.4.8
github.com/siderolabs/go-blockdevice/v2 v2.0.16
github.com/siderolabs/go-blockdevice/v2 v2.0.17
github.com/siderolabs/go-circular v0.2.3
github.com/siderolabs/go-cmd v0.1.3
github.com/siderolabs/go-copy v0.1.0

4
go.sum
View File

@ -636,8 +636,8 @@ github.com/siderolabs/go-api-signature v0.3.6 h1:wDIsXbpl7Oa/FXvxB6uz4VL9INA9fmr
github.com/siderolabs/go-api-signature v0.3.6/go.mod h1:hoH13AfunHflxbXfh+NoploqV13ZTDfQ1mQJWNVSW9U=
github.com/siderolabs/go-blockdevice v0.4.8 h1:KfdWvIx0Jft5YVuCsFIJFwjWEF1oqtzkgX9PeU9cX4c=
github.com/siderolabs/go-blockdevice v0.4.8/go.mod h1:4PeOuk71pReJj1JQEXDE7kIIQJPVe8a+HZQa+qjxSEA=
github.com/siderolabs/go-blockdevice/v2 v2.0.16 h1:QeQ72S7M/rwXV1nah/uzyBPeF/PLCEwuSqj1hFeZYQU=
github.com/siderolabs/go-blockdevice/v2 v2.0.16/go.mod h1:74htzCV913UzaLZ4H+NBXkwWlYnBJIq5m/379ZEcu8w=
github.com/siderolabs/go-blockdevice/v2 v2.0.17 h1:psmgwArDHpNBwxfp1vuABBeII8bGT90LctWRfY2cC6w=
github.com/siderolabs/go-blockdevice/v2 v2.0.17/go.mod h1:74htzCV913UzaLZ4H+NBXkwWlYnBJIq5m/379ZEcu8w=
github.com/siderolabs/go-circular v0.2.3 h1:GKkA1Tw79kEFGtWdl7WTxEUTbwtklITeiRT0V1McHrA=
github.com/siderolabs/go-circular v0.2.3/go.mod h1:YBN/q9YpQphUYnBtBgPsngauSHj1TEZfgQZWZVjk1WE=
github.com/siderolabs/go-cmd v0.1.3 h1:JrgZwqhJQeoec3QRON0LK+fv+0y7d0DyY7zsfkO6ciw=

View File

@ -20,6 +20,7 @@ import (
"github.com/containernetworking/cni/libcni"
"github.com/google/uuid"
"github.com/siderolabs/go-blockdevice/v2/blkid"
"github.com/siderolabs/talos/pkg/provision"
"github.com/siderolabs/talos/pkg/provision/providers/vm"
@ -505,3 +506,12 @@ func dumpIpam(config LaunchConfig) error {
return nil
}
func checkPartitions(config *LaunchConfig) (bool, error) {
info, err := blkid.ProbePath(config.DiskPaths[0], blkid.WithSectorSize(config.DiskBlockSizes[0]))
if err != nil {
return false, fmt.Errorf("error probing disk: %w", err)
}
return info.Name == "gpt" && len(info.Parts) > 0, nil
}

View File

@ -14,10 +14,6 @@ func withNetworkContext(ctx context.Context, config *LaunchConfig, f func(config
return f(config)
}
func checkPartitions(config *LaunchConfig) (bool, error) {
panic("not implemented")
}
// startQemuCmd on darwin just runs cmd.Start.
func startQemuCmd(_ *LaunchConfig, cmd *exec.Cmd) error {
return cmd.Start()

View File

@ -24,7 +24,6 @@ import (
"github.com/coreos/go-iptables/iptables"
"github.com/google/uuid"
"github.com/siderolabs/gen/xslices"
"github.com/siderolabs/go-blockdevice/v2/blkid"
sideronet "github.com/siderolabs/net"
"github.com/siderolabs/talos/pkg/provision/internal/cniutils"
@ -173,15 +172,6 @@ func withNetworkContext(ctx context.Context, config *LaunchConfig, f func(config
return f(config)
}
func checkPartitions(config *LaunchConfig) (bool, error) {
info, err := blkid.ProbePath(config.DiskPaths[0], blkid.WithSectorSize(config.DiskBlockSizes[0]))
if err != nil {
return false, fmt.Errorf("error probing disk: %w", err)
}
return info.Name == "gpt" && len(info.Parts) > 0, nil
}
func startQemuCmd(config *LaunchConfig, cmd *exec.Cmd) error {
if err := ns.WithNetNSPath(config.nsPath, func(_ ns.NetNS) error {
return cmd.Start()