九章智算云

修改存储实例挂载路径

修改指定 NAS 存储实例在容器中的挂载路径。挂载路径决定该存储被加载到工作负载(如分布式训练任务)容器内的目录位置;修改后会影响后续引用该存储的任务的读写位置,已在运行的任务不受影响。可先调用检测存储实例是否被挂载确认占用状态。

PUThttps://api.alayanew.com/v1/nasStorage/instance/{id}/mountPath

鉴权(Authorizations)

AuthorizationString必填

用户可通过已获取的 Open API Key 做验证。例如:Bearer [YOUR_API_KEY]

Path Parameters

idString必填

存储实例 ID。例如:72a2a885-e45e-4c79-aaf3-e1fa05abdb92

Request body

mountPathString

新的挂载路径。长度 2~64 个字符,仅允许字母、数字、下划线 _ 与斜杠 /(正则:^[a-zA-Z0-9_/]{2,64}$)。例如:/mnt/nas/new_path

Response

statusInteger

业务状态码,200 表示修改成功。

messageString

接口响应信息。例如:"OK"

dataObject

业务数据。

curl -X 'PUT' \
  'https://api.alayanew.com/v1/nasStorage/instance/72a2a885-e45e-4c79-aaf3-e1fa05abdb92/mountPath' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer [YOUR_API_KEY]' \
  -d '{
  "mountPath": "/mnt/nas/new_path"
}'
import requests

storage_id = "72a2a885-e45e-4c79-aaf3-e1fa05abdb92"
url = f"https://api.alayanew.com/v1/nasStorage/instance/{storage_id}/mountPath"
headers = {
    "accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": "Bearer [YOUR_API_KEY]"
}
payload = {
    "mountPath": "/mnt/nas/new_path"
}

response = requests.put(url, headers=headers, json=payload)
print(response.json())
const storageId = '72a2a885-e45e-4c79-aaf3-e1fa05abdb92';
const payload = {
  mountPath: '/mnt/nas/new_path'
};

fetch(`https://api.alayanew.com/v1/nasStorage/instance/${storageId}/mountPath`, {
  method: 'PUT',
  headers: {
    'accept': 'application/json',
    'Content-Type': 'application/json',
    'Authorization': 'Bearer [YOUR_API_KEY]'
  },
  body: JSON.stringify(payload)
})
  .then(res => res.json())
  .then(console.log)
  .catch(console.error);
{
  "status": 200,
  "message": "OK",
  "data": {}
}
{
  "status": 403,
  "message": "Forbidden",
  "data": {}
}
{
  "status": 500,
  "message": "Internal Server Error",
  "data": {}
}

最后更新于