2016-09-07 35 views
0

當我撥打SoftLayer_Virtual_Guest_Block_Device_Template_Group:addLocations複製私人圖片_A交叉IDC時,此功能立即返回True。所以我們知道這個操作是異步的。softlayer api:如何在複製os映像與IDC交叉時獲取狀態(完成或處理)?

問題是我怎麼能知道這個異步操作完成了,即image_A已經完成複製到目標IDC

我已經找到了API:

SoftLayer_Virtual_Guest_Block_Device_Template_Group:getTransaction(),但是這一次總是返回一個空的海峽??什麼是地獄~~~

+0

對image_A的操作相同,此時我調用removeLocations()來刪除idc_x(已存在的idc),結果是一個異常:Traceback(最近一次調用最後一個): SoftLayer.exceptions.SoftLayerAPIError:SoftLayerAPIError SoftLayer_Exception_Virtual_Guest_Block_Device_Template_Group_ActiveTransactionExists):此圖像模板目前有一項未完成的交易。但是,SoftLayer_Virtual_Guest_Block_Device_Template_Group:getTransaction()總是返回一個空str。 – lippman

+0

我如何獲得當前未完成的交易狀態? – lippman

回答

0

你需要做以下電話

https://$user:[email protected]/rest/v3.1/SoftLayer_Virtual_Guest_Block_Device_Template_Group/$templateGroupId/getChildren?objectMask=mask[transaction] 

Method: Get 

替換:$用戶,$ apiKey$ templateGroupId

您需要驗證子項(圖像模板組的克隆的圖像模板組)沒有任何掛起或當前事務。如果有一個或多個交易,您將無法添加/刪除位置,直到完成。

+0

謝謝。完美答案。其他相關問題:當​​我觸發圖像複製交叉IDC時,孩子必須處於未決或當前事務中。在此期間,我發現我無法在圖像模板詳細信息的網頁中使用此圖像創建vm,直到交易完成。 – lippman

+0

我認爲這個操作隻影響在idc D中創建虛擬機,不是A,對吧?但事實是,idc A,B,C這次也無法創建vm。 – lippman

+0

問題2:SoftLayer_Virtual_Guest_Block_Device_Template_Group:getT ransaction()和SoftLayer_Virtual_Guest_Block_Device_Template_Group:getChild(mask =('transaction'))有什麼區別?這是否意味着我需要調用這兩個API來確認這個圖像是在交易中? – lippman

相關問題