func (nodeServer *PacketNodeServer) NodeStageVolume(ctx context.Context, in *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {
	nodeServer.Driver.Logger.Info("NodeStageVolume called")
	volumeName := in.PublishContext["VolumeName"]
	if volumeName == "" {
		return nil, status.Error(codes.InvalidArgument, "VolumeName unspecified for NodeStageVolume")
	}
	if nodeServer.initiator == "" {
		initiatorName, err := nodeServer.MetadataDriver.GetInitiator()
		if err != nil {
			nodeServer.Driver.Logger.Errorf("NodeGetInfo: metadata error %v", err)
			return nil, status.Errorf(codes.Unknown, "metadata error, %s", err.Error())
		}
		nodeServer.initiator = initiatorName
	}
	volumeMetaData, err := nodeServer.MetadataDriver.GetVolumeMetadata(volumeName)
	if err != nil {
		nodeServer.Driver.Logger.Errorf("NodeStageVolume: %v", err)
		return nil, status.Errorf(codes.Unknown, "metadata error, %s", err.Error())
	}
	if len(volumeMetaData.IPs) == 0 {
		return nil, status.Errorf(codes.Unknown, "volume %s has no portals", volumeName)
	}
	if in.GetVolumeCapability() == nil {
		return nil, status.Error(codes.InvalidArgument, "VolumeCapability unspecified for NodeStageVolume")
	}
	mnt := in.VolumeCapability.GetMount()
	if mnt.FsType != "" {
		if mnt.FsType != "ext4" {
			return nil, status.Errorf(codes.InvalidArgument, "fs type %s not supported", mnt.FsType)
		}
	}
	logger := nodeServer.Driver.Logger.WithFields(log.Fields{
		"volume_id":           in.VolumeId,
		"volume_name":         volumeName,
		"staging_target_path": in.StagingTargetPath,
		"fsType":              mnt.FsType,
		"method":              "NodeStageVolume",
	})
	for _, ip := range volumeMetaData.IPs {
		err = nodeServer.Driver.Attacher.Discover(ip.String(), nodeServer.initiator)  
		if err != nil {
			logger.Infof("iscsiadmin discover error, %+v", err)
			return nil, status.Errorf(codes.Unknown, "iscsiadmin discover error, %+v", err)
		}
		err = nodeServer.Driver.Attacher.Login(ip.String(), volumeMetaData.IQN)
		if err != nil {
			logger.Infof("iscsiadmin login error, %+v", err)
			return nil, status.Errorf(codes.Unknown, "iscsiadmin login error, %+v", err)
		}
	}
	devicePath, err := nodeServer.Driver.Attacher.GetDevice(volumeMetaData.IPs[0].String(), volumeMetaData.IQN)
	if err != nil {
		logger.Infof("devicePath error, %+v", err)
		return nil, status.Errorf(codes.Unknown, "devicePath error, %+v", err)
	}
	scsiID, err := nodeServer.Driver.Attacher.GetScsiID(devicePath)
	if err != nil {
		logger.Infof("scsiID error, path %s, %+v", devicePath, err)
		return nil, status.Errorf(codes.Unknown, "scsiIDerror, %+v", err)
	}
	bindings, discards, err := nodeServer.Driver.Attacher.MultipathReadBindings()
	if err != nil {
		logger.Infof("readBindings error, %+v", err)
		return nil, status.Errorf(codes.Unknown, "readBindings error, %+v", err)
	}
	bindings[volumeName] = scsiID
	err = nodeServer.Driver.Attacher.MultipathWriteBindings(bindings)
	if err != nil {
		logger.Infof("writeBindings error, %+v", err)
		return nil, status.Errorf(codes.Unknown, "writeBindings error, %+v", err)
	}
	for mappingName := range discards {
		multipath("-f", mappingName)
	}
	multipath(volumeName)
	multipath(volumeName)
	check, err := multipath("-ll", devicePath)
	logger.Infof("multipath check for %s: %s", devicePath, check)
	if check == "" {
		logger.Infof("empty multipath check for %s", devicePath)
	}
	blockInfo, err := nodeServer.Driver.Mounter.GetMappedDevice(volumeName)
	if err != nil {
		logger.Infof("getMappedDevice error, %+v", err)
		return nil, status.Errorf(codes.Unknown, "getMappedDevice error, %+v", err)
	}
	if blockInfo.FsType == "" {
		err = nodeServer.Driver.Mounter.FormatMappedDevice(volumeName)
		if err != nil {
			logger.Infof("formatMappedDevice error, %+v", err)
			return nil, status.Errorf(codes.Unknown, "formatMappedDevice error, %+v", err)
		}
	}
	logger.Info("mounting mapped device")
	err = nodeServer.Driver.Mounter.MountMappedDevice(volumeName, in.StagingTargetPath)
	if err != nil {
		logger.Infof("mountMappedDevice error, %v", err)
		return nil, status.Errorf(codes.Unknown, "mountMappedDevice error, %+v", err)
	}
	logger.Infof("NodeStageVolume complete")
	return &csi.NodeStageVolumeResponse{}, nil
}
NodeStageVolume ~ iscisadmin, multipath, format
package driver
import (
	"github.com/packethost/csi-packet/pkg/packet"
	log "github.com/sirupsen/logrus"
	"github.com/container-storage-interface/spec/lib/go/csi"
	"golang.org/x/net/context"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"
)
var _ csi.NodeServer = &PacketNodeServer{}
type PacketNodeServer struct {
	Driver         *PacketDriver
	MetadataDriver *packet.MetadataDriver
	Initialized    bool
	initiator      string
}
func NewPacketNodeServer(driver *PacketDriver, metadata *packet.MetadataDriver) (*PacketNodeServer, error) {
	return &PacketNodeServer{
		Driver:         driver,
		MetadataDriver: metadata,
		Initialized:    false,
	}, nil
}