From 7cbdce73f74351954e506303ed9964b9668a3b40 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 10 Jun 2024 16:19:19 +0400 Subject: [PATCH] fix: detect CD devices, fix user disks wipe test Detect CD devices, and set size to 0 for CD without media. In user disk wipe tests, skip device mapper devices and CD-ROM. Signed-off-by: Andrey Smirnov --- api/resource/definitions/block/block.proto | 1 + api/storage/storage.proto | 1 + go.mod | 2 +- go.sum | 4 +- go.work | 11 +++++ .../machined/pkg/controllers/block/disks.go | 9 ++++ internal/app/storaged/server.go | 2 + internal/integration/api/reset.go | 19 ++++++-- internal/integration/api/volumes.go | 11 ++++- internal/integration/base/api.go | 7 ++- .../resource/definitions/block/block.pb.go | 29 ++++++++---- .../definitions/block/block_vtproto.pb.go | 33 +++++++++++++ pkg/machinery/api/storage/storage.pb.go | 46 ++++++++++--------- pkg/machinery/resources/block/disk.go | 1 + website/content/v1.8/reference/api.md | 2 + 15 files changed, 137 insertions(+), 41 deletions(-) create mode 100644 go.work diff --git a/api/resource/definitions/block/block.proto b/api/resource/definitions/block/block.proto index 02b48f24f1..70daf9bd74 100755 --- a/api/resource/definitions/block/block.proto +++ b/api/resource/definitions/block/block.proto @@ -50,6 +50,7 @@ message DiskSpec { string sub_system = 10; string transport = 11; bool rotational = 12; + bool cdrom = 13; } // SystemDiskSpec is the spec for SystemDisks status. diff --git a/api/storage/storage.proto b/api/storage/storage.proto index 74f242bb70..a01151905b 100644 --- a/api/storage/storage.proto +++ b/api/storage/storage.proto @@ -36,6 +36,7 @@ message Disk { HDD = 2; NVME = 3; SD = 4; + CD = 5; } // Type is a type of the disk: nvme, ssd, hdd, sd card. DiskType type = 9; diff --git a/go.mod b/go.mod index a97c2cf2ab..8501296ec2 100644 --- a/go.mod +++ b/go.mod @@ -128,7 +128,7 @@ require ( github.com/siderolabs/gen v0.5.0 github.com/siderolabs/go-api-signature v0.3.2 github.com/siderolabs/go-blockdevice v0.4.7 - github.com/siderolabs/go-blockdevice/v2 v2.0.0-20240607145058-1a51f162a09e + github.com/siderolabs/go-blockdevice/v2 v2.0.0-20240610010119-f4a4030394f4 github.com/siderolabs/go-circular v0.2.0 github.com/siderolabs/go-cmd v0.1.1 github.com/siderolabs/go-copy v0.1.0 diff --git a/go.sum b/go.sum index cd89e63b26..a64fac0cea 100644 --- a/go.sum +++ b/go.sum @@ -661,8 +661,8 @@ github.com/siderolabs/go-api-signature v0.3.2 h1:blqrZF1GM7TWgq7mY7CsR+yQ93u6az0 github.com/siderolabs/go-api-signature v0.3.2/go.mod h1:punhUOaXa7LELYBRCUhfgUGH6ieVz68GrP98apCKXj8= github.com/siderolabs/go-blockdevice v0.4.7 h1:2bk4WpEEflGxjrNwp57ye24Pr+cYgAiAeNMWiQOuWbQ= github.com/siderolabs/go-blockdevice v0.4.7/go.mod h1:4PeOuk71pReJj1JQEXDE7kIIQJPVe8a+HZQa+qjxSEA= -github.com/siderolabs/go-blockdevice/v2 v2.0.0-20240607145058-1a51f162a09e h1:PQhtHJj3zwaqehthq0fs2TyW8bW/mlOYoHfZIeSYQ3M= -github.com/siderolabs/go-blockdevice/v2 v2.0.0-20240607145058-1a51f162a09e/go.mod h1:5GnL7VLNp5/vgiwYP74fi6KuTUfqGcRxQxtto2tzD+I= +github.com/siderolabs/go-blockdevice/v2 v2.0.0-20240610010119-f4a4030394f4 h1:78l10So9aPgv8VLmccaPfLTLmyTT4vdkF1MNmIcAGDg= +github.com/siderolabs/go-blockdevice/v2 v2.0.0-20240610010119-f4a4030394f4/go.mod h1:5GnL7VLNp5/vgiwYP74fi6KuTUfqGcRxQxtto2tzD+I= github.com/siderolabs/go-circular v0.2.0 h1:Xca8zrjF/YsujLbwDSojkKzJe7ngetnpuIJn8N78DJI= github.com/siderolabs/go-circular v0.2.0/go.mod h1:rrYCwHLYWmxqrmZP+LjYtwB2a55lxzQi0Ztu1VpWZSc= github.com/siderolabs/go-cmd v0.1.1 h1:nTouZUSxLeiiEe7hFexSVvaTsY/3O8k1s08BxPRrsps= diff --git a/go.work b/go.work new file mode 100644 index 0000000000..507c2d758c --- /dev/null +++ b/go.work @@ -0,0 +1,11 @@ +go 1.22.4 + +use ( + . + ./hack/cloud-image-uploader + ./hack/docgen + ./hack/gotagsrewrite + ./hack/module-sig-verify + ./hack/structprotogen + ./pkg/machinery +) diff --git a/internal/app/machined/pkg/controllers/block/disks.go b/internal/app/machined/pkg/controllers/block/disks.go index 01b36f7a15..c525ed447c 100644 --- a/internal/app/machined/pkg/controllers/block/disks.go +++ b/internal/app/machined/pkg/controllers/block/disks.go @@ -119,6 +119,8 @@ func (ctrl *DisksController) analyzeBlockDevice(ctx context.Context, r controlle return nil } + defer bd.Close() //nolint:errcheck + size, err := bd.GetSize() if err != nil || size == 0 { return nil //nolint:nilerr @@ -128,6 +130,12 @@ func (ctrl *DisksController) analyzeBlockDevice(ctx context.Context, r controlle return nil } + isCD := bd.IsCD() + if isCD && bd.IsCDNoMedia() { + // Linux reports non-zero size for CD-ROMs even when there is no media. + size = 0 + } + ioSize, err := bd.GetIOSize() if err != nil { logger.Debug("failed to get io size", zap.Error(err)) @@ -152,6 +160,7 @@ func (ctrl *DisksController) analyzeBlockDevice(ctx context.Context, r controlle d.TypedSpec().IOSize = ioSize d.TypedSpec().SectorSize = sectorSize d.TypedSpec().Readonly = readOnly + d.TypedSpec().CDROM = isCD d.TypedSpec().Model = props.Model d.TypedSpec().Serial = props.Serial diff --git a/internal/app/storaged/server.go b/internal/app/storaged/server.go index 70a58409ca..3ba9d78899 100644 --- a/internal/app/storaged/server.go +++ b/internal/app/storaged/server.go @@ -44,6 +44,8 @@ func (s *Server) Disks(ctx context.Context, in *emptypb.Empty) (reply *storage.D var diskType storage.Disk_DiskType switch { + case d.TypedSpec().CDROM: + diskType = storage.Disk_CD case d.TypedSpec().Transport == "nvme": diskType = storage.Disk_NVME case d.TypedSpec().Transport == "mmc": diff --git a/internal/integration/api/reset.go b/internal/integration/api/reset.go index c6481e8f8e..077a5cc864 100644 --- a/internal/integration/api/reset.go +++ b/internal/integration/api/reset.go @@ -122,16 +122,16 @@ func (suite *ResetSuite) TestResetWithSpecEphemeral() { }, true) } -// TestResetWithSpecState resets only state partition on the node. +// TestResetWithSpecStateAndUserDisks resets state partition and user disks on the node. // // As ephemeral partition is not reset, so kubelet cert shouldn't change. -func (suite *ResetSuite) TestResetWithSpecState() { +func (suite *ResetSuite) TestResetWithSpecStateAndUserDisks() { if suite.Capabilities().SecureBooted { // this is because in secure boot mode, the machine config is only applied and cannot be passed as kernel args suite.T().Skip("skipping as talos is explicitly trusted booted") } - node := suite.RandomDiscoveredNodeInternalIP() + node := suite.RandomDiscoveredNodeInternalIP(machine.TypeWorker) disks, err := suite.Client.Disks(client.WithNode(suite.ctx, node)) suite.Require().NoError(err) @@ -139,7 +139,18 @@ func (suite *ResetSuite) TestResetWithSpecState() { userDisksToWipe := xslices.Map( xslices.Filter(disks.Messages[0].Disks, func(disk *storage.Disk) bool { - return !disk.SystemDisk + switch { + case disk.SystemDisk: + return false + case disk.Type == storage.Disk_UNKNOWN, disk.Type == storage.Disk_CD, disk.Type == storage.Disk_SD: + return false + case disk.Readonly: + return false + case disk.BusPath == "/virtual": + return false + } + + return true }), func(disk *storage.Disk) string { return disk.DeviceName diff --git a/internal/integration/api/volumes.go b/internal/integration/api/volumes.go index af25471f42..5ca3515f1b 100644 --- a/internal/integration/api/volumes.go +++ b/internal/integration/api/volumes.go @@ -151,13 +151,20 @@ func (suite *VolumesSuite) TestDisks() { continue } - suite.Assert().NotEmpty(disk.TypedSpec().Size, "disk: %s", disk.Metadata().ID()) + if !disk.TypedSpec().CDROM { + suite.Assert().NotEmpty(disk.TypedSpec().Size, "disk: %s", disk.Metadata().ID()) + } + suite.Assert().NotEmpty(disk.TypedSpec().IOSize, "disk: %s", disk.Metadata().ID()) suite.Assert().NotEmpty(disk.TypedSpec().SectorSize, "disk: %s", disk.Metadata().ID()) if suite.Cluster != nil { // running on our own provider, transport should be always detected - suite.Assert().NotEmpty(disk.TypedSpec().Transport, "disk: %s", disk.Metadata().ID()) + if disk.TypedSpec().BusPath == "/virtual" { + suite.Assert().Empty(disk.TypedSpec().Transport, "disk: %s", disk.Metadata().ID()) + } else { + suite.Assert().NotEmpty(disk.TypedSpec().Transport, "disk: %s", disk.Metadata().ID()) + } } diskNames = append(diskNames, disk.Metadata().ID()) diff --git a/internal/integration/base/api.go b/internal/integration/base/api.go index f0aff79e18..4179176394 100644 --- a/internal/integration/base/api.go +++ b/internal/integration/base/api.go @@ -34,6 +34,7 @@ import ( "github.com/siderolabs/talos/pkg/cluster/check" "github.com/siderolabs/talos/pkg/machinery/api/common" machineapi "github.com/siderolabs/talos/pkg/machinery/api/machine" + "github.com/siderolabs/talos/pkg/machinery/api/storage" "github.com/siderolabs/talos/pkg/machinery/client" clientconfig "github.com/siderolabs/talos/pkg/machinery/client/config" "github.com/siderolabs/talos/pkg/machinery/config" @@ -507,7 +508,11 @@ func (apiSuite *APISuite) UserDisks(ctx context.Context, node string, sizeGreate for _, msg := range resp.Messages { for _, disk := range msg.Disks { - if disk.SystemDisk { + if disk.SystemDisk || disk.Readonly || disk.Type == storage.Disk_CD { + continue + } + + if disk.BusPath == "/virtual" { continue } diff --git a/pkg/machinery/api/resource/definitions/block/block.pb.go b/pkg/machinery/api/resource/definitions/block/block.pb.go index a77cb54903..ed8201fe69 100644 --- a/pkg/machinery/api/resource/definitions/block/block.pb.go +++ b/pkg/machinery/api/resource/definitions/block/block.pb.go @@ -311,6 +311,7 @@ type DiskSpec struct { SubSystem string `protobuf:"bytes,10,opt,name=sub_system,json=subSystem,proto3" json:"sub_system,omitempty"` Transport string `protobuf:"bytes,11,opt,name=transport,proto3" json:"transport,omitempty"` Rotational bool `protobuf:"varint,12,opt,name=rotational,proto3" json:"rotational,omitempty"` + Cdrom bool `protobuf:"varint,13,opt,name=cdrom,proto3" json:"cdrom,omitempty"` } func (x *DiskSpec) Reset() { @@ -429,6 +430,13 @@ func (x *DiskSpec) GetRotational() bool { return false } +func (x *DiskSpec) GetCdrom() bool { + if x != nil { + return x.Cdrom + } + return false +} + // SystemDiskSpec is the spec for SystemDisks status. type SystemDiskSpec struct { state protoimpl.MessageState @@ -532,7 +540,7 @@ var file_resource_definitions_block_block_proto_rawDesc = []byte{ 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x10, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x22, 0xca, 0x02, 0x0a, 0x08, 0x44, + 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x22, 0xe0, 0x02, 0x0a, 0x08, 0x44, 0x69, 0x73, 0x6b, 0x53, 0x70, 0x65, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x6f, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x69, 0x6f, @@ -553,15 +561,16 @@ var file_resource_definitions_block_block_proto_rawDesc = []byte{ 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x72, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0x29, 0x0a, 0x0e, 0x53, 0x79, 0x73, 0x74, 0x65, - 0x6d, 0x44, 0x69, 0x73, 0x6b, 0x53, 0x70, 0x65, 0x63, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x69, 0x73, - 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x69, 0x73, 0x6b, - 0x49, 0x64, 0x42, 0x4a, 0x5a, 0x48, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x73, 0x69, 0x64, 0x65, 0x72, 0x6f, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x74, 0x61, 0x6c, 0x6f, - 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x64, 0x65, 0x66, - 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x64, 0x72, 0x6f, 0x6d, + 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x63, 0x64, 0x72, 0x6f, 0x6d, 0x22, 0x29, 0x0a, + 0x0e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x44, 0x69, 0x73, 0x6b, 0x53, 0x70, 0x65, 0x63, 0x12, + 0x17, 0x0a, 0x07, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x64, 0x69, 0x73, 0x6b, 0x49, 0x64, 0x42, 0x4a, 0x5a, 0x48, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x69, 0x64, 0x65, 0x72, 0x6f, 0x6c, 0x61, 0x62, + 0x73, 0x2f, 0x74, 0x61, 0x6c, 0x6f, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x61, 0x63, 0x68, + 0x69, 0x6e, 0x65, 0x72, 0x79, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x62, + 0x6c, 0x6f, 0x63, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/machinery/api/resource/definitions/block/block_vtproto.pb.go b/pkg/machinery/api/resource/definitions/block/block_vtproto.pb.go index b22c197327..2c8d9f3194 100644 --- a/pkg/machinery/api/resource/definitions/block/block_vtproto.pb.go +++ b/pkg/machinery/api/resource/definitions/block/block_vtproto.pb.go @@ -263,6 +263,16 @@ func (m *DiskSpec) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.Cdrom { + i-- + if m.Cdrom { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x68 + } if m.Rotational { i-- if m.Rotational { @@ -544,6 +554,9 @@ func (m *DiskSpec) SizeVT() (n int) { if m.Rotational { n += 2 } + if m.Cdrom { + n += 2 + } n += len(m.unknownFields) return n } @@ -1639,6 +1652,26 @@ func (m *DiskSpec) UnmarshalVT(dAtA []byte) error { } } m.Rotational = bool(v != 0) + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Cdrom", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Cdrom = bool(v != 0) default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:]) diff --git a/pkg/machinery/api/storage/storage.pb.go b/pkg/machinery/api/storage/storage.pb.go index ce798288de..b4bc3f57c0 100644 --- a/pkg/machinery/api/storage/storage.pb.go +++ b/pkg/machinery/api/storage/storage.pb.go @@ -32,6 +32,7 @@ const ( Disk_HDD Disk_DiskType = 2 Disk_NVME Disk_DiskType = 3 Disk_SD Disk_DiskType = 4 + Disk_CD Disk_DiskType = 5 ) // Enum value maps for Disk_DiskType. @@ -42,6 +43,7 @@ var ( 2: "HDD", 3: "NVME", 4: "SD", + 5: "CD", } Disk_DiskType_value = map[string]int32{ "UNKNOWN": 0, @@ -49,6 +51,7 @@ var ( "HDD": 2, "NVME": 3, "SD": 4, + "CD": 5, } ) @@ -347,7 +350,7 @@ var file_storage_storage_proto_rawDesc = []byte{ 0x1a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xa0, 0x03, 0x0a, 0x04, 0x44, 0x69, 0x73, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x73, + 0x74, 0x6f, 0x22, 0xa8, 0x03, 0x0a, 0x04, 0x44, 0x69, 0x73, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, @@ -369,29 +372,30 @@ var file_storage_storage_proto_rawDesc = []byte{ 0x0a, 0x09, 0x73, 0x75, 0x62, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x75, 0x62, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, - 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x22, 0x3b, 0x0a, 0x08, 0x44, 0x69, 0x73, 0x6b, + 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x22, 0x43, 0x0a, 0x08, 0x44, 0x69, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x53, 0x44, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x48, 0x44, 0x44, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x56, 0x4d, 0x45, 0x10, 0x03, 0x12, 0x06, 0x0a, - 0x02, 0x53, 0x44, 0x10, 0x04, 0x22, 0x5a, 0x0a, 0x05, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x12, 0x2c, - 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x23, 0x0a, 0x05, - 0x64, 0x69, 0x73, 0x6b, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x73, 0x74, - 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x6b, 0x52, 0x05, 0x64, 0x69, 0x73, 0x6b, - 0x73, 0x22, 0x3b, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x44, - 0x69, 0x73, 0x6b, 0x73, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x32, 0x49, - 0x0a, 0x0e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x37, 0x0a, 0x05, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x1a, 0x16, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x6b, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x37, 0x5a, 0x35, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x69, 0x64, 0x65, 0x72, 0x6f, 0x6c, 0x61, - 0x62, 0x73, 0x2f, 0x74, 0x61, 0x6c, 0x6f, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x61, 0x63, - 0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, - 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x02, 0x53, 0x44, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x43, 0x44, 0x10, 0x05, 0x22, 0x5a, 0x0a, + 0x05, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x23, 0x0a, 0x05, 0x64, 0x69, 0x73, 0x6b, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x44, 0x69, + 0x73, 0x6b, 0x52, 0x05, 0x64, 0x69, 0x73, 0x6b, 0x73, 0x22, 0x3b, 0x0a, 0x0d, 0x44, 0x69, 0x73, + 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x08, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x52, 0x08, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x32, 0x49, 0x0a, 0x0e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x37, 0x0a, 0x05, 0x44, 0x69, 0x73, 0x6b, + 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x73, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x42, 0x37, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x73, 0x69, 0x64, 0x65, 0x72, 0x6f, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x74, 0x61, 0x6c, 0x6f, 0x73, + 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/pkg/machinery/resources/block/disk.go b/pkg/machinery/resources/block/disk.go index c1f4a12bdb..3c393d307f 100644 --- a/pkg/machinery/resources/block/disk.go +++ b/pkg/machinery/resources/block/disk.go @@ -28,6 +28,7 @@ type DiskSpec struct { SectorSize uint `yaml:"sectorSize" protobuf:"3"` Readonly bool `yaml:"readonly" protobuf:"4"` + CDROM bool `yaml:"cdrom" protobuf:"13"` Model string `yaml:"model,omitempty" protobuf:"5"` Serial string `yaml:"serial,omitempty" protobuf:"6"` diff --git a/website/content/v1.8/reference/api.md b/website/content/v1.8/reference/api.md index e72448dce9..4fa75f5995 100644 --- a/website/content/v1.8/reference/api.md +++ b/website/content/v1.8/reference/api.md @@ -836,6 +836,7 @@ DiskSpec is the spec for Disks status. | sub_system | [string](#string) | | | | transport | [string](#string) | | | | rotational | [bool](#bool) | | | +| cdrom | [bool](#bool) | | | @@ -8107,6 +8108,7 @@ DisksResponse represents the response of the `Disks` RPC. | HDD | 2 | | | NVME | 3 | | | SD | 4 | | +| CD | 5 | |