Merge pull request #61267 from andyzhangx/respect-windows-disk

Automatic merge from submit-queue (batch tested with PRs 60793, 61181, 61267, 61252, 61334). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

respect fstype in Windows for azure disk

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #61266

**Special notes for your reviewer**:

**Release note**:

```
respect fstype in Windows for azure disk
```

/sig azure
/sig windows
/assign @feiskyer
This commit is contained in:
Kubernetes Submit Queue 2018-03-21 20:23:14 -07:00 committed by GitHub
commit 28aa3c745a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))