2016-11-30 69 views
0

我在Softlayer中調配Windows Server 2012 Standard Edition (64 bit)'Windows Server 2012 Datacenter Edition (64bit)。根據我的項目要求,連接到Windows服務器(包括SAN和Local)的額外磁盤應該格式化。爲此我必須開發chef cookbook這將格式化額外的磁盤。我怎樣才能做到這一點 ?我可以參考的任何文件?在windows虛擬服務器中格式化磁盤-Softlayer

回答

0

任何「我如何與廚師做X?」的答案總是一樣,沒有廚師你會怎麼做X?然後去寫一些代碼。在這種情況下,請查看如何從SAN安裝磁盤,以及如何從命令行格式化Windows磁盤。所有你應該能夠很容易地寫你的食譜。

+0

謝謝:)會嘗試格式化從PowerShell中的額外的磁盤,然後將這些命令中轉化爲廚師配方 –

0

您嘗試格式化的其他磁盤可以通過運行安裝後腳本來完成。 使用SL API的虛擬來賓是:(REST示例)

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/createObject 
    Method: POST 
    Body: 
    { 
     "parameters": [ 
     { 
     "hostname": "myInstanceName", 
     "domain": "example.com", 
     "maxMemory": 4096, 
     "startCpus": 1, 
     "blockDevices": [ 
      { 
      "device": "0", 
      "diskImage": { 
       "capacity": 100 
      } 
      }, 
      { 
      "device": "2", 
      "diskImage": { 
       "capacity": 25 
      } 
      } 
     ], 
     "localDiskFlag": true 
     "hourlyBillingFlag": true, 
     "localDiskFlag": false, 
     "operatingSystemReferenceCode": "UBUNTU_LATEST", 
     "datacenter": { 
      "name": "dal05" 
     }, 
     "postInstallScriptUri": "https://www.softlayer.com" 
     } 
    ] 
    } 

注意身體要求的得到了postInstallScriptUri屬性,它負責提供自定義的腳本。 您也可以查看此方法,這些方法會幫助你管理這個帖子安裝腳本: http://sldn.softlayer.com/reference/services/SoftLayer_Account/getPostProvisioningHooks http://sldn.softlayer.com/reference/services/SoftLayer_Provisioning_Hook

這是刀廚師的命令行創建額外的磁盤和postInstallScript服務器。

knife softlayer server create -H test -D example.com \ --block-storage 0:25,2:100,5:1000 \ # device:GB, device:GB, ... 
--network-interface-speed 1000 \ 
--cores 8 \ 
--ram 49152 \ 
--os-code REDHAT_6_64 \ 
--datacenter ams01 \ 
--bootstrap-url http://www.softlayer.com/myscript 
--node-name random-node-name 

查看這些鏈接,它們是一個非常好的信息來源,並帶有示例。 https://sldn.softlayer.com/blog/jarteche/Getting-Started-User-Data-and-Post-Provisioning-Scripts http://bodenr.blogspot.com/2014/04/giving-your-softlayer-servers.html

最後,你可以試試這個SoftLayer的刀: https://sldn.softlayer.com/blog/matteldridge/Do-More-Less-SoftLayer-Knife-Chef

+0

感謝很多:) –

+0

根據項目要求,我將不得不使用廚師來格式化磁盤。如上所述,我們正在創建服務器並運行預配置腳本(安裝廚師和其他許多事物)。所以我想我必須編寫強大的shell腳本來格式化額外的磁盤並將其轉​​換爲廚師食譜 –

相關問題