2016-09-06 28 views
0

我想知道如何使用Softlayer API來收集和命名手動快照使用Softlayer_Network_storage service如何通過Softlayer命名手動快照Python Lib

當使用「getManualSnapshots」查看我爲手動快照設置的名稱時,使用什麼掩碼並不清楚。

example of named snapshot

目前,我的面具是如下

mask='mask[serviceResource[serviceResourceName]]' 

但是這僅僅是屈服的錯誤。除此之外,我不確定還有什麼可以用來獲取名稱。

我想出了什麼對象ID包含名稱,我想我會使用「editObject」屬性來編輯快照名稱,這是否是正確的?

回答

0

你只需要拿到筆記,

mask=mask[notes] 

,並添加姓名只需編輯對象和替換的說明,您需要使用此方法http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/editObject

編輯對象:

import SoftLayer 
import json 
import sys 

USERNAME = 'set me' 
API_KEY = 'set me' 

client = SoftLayer.create_client_from_env(username=USERNAME, api_key=API_KEY) 
client['SoftLayer_Network_Storage'].editObject({"notes": "testing notes"},id=snapshot 
_id) 

Regards

+0

編輯對象似乎存在問題。 錯誤: 的faultcode = SOAP-ENV:服務器,faultString =內部錯誤 -----代碼: obj_template = { '筆記': '測試' } 嘗試: 快照= SL.instance (sl_config).storage_iscsi.editObject(obj_template,id = snapshot_id) – Recurrsion

+1

我能夠編輯它,我用代碼更新了我的答案 –

+0

有沒有辦法在創建時指定快照?也可以不使用editObject。可能有點像「snapshots = client ['SoftLayer_Network_Storage']。createSnapshot({」notes「:」testing notes「},id = iscsi_identifier)」我試過了,但是這個值「Array」被分配到了「notes」列 – Recurrsion