コード例 #1
0
        public override async Task <NodePublishVolumeResponse> NodePublishVolume(
            NodePublishVolumeRequest request, ServerCallContext context)
        {
            var id         = request.VolumeId;
            var targetPath = request.TargetPath;

            using (var _s = logger.StepInformation("{0}, id: {1}, targetPath: {2}",
                                                   nameof(NodePublishVolume), id, targetPath))
            {
                try
                {
                    (var unc, var cred) = azureFileCsiService.GetSmbShare(id, request.NodePublishSecrets);
                    await smbShareAttacher.AttachAsync(
                        targetPath,
                        unc,
                        cred);
                }
                catch (Exception ex)
                {
                    logger.LogWarning(ex, "Exception in AttachAsync");
                    throw;
                }

                _s.Commit();
            }

            await Task.CompletedTask;

            return(new NodePublishVolumeResponse());
        }