イメージテンプレートを作成するときに、イメージテンプレートに必要なブロックデバイスを指定することができます。これは、APIとポータルを使用して行うことができます。そこ
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getBlockDevices
:
これは、あなたがこのメソッドを呼び出すことができるため、API
"""
Create image template.
The script creates a standard image template, it makes
a call to the SoftLayer_Virtual_Guest::createArchiveTransaction method
sending the IDs of the disks in the request.
For more information please see below.
Important manual pages:
https://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest
https://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/createArchiveTransaction
https://sldn.softlayer.com/reference/datatypes/SoftLayer_Virtual_Guest_Block_Device
License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <[email protected]>
"""
import SoftLayer
# Your SoftLayer API username and key.
USERNAME = 'set me'
API_KEY = 'set me'
# The virtual guest ID you want to create a template
virtualGuestId = 4058502
# The name of the image template
groupName = 'my image name'
# An optional note for the image template
note = 'an optional note'
"""
Build a skeleton SoftLayer_Virtual_Guest_Block_Device object
containing the disks you want to the image.
In this case we are going take an image template of 2 disks
from the virtual machine.
"""
blockDevices = [
{
"id": 4667098,
"complexType": "SoftLayer_Virtual_Guest_Block_Device"
},
{
"id": 4667094,
"complexType": "SoftLayer_Virtual_Guest_Block_Device"
}
]
# Declare a new API service object
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
try:
# Creating the transaction for the image template
response = client['SoftLayer_Virtual_Guest'].createArchiveTransaction(groupName, blockDevices, note, id=virtualGuestId)
print(response)
except SoftLayer.SoftLayerAPIError as e:
"""
# If there was an error returned from the SoftLayer API then bomb out with the
# error message.
"""
print("Unable to create the image template. faultCode=%s, faultString=%s" % (e.faultCode, e.faultString))
あなたが唯一のブロックデバイスのID(またはディスク)を取得する必要があり
を使用した例であります
- ディスクタイプのブロックデバイスのみをキャプチャできます。
- スワップタイプのブロックデバイスは、キャプチャするブロックデバイスのリストに含めることはできません(これはディスク番号1です)。
- OSを含むブロックデバイスを含める必要があります(これはディスク番号0です)。
- メタデータを含むブロックデバイスをイメージに含めることはできません。
あなたはこれを覚えておく必要がある。この画像のテンプレートを使用して新しいデバイスをordeningている:あなたは、あなたがのために価格を追加していることを確認する必要がありplaceOrderメソッドを使用している場合
- を余分なディスク。
- createObjectメソッドを使用している場合、ディスクの数はイメージテンプレートから取得されるため、余分なディスクを指定する必要はありません。
また、リロードでイメージテンプレートを使用することもできますが、リロードはOSを含むディスクにしか適用されません。したがって、3台のディスクを持ち、再ロードを実行するVitrualマシンを使用している場合、イメージテンプレートに3台のディスクがあっても、OSを含むディスクのみが感染します。
ディスク容量不足やその他の問題によりエラーが発生した場合、プロビジョニング時にエラーが発生し、VSIはプロビジョニングされません。チケットが開かれ、そのことについて。
よろしく
Q2のためのコメント:私はリロードするVMは、ディスク2(またはディスク2を持っていますが、ディスク容量は、画像のディスク2未満である)されていない場合は、と私はイメージ(システムをインストールするには、強制ディスク+ディスク2)それに、何が起こるのでしょうか? – lippman