如何使用 Softlayer API 授权 iSCSI 存储
how use Softlayer API to authorize an iscsi storage
我尝试使用此命令在新系统上授权软层耐久性存储
curl -v -i -X POST -d '{"parameters": [{"id": [IP ADDRESS ID]}]}' -u "[USERNAME]:[APIKEY]" https://api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[STORAGE ID]/allowAccessFromIpAddress.jso
我按照 link 中的说明进行操作,但它不起作用。
https://sldn.softlayer.com/it/blog/sjanowiak/how-use-softlayer-api-authorize-guest-vms-iscsi-storage
控制台returns这个错误。 (显然我在参数中输入了正确的值)
{"error":"SoftLayer_Network_Storage::allowAccesstFromVirtualGuestList is not implemented.","code":"SoftLayer_Exception_NotImplemented"}
如何使用 SoftLayer API 授权 VM 使用 iSCSI 存储?
python 服务 SoftLayer.ISCSIManager(client)
有功能吗?
此致
以下是一些可能对您有所帮助的建议:
- “网络存储”和VSI/Bar Metal/Subnet必须位于同一个location/datacenter。
这些请求帮助我们获得可用项目,可以授权给特定的“网络存储”,正如我们在门户中看到的那样:
要获取具有关联 IP 地址的有效可用子网,请执行:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[storage_id]/ getAllowableSubnets?objectMask=mask[id,networkIdentifier,cidr,subnetType,ipAddresses[id,ipAddress]]
Method: GET
要获得有效的可用虚拟客人,请执行:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage_Iscsi/[storage_id]/ getAllowableVirtualGuests?objectMask=mask[id,fullyQualifiedDomainName] Method: GET
可用金属条:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[storage_id]/getAllowableHardware
Method: GET
参考文献:
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Iscsi/getAllowableVirtualGuests
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Iscsi/getAllowableSubnets
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Iscsi/getAllowableHardware
好像没有使用ISCSI Manager授权网络存储的功能。但下面是一些使用 python client.
的示例
Python 例子:
使用:SoftLayer_Network_Storage:: allowAccessFromIpAddress
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
API_USERNAME = 'set me'
API_KEY = 'set me'
# Set the server id that you wish to allow.
ipAddressId = 20636706
iscsiId = 8393467
# Set up your API client
client = SoftLayer.Client(
username=API_USERNAME,
api_key=API_KEY
)
try:
# The expected result after executing the script is: true
# To get valid Ip address, execute:
# https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[Storage_id]/getAllowableSubnets?objectMask=mask[id,networkIdentifier,cidr,subnetType,ipAddresses[id,ipAddress]]
result = client['SoftLayer_Network_Storage'].allowAccessFromIpAddress({"id":ipAddressId},id=iscsiId)
pp(result)
except SoftLayer.SoftLayerAPIError as e:
pp('Unable to allow the access to ISCSI faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
使用:SoftLayer_Network_Storage:: allowAccessFromVirtualGuest
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
API_USERNAME = 'set me'
API_KEY = 'set me'
# Set the server id that you wish to allow.
vsiId = 14388437
iscsiId = 8393467
# Set up your API client
client = SoftLayer.Client(
username=API_USERNAME,
api_key=API_KEY
)
try:
# The expected result after executing the script is: true
# To get valid Virtual Guest ids, execute:
# https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[storage_id]/getAllowableVirtualGuests?objectMask=mask[id,fullyQualifiedDomainName]
result = client['SoftLayer_Network_Storage'].allowAccessFromVirtualGuest({"id":vsiId},id=iscsiId)
pp(result)
except SoftLayer.SoftLayerAPIError as e:
pp('Unable to allow the access to ISCSI faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
使用:SoftLayer_Virtual_Guest::allowAccessToNetworkStorage
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
API_USERNAME = 'set me'
API_KEY = 'set me'
# Set the server id that you wish to allow.
serverId = 14388435
iscsiId = 8393467
# Set up your API client
client = SoftLayer.Client(
username=API_USERNAME,
api_key=API_KEY
)
try:
# The expected result after executing the script is: true
result = client['SoftLayer_Virtual_Guest'].allowAccessToNetworkStorage({"id":iscsiId},id=serverId)
pp(result)
except SoftLayer.SoftLayerAPIError as e:
pp('Unable to allow the access to ISCSI faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
参考文献:
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/allowAccessFromVirtualGuest
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/allowAccessFromHardware
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/allowAccessToNetworkStorage
https://github.com/softlayer/softlayer-python
编辑
我使用“Endurance Replica”重现了同样的问题。
这是授权虚拟访客的 python 示例:
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
API_USERNAME = 'set me'
API_KEY = 'set me'
# Set the server id that you wish to allow.
vsiId = 15571333
storageId = 6550721
objectType = "SoftLayer_Virtual_Guest"
# Set up your API client
client = SoftLayer.Client(
username=API_USERNAME,
api_key=API_KEY
)
try:
# To get valid Virtual Guest ids, execute:
# https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[storage_id]/getAllowableVirtualGuests?objectMask=mask[id,fullyQualifiedDomainName]
result = client['SoftLayer_Network_Storage'].allowAccessFromHostList([{"id":vsiId,"objectType": objectType}],id=storageId)
pp(result)
except SoftLayer.SoftLayerAPIError as e:
pp('Unable to allow the access to network Storage faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
如果要授权“虚拟访客”、“IpAddress”或“硬件”,“objectType”的有效值为:
“SoftLayer_Virtual_Guest”,“SoftLayer_Network_Subnet_IpAddress”,“SoftLayer_Hardware” 分别。
参考:
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/allowAccessFromHostList
此致。
我尝试使用此命令在新系统上授权软层耐久性存储
curl -v -i -X POST -d '{"parameters": [{"id": [IP ADDRESS ID]}]}' -u "[USERNAME]:[APIKEY]" https://api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[STORAGE ID]/allowAccessFromIpAddress.jso
我按照 link 中的说明进行操作,但它不起作用。 https://sldn.softlayer.com/it/blog/sjanowiak/how-use-softlayer-api-authorize-guest-vms-iscsi-storage
控制台returns这个错误。 (显然我在参数中输入了正确的值)
{"error":"SoftLayer_Network_Storage::allowAccesstFromVirtualGuestList is not implemented.","code":"SoftLayer_Exception_NotImplemented"}
如何使用 SoftLayer API 授权 VM 使用 iSCSI 存储?
python 服务 SoftLayer.ISCSIManager(client)
有功能吗?
此致
以下是一些可能对您有所帮助的建议:
- “网络存储”和VSI/Bar Metal/Subnet必须位于同一个location/datacenter。
这些请求帮助我们获得可用项目,可以授权给特定的“网络存储”,正如我们在门户中看到的那样:
要获取具有关联 IP 地址的有效可用子网,请执行:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[storage_id]/ getAllowableSubnets?objectMask=mask[id,networkIdentifier,cidr,subnetType,ipAddresses[id,ipAddress]]
Method: GET
要获得有效的可用虚拟客人,请执行:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage_Iscsi/[storage_id]/ getAllowableVirtualGuests?objectMask=mask[id,fullyQualifiedDomainName] Method: GET
可用金属条:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[storage_id]/getAllowableHardware
Method: GET
参考文献:
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Iscsi/getAllowableVirtualGuests http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Iscsi/getAllowableSubnets http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Iscsi/getAllowableHardware
好像没有使用ISCSI Manager授权网络存储的功能。但下面是一些使用 python client.
的示例Python 例子:
使用:SoftLayer_Network_Storage:: allowAccessFromIpAddress
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
API_USERNAME = 'set me'
API_KEY = 'set me'
# Set the server id that you wish to allow.
ipAddressId = 20636706
iscsiId = 8393467
# Set up your API client
client = SoftLayer.Client(
username=API_USERNAME,
api_key=API_KEY
)
try:
# The expected result after executing the script is: true
# To get valid Ip address, execute:
# https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[Storage_id]/getAllowableSubnets?objectMask=mask[id,networkIdentifier,cidr,subnetType,ipAddresses[id,ipAddress]]
result = client['SoftLayer_Network_Storage'].allowAccessFromIpAddress({"id":ipAddressId},id=iscsiId)
pp(result)
except SoftLayer.SoftLayerAPIError as e:
pp('Unable to allow the access to ISCSI faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
使用:SoftLayer_Network_Storage:: allowAccessFromVirtualGuest
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
API_USERNAME = 'set me'
API_KEY = 'set me'
# Set the server id that you wish to allow.
vsiId = 14388437
iscsiId = 8393467
# Set up your API client
client = SoftLayer.Client(
username=API_USERNAME,
api_key=API_KEY
)
try:
# The expected result after executing the script is: true
# To get valid Virtual Guest ids, execute:
# https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[storage_id]/getAllowableVirtualGuests?objectMask=mask[id,fullyQualifiedDomainName]
result = client['SoftLayer_Network_Storage'].allowAccessFromVirtualGuest({"id":vsiId},id=iscsiId)
pp(result)
except SoftLayer.SoftLayerAPIError as e:
pp('Unable to allow the access to ISCSI faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
使用:SoftLayer_Virtual_Guest::allowAccessToNetworkStorage
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
API_USERNAME = 'set me'
API_KEY = 'set me'
# Set the server id that you wish to allow.
serverId = 14388435
iscsiId = 8393467
# Set up your API client
client = SoftLayer.Client(
username=API_USERNAME,
api_key=API_KEY
)
try:
# The expected result after executing the script is: true
result = client['SoftLayer_Virtual_Guest'].allowAccessToNetworkStorage({"id":iscsiId},id=serverId)
pp(result)
except SoftLayer.SoftLayerAPIError as e:
pp('Unable to allow the access to ISCSI faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
参考文献:
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/allowAccessFromVirtualGuest http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/allowAccessFromHardware http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/allowAccessToNetworkStorage
https://github.com/softlayer/softlayer-python
编辑
我使用“Endurance Replica”重现了同样的问题。 这是授权虚拟访客的 python 示例:
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
API_USERNAME = 'set me'
API_KEY = 'set me'
# Set the server id that you wish to allow.
vsiId = 15571333
storageId = 6550721
objectType = "SoftLayer_Virtual_Guest"
# Set up your API client
client = SoftLayer.Client(
username=API_USERNAME,
api_key=API_KEY
)
try:
# To get valid Virtual Guest ids, execute:
# https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[storage_id]/getAllowableVirtualGuests?objectMask=mask[id,fullyQualifiedDomainName]
result = client['SoftLayer_Network_Storage'].allowAccessFromHostList([{"id":vsiId,"objectType": objectType}],id=storageId)
pp(result)
except SoftLayer.SoftLayerAPIError as e:
pp('Unable to allow the access to network Storage faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
如果要授权“虚拟访客”、“IpAddress”或“硬件”,“objectType”的有效值为:
“SoftLayer_Virtual_Guest”,“SoftLayer_Network_Subnet_IpAddress”,“SoftLayer_Hardware” 分别。
参考:
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/allowAccessFromHostList
此致。