func NewPDVolume()

in pkg/localvolume/pd.go [25:35]


func NewPDVolume(diskName, mountPath string) (LocalVolume, error) {
	if diskName == "" {
		return nil, common.NewVolumePendingError(fmt.Errorf("empty disk name"))
	}
	// This assumes the disk has been attached to the node with the device name that's the same as the disk name.
	device := fmt.Sprintf("/dev/disk/by-id/google-%s", diskName)
	if _, err := os.Stat(device); errors.Is(err, os.ErrNotExist) {
		return nil, common.NewVolumePendingError(fmt.Errorf("Waiting for attach, %s does not yet exist", device))
	}
	return NewFromDevice(device, mountPath)
}