2

What value do I need to provide for RelativeMountPath to mount a file share to the batch pool with windows compute nodes?

https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.management.batchai.models.azurefilesharereference.relativemountpath?view=azure-dotnet

As per the documentation, it says "The relative path on the compute node where the file system will be mounted"

Currently, I get "MountConfigurationException: Incorrect invocation or permissions" error, when it adds a node to the pool.

I tried using both powershell and C# code. In both scenarios, it didnt work. Below is the C# code

private static void CreateBatchPool(BatchClient batchClient, CloudServiceConfiguration cloudServiceConfiguration)
        {
                CloudPool pool = batchClient.PoolOperations.CreatePool(
                    poolId: PoolId,
                    targetDedicatedComputeNodes: PoolNodeCount,
                    virtualMachineSize: PoolVMSize,
                    targetLowPriorityComputeNodes: 0,
                    cloudServiceConfiguration: cloudServiceConfiguration);
                pool.MaxTasksPerComputeNode = 8;
                pool.ApplicationPackageReferences = CreateAppPackageReferences();
                pool.TaskSchedulingPolicy = new TaskSchedulingPolicy(ComputeNodeFillType.Pack);
                pool.MountConfiguration = new List<MountConfiguration>();
                pool.MountConfiguration.Add(new MountConfiguration(CreateFileShareConfiguration(batchClient)));

                pool.Commit();
}

            private static AzureFileShareConfiguration CreateFileShareConfiguration(BatchClient batchClient)
        {
            string url = @"https://storage.file.core.windows.net/fileshare";
            AzureFileShareConfiguration fileShareConfiguration = new AzureFileShareConfiguration(StorageAccountName, url, "foo", StorageAccountKey);
            return fileShareConfiguration;
        }
Mike143
  • 163
  • 3
  • 14

1 Answers1

4

Please note the API you are using is the BatchAI API and azure-batch has a separate API as well, I will fix the tag as well. I wanted to clear that first before answering to your post :)

for completeness I will mention the Azue-batch vanilla mount API below with detail and link.

  • Regarding the BatchAI API I think it is same as the batch vanilla api where RelativeMountPath is the relative directory structure of the folder accessible by using the environment variable i.e. AZ_BATCHAI_MOUNT_ROOT + <dir_name_supplied> Say for example: if you supply relative mount directory name as foo then once pool is successfully created at the Batch Level the mounted directory will be accessible via : AZ_BATCHAI_MOUNT_ROOT\foo

  • further accessing environment variable is detailed here: https://learn.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables#command-line-expansion-of-environment-variables like in windows you can access via %MY_ENV_VAR% et. al.

  • Further, the MountConfigurationException: Incorrect invocation or permissions represent that you have supplied wrong information which is causing the mis-configuration hence batch is returning the permission error. The document mentioned above should be able to guide.

OR Extra information about separate batch level API

Azure-Batch Vanilla mount API (Note: You are not using this but I am giving this information just as fyi)

This document has good detail to start with, Mount virtual file system on a pool.

For this specific API In mount for azurefile system the context of RelativeMountPath for directory structure created relative to standard fsmounts directory accessible on the node via AZ_BATCH_NODE_MOUNTS_DIR environment variable.:i.e.

Relative mount path or Source: The location of the file system mounted on the compute node, relative to standard fsmounts directory accessible on the node via AZ_BATCH_NODE_MOUNTS_DIR. The exact location varies depending on the operating system used on the node. For example, the physical location on an Ubuntu node is mapped to mnt\batch\tasks\fsmounts, and on a CentOS node it is mapped to mnt\resources\batch\tasks\fsmounts.

In windows nodes it will be somewhere at widows level file directory of fsmounts more details or environment variable is here https://learn.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables

This should be able to guide you to right direction. Thanks!

Tats_innit
  • 33,991
  • 10
  • 71
  • 77
  • Thanks for your help. I am using below powershell script to mount the file share to the batch pool. I am providing correct information, I believe. Follwing is the script command: $fileShareConfig = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSAzureFileShareConfiguration" ` -ArgumentList @("accountname", "https://[batchaccount].file.core.windows.net/{fileshare}","fooRelativePath", ` "storageaccountkey") – Mike143 Jan 13 '20 at 16:39
  • All good and glad it helped, `:)` cool, so at **first** you mentioned using the `BatchAI API` but the powershell you are referring is the `Batch`. **Secondly**, the order of the argument looks incorrect so please do check the order of the arguments you are passing, **Thirdly** in you are using C# APIhttps://github.com/MicrosoftDocs/azure-docs/blob/master/articles/batch/virtual-file-mount.md#azure-files-share **fourth** **For Debugging refer to this** please refer https://docs.microsoft.com/en-us/azure/batch/virtual-file-mount#diagnose-mount-errors , should give you some good pointers, thanks. – Tats_innit Jan 17 '20 at 02:35