From 0e8db10a54b64080d6a4bce61a61c336652b9f98 Mon Sep 17 00:00:00 2001 From: chrislusf Date: Wed, 10 Dec 2025 14:48:04 -0800 Subject: [PATCH] ec: dynamically discover disk types from topology for evacuation Disk types are free-form tags (e.g., 'ssd', 'nvme', 'archive') that come from the topology, not a hardcoded set. Only 'hdd' (or empty) is the default disk type. Use collectVolumeDiskTypes() to discover all disk types present in the cluster topology instead of hardcoding [HardDriveType, SsdType]. --- test/erasure_coding/ec_integration_test.go | 2 +- weed/shell/command_volume_server_evacuate.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/erasure_coding/ec_integration_test.go b/test/erasure_coding/ec_integration_test.go index 229c39b88..659dfcdb4 100644 --- a/test/erasure_coding/ec_integration_test.go +++ b/test/erasure_coding/ec_integration_test.go @@ -1282,7 +1282,7 @@ func TestECDiskTypeSupport(t *testing.T) { args := []string{ "-collection", "ssd_test", "-sourceDiskType", "ssd", // Filter source volumes by SSD - "-diskType", "ssd", // Place EC shards on SSD + "-diskType", "ssd", // Place EC shards on SSD "-force", } diff --git a/weed/shell/command_volume_server_evacuate.go b/weed/shell/command_volume_server_evacuate.go index 00c8b6b0a..a13e8e671 100644 --- a/weed/shell/command_volume_server_evacuate.go +++ b/weed/shell/command_volume_server_evacuate.go @@ -156,12 +156,13 @@ func (c *commandVolumeServerEvacuate) evacuateNormalVolumes(commandEnv *CommandE } func (c *commandVolumeServerEvacuate) evacuateEcVolumes(commandEnv *CommandEnv, volumeServer string, skipNonMoveable, applyChange bool, writer io.Writer) error { - // Evacuate EC volumes for all disk types + // Evacuate EC volumes for all disk types discovered from topology + // Disk types are free-form tags (e.g., "", "hdd", "ssd", "nvme", etc.) // We need to handle each disk type separately because shards should be moved to nodes with the same disk type // We collect topology once at the start and track capacity changes ourselves // (via freeEcSlot decrement after each move) rather than repeatedly refreshing, // which would give a false sense of correctness since topology could be stale. - diskTypes := []types.DiskType{types.HardDriveType, types.SsdType} + diskTypes := collectVolumeDiskTypes(c.topologyInfo) for _, diskType := range diskTypes { ecNodes, _ := collectEcVolumeServersByDc(c.topologyInfo, "", diskType)