2016-11-17 27 views
0

我正在運行以下代碼。捕獲彈性圖像時出錯

` 
RestApiClient client = new RestApiClient(baseUrl).withCredentials(userName, apiKey); 
Account.Service service = Account.service(client); 
service.withMask().hardware(); 
service.withMask().hardware().fullyQualifiedDomainName(); 
service.withMask().hardware().id(); 
Account account = service.getObject(); 
String hwname="bmtest.domain.com"; 
Hardware hw1=null; 
for(Hardware h : account.getHardware()){ 
if(h.getFullyQualifiedDomainName().equalsIgnoreCase(hwname)) { 
     hw1 = h; } 
    } 
    Hardware.Service svc= Hardware.service(client); 
    svc=hw1.asService(client); 
    try{ Template template = new Template(); 
     template.setName(hw1.getFullyQualifiedDomainName()+"-HWImg-1"); 
    template.setDescription("Image of "+hw1.getFullyQualifiedDomainName()); 
    System.out.println("Starting Image capture"); 
    svc.captureImage(template);` 

但得到以下錯誤:

`Starting Image capture 
com.softlayer.api.ApiException$Internal: Failed to determine the version of the operating system running on bmtest3rhel6.domain.com via SSH. Please ensure that a firewall is not restricting access to port 22, that your SSH server's configuration allows root login, and that the root credentials we have on file are valid. You can verify and update these credentials in the <i>Software</i> section of <a href="/Hardware/view/385236">your server's page</a>.(code: SoftLayer_Exception_Public, status: 500) 
    at com.softlayer.api.ApiException.fromError(ApiException.java:16) 
    at com.softlayer.api.RestApiClient$ServiceProxy.logAndHandleResponse(RestApiClient.java:258) 
    at com.softlayer.api.RestApiClient$ServiceProxy.invokeService(RestApiClient.java:300) 
    at com.softlayer.api.RestApiClient$ServiceProxy.invoke(RestApiClient.java:466) 
    at com.sun.proxy.$Proxy7.captureImage(Unknown Source) 
    at com.ibm.adn.servlet.TestBMSuspend.test(TestBMSuspend.java:91) 
    at com.ibm.adn.servlet.TestBMSuspend.main(TestBMSuspend.java:103) 
` 

這種特殊baremetal啓動並運行。我可以使用root登錄它,也打開了22端口的ssh。 仍然有相同的錯誤重複。

裸機有RHEL 6.7,它在SL網站上提到,可以使用Flex圖像捕獲。

請讓我知道任何額外的事情,我應該做的這項工作。

回答

0

我審查了代碼,它工作正常。

您可以查看的一件事是檢查您是否使用可訪問硬件的用戶名和api密鑰。

檢查是否允許您在控制門戶中與您的用戶一起拍攝柔性圖像,如果可能,請使用相同的用戶憑據(即用戶名和api密鑰)運行腳本。

如果這些建議不起作用,我建議您在SoftLayer上打開一張票以獲得進一步的幫助。

+0

謝謝佩德羅。 我在裸機上嘗試了這種方法,它允許捕獲圖像通過軟層UI。而且我只能捕捉其中一臺服務器的圖像。其他人拋出了同樣的錯誤。 –

+0

我一直在研究這一點,並發現ADN帳戶不允許創建柔性圖像。 –