From 0ffa961ea31b1116ea48fa7cc62d0f1e5b7ddad3 Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Fri, 16 Mar 2018 08:25:03 +0000 Subject: [PATCH] respect fstype in Windows for azure disk --- pkg/volume/azure_dd/azure_common_windows.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/volume/azure_dd/azure_common_windows.go b/pkg/volume/azure_dd/azure_common_windows.go index e22aff4523e..6ee1a6d0558 100644 --- a/pkg/volume/azure_dd/azure_common_windows.go +++ b/pkg/volume/azure_dd/azure_common_windows.go @@ -103,8 +103,12 @@ func formatIfNotFormatted(disk string, fstype string, exec mount.Exec) { return } + if len(fstype) == 0 { + // Use 'NTFS' as the default + fstype = "NTFS" + } cmd := fmt.Sprintf("Get-Disk -Number %s | Where partitionstyle -eq 'raw' | Initialize-Disk -PartitionStyle MBR -PassThru", disk) - cmd += " | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -Confirm:$false" + cmd += fmt.Sprintf(" | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem %s -Confirm:$false", fstype) output, err := exec.Run("powershell", "/c", cmd) if err != nil { glog.Errorf("azureDisk Mount: Get-Disk failed, error: %v, output: %q", err, string(output))