Skip to content

Commit

Permalink
fix: blockdevice transport detection
Browse files Browse the repository at this point in the history
Fixes #10292

This pulls in fixes from go-blockdevice library:

* siderolabs/go-blockdevice#127
* siderolabs/go-blockdevice#128

Also allow `megaraid` emulation in `talosctl cluster create`.

Signed-off-by: Andrey Smirnov <[email protected]>
(cherry picked from commit 8531d91)
  • Loading branch information
smira committed Feb 13, 2025
1 parent 39d608a commit 6d0db51
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/talosctl/cmd/mgmt/cluster/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ func init() {
createCmd.Flags().BoolVar(&clusterDiskPreallocate, clusterDiskPreallocateFlag, true, "whether disk space should be preallocated")
createCmd.Flags().StringSliceVar(&clusterDisks, clusterDisksFlag, []string{}, "list of disks to create for each VM in format: <mount_point1>:<size1>:<mount_point2>:<size2>")
createCmd.Flags().IntVar(&extraDisks, "extra-disks", 0, "number of extra disks to create for each worker VM")
createCmd.Flags().StringSliceVar(&extraDisksDrivers, "extra-disks-drivers", nil, "driver for each extra disk (virtio, ide, ahci, scsi, nvme)")
createCmd.Flags().StringSliceVar(&extraDisksDrivers, "extra-disks-drivers", nil, "driver for each extra disk (virtio, ide, ahci, scsi, nvme, megaraid)")
createCmd.Flags().IntVar(&extraDiskSize, "extra-disks-size", 5*1024, "default limit on disk size in MB (each VM)")
createCmd.Flags().StringVar(&targetArch, "arch", stdruntime.GOARCH, "cluster architecture")
createCmd.Flags().BoolVar(&clusterWait, "wait", true, "wait for the cluster to be ready before returning")
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ require (
github.com/siderolabs/gen v0.7.0
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.13
github.com/siderolabs/go-blockdevice/v2 v2.0.14
github.com/siderolabs/go-circular v0.2.1
github.com/siderolabs/go-cmd v0.1.3
github.com/siderolabs/go-copy v0.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,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.13 h1:N94eK+EFwnD+2kdNT38910Qlu+5+Z0WDODKbX7NXvPs=
github.com/siderolabs/go-blockdevice/v2 v2.0.13/go.mod h1:74htzCV913UzaLZ4H+NBXkwWlYnBJIq5m/379ZEcu8w=
github.com/siderolabs/go-blockdevice/v2 v2.0.14 h1:9Nu4ceeKpCSUhSub6RbxU2eat5IwAOR11Vdb5mPVASo=
github.com/siderolabs/go-blockdevice/v2 v2.0.14/go.mod h1:74htzCV913UzaLZ4H+NBXkwWlYnBJIq5m/379ZEcu8w=
github.com/siderolabs/go-circular v0.2.1 h1:a++iVCn9jyhICX3POQZZX8n72p2h5JGdGU6w1ulmpcA=
github.com/siderolabs/go-circular v0.2.1/go.mod h1:ZDItzVyXK+B/XuqTBV5MtQtSv06VI+oCmWGRnNCATo8=
github.com/siderolabs/go-cmd v0.1.3 h1:JrgZwqhJQeoec3QRON0LK+fv+0y7d0DyY7zsfkO6ciw=
Expand Down
2 changes: 1 addition & 1 deletion pkg/machinery/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/siderolabs/crypto v0.5.0
github.com/siderolabs/gen v0.7.0
github.com/siderolabs/go-api-signature v0.3.6
github.com/siderolabs/go-blockdevice/v2 v2.0.13
github.com/siderolabs/go-blockdevice/v2 v2.0.14
github.com/siderolabs/go-pointer v1.0.0
github.com/siderolabs/net v0.4.0
github.com/siderolabs/protoenc v0.2.1
Expand Down
4 changes: 2 additions & 2 deletions pkg/machinery/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ github.com/siderolabs/gen v0.7.0 h1:uHAt3WD0dof28NHFuguWBbDokaXQraR/HyVxCLw2QCU=
github.com/siderolabs/gen v0.7.0/go.mod h1:an3a2Y53O7kUjnnK8Bfu3gewtvnIOu5RTU6HalFtXQQ=
github.com/siderolabs/go-api-signature v0.3.6 h1:wDIsXbpl7Oa/FXvxB6uz4VL9INA9fmr3EbmjEZYFJrU=
github.com/siderolabs/go-api-signature v0.3.6/go.mod h1:hoH13AfunHflxbXfh+NoploqV13ZTDfQ1mQJWNVSW9U=
github.com/siderolabs/go-blockdevice/v2 v2.0.13 h1:N94eK+EFwnD+2kdNT38910Qlu+5+Z0WDODKbX7NXvPs=
github.com/siderolabs/go-blockdevice/v2 v2.0.13/go.mod h1:74htzCV913UzaLZ4H+NBXkwWlYnBJIq5m/379ZEcu8w=
github.com/siderolabs/go-blockdevice/v2 v2.0.14 h1:9Nu4ceeKpCSUhSub6RbxU2eat5IwAOR11Vdb5mPVASo=
github.com/siderolabs/go-blockdevice/v2 v2.0.14/go.mod h1:74htzCV913UzaLZ4H+NBXkwWlYnBJIq5m/379ZEcu8w=
github.com/siderolabs/go-pointer v1.0.0 h1:6TshPKep2doDQJAAtHUuHWXbca8ZfyRySjSBT/4GsMU=
github.com/siderolabs/go-pointer v1.0.0/go.mod h1:HTRFUNYa3R+k0FFKNv11zgkaCLzEkWVzoYZ433P3kHc=
github.com/siderolabs/go-retry v0.3.3 h1:zKV+S1vumtO72E6sYsLlmIdV/G/GcYSBLiEx/c9oCEg=
Expand Down
16 changes: 14 additions & 2 deletions pkg/provision/providers/qemu/launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ func launchVM(config *LaunchConfig) error {
}

var (
scsiAttached, ahciAttached, nvmeAttached bool
ahciBus int
scsiAttached, ahciAttached, nvmeAttached, megaraidAttached bool
ahciBus int
)

for i, disk := range config.DiskPaths {
Expand Down Expand Up @@ -385,6 +385,18 @@ func launchVM(config *LaunchConfig) error {
"-drive", fmt.Sprintf("id=nvme%d,format=raw,if=none,file=%s,discard=unmap,aio=native,cache=none", i, disk),
"-device", fmt.Sprintf("nvme-ns,drive=nvme%d,logical_block_size=%d,physical_block_size=%d", i, blockSize, blockSize),
)
case "megaraid":
if !megaraidAttached {
args = append(args,
"-device", "megasas-gen2,id=scsi1")

megaraidAttached = true
}

args = append(args,
"-drive", fmt.Sprintf("id=scsi%d,format=raw,if=none,file=%s,discard=unmap,aio=native,cache=none", i, disk),
"-device", fmt.Sprintf("scsi-hd,drive=scsi%d,bus=scsi1.0,channel=0,scsi-id=%d,lun=0,logical_block_size=%d,physical_block_size=%d", i, i, blockSize, blockSize),
)
default:
return fmt.Errorf("unsupported disk driver %q", driver)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/provision/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ type Disk struct {
Partitions []*v1alpha1.DiskPartition
// Driver for the disk.
//
// Supported types: "virtio", "ide", "ahci", "scsi", "nvme".
// Supported types: "virtio", "ide", "ahci", "scsi", "nvme", "megaraid".
Driver string
// Block size for the disk, defaults to 512 if not set.
BlockSize uint
Expand Down
2 changes: 1 addition & 1 deletion website/content/v1.9/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ talosctl cluster create [flags]
-p, --exposed-ports string Comma-separated list of ports/protocols to expose on init node. Ex -p <hostPort>:<containerPort>/<protocol (tcp or udp)> (Docker provisioner only)
--extra-boot-kernel-args string add extra kernel args to the initial boot from vmlinuz and initramfs (QEMU only)
--extra-disks int number of extra disks to create for each worker VM
--extra-disks-drivers strings driver for each extra disk (virtio, ide, ahci, scsi, nvme)
--extra-disks-drivers strings driver for each extra disk (virtio, ide, ahci, scsi, nvme, megaraid)
--extra-disks-size int default limit on disk size in MB (each VM) (default 5120)
--extra-uefi-search-paths strings additional search paths for UEFI firmware (only applies when UEFI is enabled)
-h, --help help for create
Expand Down

0 comments on commit 6d0db51

Please sign in to comment.