Repository: openshift/assisted-service (language: python)

Issue:
MGMT-17848: Assisted service should not format multipath devices
Exclude multipath drive type from being formatted.


Discussion / hints:

Fix patch:
diff --git a/internal/common/disk_formatting.go b/internal/common/disk_formatting.go
index 613aa8dd0bb..ed3d0fb30b1 100644
--- a/internal/common/disk_formatting.go
+++ b/internal/common/disk_formatting.go
@@ -13,7 +13,7 @@ import (
 func GetDisksToBeFormatted(inventory *models.Inventory) []*models.Disk {
 	formatDisks := make([]*models.Disk, 0, len(inventory.Disks))
 
-	skipDriveTypes := []string{string(models.DriveTypeFC), string(models.DriveTypeISCSI), string(models.DriveTypeLVM)}
+	skipDriveTypes := []string{string(models.DriveTypeFC), string(models.DriveTypeISCSI), string(models.DriveTypeLVM), string(models.DriveTypeMultipath)}
 	for _, disk := range inventory.Disks {
 		diskRemovable := disk.Removable || strings.Contains(disk.ByPath, "mmcblk") //mmc devices should be treated as removable
 


Test patch:
diff --git a/internal/host/hostcommands/install_cmd_test.go b/internal/host/hostcommands/install_cmd_test.go
index dae60d67378..f0983156732 100644
--- a/internal/host/hostcommands/install_cmd_test.go
+++ b/internal/host/hostcommands/install_cmd_test.go
@@ -219,17 +219,25 @@ var _ = Describe("installcmd", func() {
 		sdh := createDisk("sdh", false)
 		sdc := createDisk("sdc", true)
 
-		It("Doesn't format removable disks", func() {
-			disks := []*models.Disk{
-				createRemovableDisk("sda", true), //removable disk
-				sdb,                              //installation disk
-			}
-			host.Inventory = getInventory(disks)
-			mockFormatEvent(disks[0], 0)
-			prepareGetStep(sdb)
-			installCmdSteps, stepErr = installCmd.GetSteps(ctx, &host)
-			verifyDiskFormatCommand(installCmdSteps[0], disks[0].ID, false)
-		})
+		DescribeTable("Doesn't format",
+			func(disk *models.Disk) {
+				disks := []*models.Disk{
+					disk,
+					sdb, // installation disk
+				}
+				host.Inventory = getInventory(disks)
+				mockFormatEvent(disks[0], 0)
+				prepareGetStep(sdb)
+				installCmdSteps, stepErr = installCmd.GetSteps(ctx, &host)
+				verifyDiskFormatCommand(installCmdSteps[0], disks[0].ID, false)
+			},
+			Entry("when disk is removable", createRemovableDisk("sda", true)),
+			Entry("when disk path contains mmcblk", &models.Disk{DriveType: models.DriveTypeHDD, ID: "/dev/disk/by-id/wwn-someid", ByPath: "/dev/mmcblk0", Name: "sda", SizeBytes: int64(128849018880), Bootable: true}),
+			Entry("when disk type is LVM", &models.Disk{DriveType: models.DriveTypeLVM, ID: "/dev/disk/by-id/wwn-someid", Name: "sda", SizeBytes: int64(128849018880), Bootable: true}),
+			Entry("when disk type is iSCSI", &models.Disk{DriveType: models.DriveTypeISCSI, ID: "/dev/disk/by-id/wwn-someid", Name: "sda", SizeBytes: int64(128849018880), Bootable: true}),
+			Entry("when disk type is FC", &models.Disk{DriveType: models.DriveTypeFC, ID: "/dev/disk/by-id/wwn-someid", Name: "sda", SizeBytes: int64(128849018880), Bootable: true}),
+			Entry("when disk type is multipath", &models.Disk{DriveType: models.DriveTypeMultipath, ID: "/dev/disk/by-id/wwn-someid", Name: "sda", SizeBytes: int64(128849018880), Bootable: true}),
+		)
 
 		It("Formats a single removable disk", func() {
 			disks := []*models.Disk{