From ba63dd80484c332d2b0759b41c0750836068eb62 Mon Sep 17 00:00:00 2001 From: NOMAD Date: Wed, 26 Aug 2020 12:04:51 +0800 Subject: [PATCH] cherry pick #19171 to release-4.0 Signed-off-by: ti-srebot --- telemetry/data_cluster_hardware.go | 2 +- telemetry/data_cluster_hardware_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/telemetry/data_cluster_hardware.go b/telemetry/data_cluster_hardware.go index c4c8f194a3a02..318e1ba63f48f 100644 --- a/telemetry/data_cluster_hardware.go +++ b/telemetry/data_cluster_hardware.go @@ -28,7 +28,7 @@ var ( // Explicitly list all allowed field names to avoid potential leaking sensitive info when new fields are added later. sortedCPUAllowedFieldNames = []string{"cpu-logical-cores", "cpu-physical-cores", "cpu-frequency", "cache", "cpu-vendor-id", "l1-cache-size", "l1-cache-line-size", "l2-cache-size", "l2-cache-line-size", "l3-cache-size", "l3-cache-line-size"} sortedDiskAllowedFieldNames = []string{"fstype", "opts", "total", "free", "used", "free-percent", "used-percent"} // path is not included - regexDiskAllowedNames = regexp.MustCompile(`^(disk\d+s\d+|rootfs|devtmpfs|sd[a-z]\d*|vd[a-z]\d*|hd[a-z]\d*|nvme\d+(n\d+(p\d)?)?)$`) + regexDiskAllowedNames = regexp.MustCompile(`^(disk\d+s\d+|rootfs|devtmpfs|sd[a-z]\d*|vd[a-z]\d*|hd[a-z]\d*|nvme\d+(n\d+(p\d)?)?|md[\da-z]+)$`) sortedDiskAllowedPaths = []string{"/", "/boot", "/dev", "/private/var/vm", "/System/Volumes/Data"} sortedMemoryAllowedFieldNames = []string{"capacity"} ) diff --git a/telemetry/data_cluster_hardware_test.go b/telemetry/data_cluster_hardware_test.go index 776c9834905b8..efe06eda93a6f 100644 --- a/telemetry/data_cluster_hardware_test.go +++ b/telemetry/data_cluster_hardware_test.go @@ -31,7 +31,7 @@ func (s *testClusterHardwareSuite) TestNormalizeDiskName(c *C) { func (s *testClusterHardwareSuite) TestIsNormalizedDiskNameAllowed(c *C) { c.Parallel() - passList := []string{"disk1s4", "rootfs", "devtmpfs", "sda", "sda1", "sdb", "sdb3", "sdc", "nvme0", "nvme0n1", "nvme0n1p0"} + passList := []string{"disk1s4", "rootfs", "devtmpfs", "sda", "sda1", "sdb", "sdb3", "sdc", "nvme0", "nvme0n1", "nvme0n1p0", "md127", "mdisk1s4"} for _, n := range passList { c.Assert(isNormalizedDiskNameAllowed(n), Equals, true) }