diff --git a/pkg/volume/azure_dd/attacher.go b/pkg/volume/azure_dd/attacher.go index 4f7b50f378..adfd1ab72c 100644 --- a/pkg/volume/azure_dd/attacher.go +++ b/pkg/volume/azure_dd/attacher.go @@ -185,10 +185,6 @@ func (a *azureDiskAttacher) WaitForAttach(spec *volume.Spec, devicePath string, // did we find it? if newDevicePath != "" { - // the current sequence k8s uses for unformated disk (check-disk, mount, fail, mkfs.extX) hangs on - // Azure Managed disk scsi interface. this is a hack and will be replaced once we identify and solve - // the root case on Azure. - formatIfNotFormatted(newDevicePath, *volumeSource.FSType, exec) return true, nil } diff --git a/pkg/volume/azure_dd/azure_common_linux.go b/pkg/volume/azure_dd/azure_common_linux.go index 806e27e0e9..383b46f468 100644 --- a/pkg/volume/azure_dd/azure_common_linux.go +++ b/pkg/volume/azure_dd/azure_common_linux.go @@ -178,45 +178,3 @@ func findDiskByLunWithConstraint(lun int, io ioHandler, azureDisks []string) (st } return "", err } - -func formatIfNotFormatted(disk string, fstype string, exec mount.Exec) { - notFormatted, err := diskLooksUnformatted(disk, exec) - if err == nil && notFormatted { - args := []string{disk} - // Disk is unformatted so format it. - // Use 'ext4' as the default - if len(fstype) == 0 { - fstype = "ext4" - } - if fstype == "ext4" || fstype == "ext3" { - args = []string{"-E", "lazy_itable_init=0,lazy_journal_init=0", "-F", disk} - } - glog.Infof("azureDisk - Disk %q appears to be unformatted, attempting to format as type: %q with options: %v", disk, fstype, args) - - _, err := exec.Run("mkfs."+fstype, args...) - if err == nil { - // the disk has been formatted successfully try to mount it again. - glog.Infof("azureDisk - Disk successfully formatted with 'mkfs.%s %v'", fstype, args) - } else { - glog.Warningf("azureDisk - Error formatting volume with 'mkfs.%s %v': %v", fstype, args, err) - } - } else { - if err != nil { - glog.Warningf("azureDisk - Failed to check if the disk %s formatted with error %s, will attach anyway", disk, err) - } else { - glog.Infof("azureDisk - Disk %s already formatted, will not format", disk) - } - } -} - -func diskLooksUnformatted(disk string, exec mount.Exec) (bool, error) { - args := []string{"-nd", "-o", "FSTYPE", disk} - glog.V(4).Infof("Attempting to determine if disk %q is formatted using lsblk with args: (%v)", disk, args) - dataOut, err := exec.Run("lsblk", args...) - if err != nil { - glog.Errorf("Could not determine if disk %q is formatted (%v)", disk, err) - return false, err - } - output := libstrings.TrimSpace(string(dataOut)) - return output == "", nil -} diff --git a/pkg/volume/azure_dd/azure_common_unsupported.go b/pkg/volume/azure_dd/azure_common_unsupported.go index 6710af8fcb..ba938ccc28 100644 --- a/pkg/volume/azure_dd/azure_common_unsupported.go +++ b/pkg/volume/azure_dd/azure_common_unsupported.go @@ -26,6 +26,3 @@ func scsiHostRescan(io ioHandler, exec mount.Exec) { func findDiskByLun(lun int, io ioHandler, exec mount.Exec) (string, error) { return "", nil } - -func formatIfNotFormatted(disk string, fstype string, exec mount.Exec) { -}