KDDIクラウドプラットフォームサービス ナレッジサイト

  • HOME
  • 提供API一覧
  • createVolume

createVolume

処理概要

ボリュームの作成。作成方法は2通り。

  1. 空のボリュームの作成
  2. スナップショットからのボリューム作成

 

注意事項

・それぞれの作成方法でリクエストパラメータが異なります。(リクエスト欄をご確認ください。)
・「diskofferingid」は、「listDiskofferings」のAPI応答結果から、「FAST_STORAGE」、「MIDDLE_STORAGE」のいずれかのidを指定してください。
・「name」は必須事項ですが、未記入や半角スペースの場合にはボリューム名なしで作成されますのでご注意ください。

 

リクエスト

  • リクエストパラメータ

(1)空のボリュームを作成する場合

Parameter Name Description Required
name the name of the disk volume true
size Arbitrary volume size (10GB単位、10-2000)の範囲 true
diskofferingid

the ID of the disk offering. Either diskOfferingId or snapshotId must be passed in.

「FAST_STORAGE」、「MIDDLE_STORAGE」のいずれかのid

true
zoneid the ID of the availability zone true

 

(2)スナップショットからボリュームを作成する場合

Parameter Name Description Required
name the name of the disk volume true
snapshotid the snapshot ID for the disk volume. Either diskOfferingId or snapshotId must be passed in. true

 

  • リクエストサンプル

(1)空のボリュームを作成する場合

$ ./kick_api.sh command=createVolume name=testVolume size=20 diskofferingid=f9729993-01a7-4f5f-b195-d2d62cd8c50b zoneid=f4c460fd-06d9-44db-a54d-7a23b54d9133

 

(2)スナップショットからボリュームを作成する場合

$ ./kick_api.sh command=createVolume name=testVolumeFromSnapshot snapshotid=8e32c98c-df38-46bd-b622-567df535e66e

 

レスポンス

  • レスポンスボディ

(1)空のボリュームを作成する場合

Response Name Description
id ID of the disk volume
jobid the ID of the latest async job acting on this object

 

(2)スナップショットからボリュームを作成する場合

Response Name Description
id ID of the disk volume
jobid the ID of the latest async job acting on this object
 
 
  • レスポンスサンプル

(1)空のボリュームを作成する場合

【API実行結果】
<?xml version=”1.0″ encoding=”UTF-8″?>
<createvolumeresponse cloud-stack-version=”4.3.0.2″>
<id>bb2c6610-47c2-4bdf-b352-3f3792e66b23</id>
<jobid>901673a9-3c0c-4feb-ac50-6d58b2f2a34b</jobid>
</createvolumeresponse>

 

(参考)API応答のjobidより、そのjobの状況/結果を確認するためには、「queryAsyncJobResult」のAPIにて確認してください。

【queryAsyncJobResultでの確認結果】
$ ./kick_api.sh command=queryAsyncJobResult jobid=901673a9-3c0c-4feb-ac50-6d58b2f2a34b
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
104 1360 104 1360 0 0 11441 0 –:–:– –:–:– –:–:– 46896
<?xml version=”1.0″ encoding=”UTF-8″?>
<queryasyncjobresultresponse cloud-stack-version=”4.3.0.2″>
<accountid>xxxxxxxx-24dc-4194-ac5f-2d78d5e38039</accountid>
<userid>xxxxxxxx-0529-4250-9e3e-bcb03c114002</userid>
<cmd>org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd</cmd>
<jobstatus>1</jobstatus>
<jobprocstatus>0</jobprocstatus>
<jobresultcode>0</jobresultcode>
<jobresulttype>object</jobresulttype>
<jobresult>
<volume>
<id>bb2c6610-47c2-4bdf-b352-3f3792e66b23</id>
<name>testVolume</name>
<zoneid>f4c460fd-06d9-44db-a54d-7a23b54d9133</zoneid>
<zonename>jp2-east01</zonename>
<type>DATADISK</type>
<size>21474836480</size>
<created>2017-03-06T13:42:59+0900</created>
<state>Allocated</state>
<account>testacount</account>
<domainid>xxxxxxxx-0279-45f0-842a-d768c4ed0d47</domainid>
<domain>MXXXXXXXX</domain>
<storagetype>shared</storagetype>
<diskofferingid>f9729993-01a7-4f5f-b195-d2d62cd8c50b</diskofferingid>
<diskofferingname>FAST_STORAGE</diskofferingname>
<diskofferingdisplaytext>FAST_STORAGE</diskofferingdisplaytext>
<destroyed>false</destroyed>
<isextractable>true</isextractable>
<displayvolume>true</displayvolume>
<quiescevm>false</quiescevm>
<jobid>901673a9-3c0c-4feb-ac50-6d58b2f2a34b</jobid>
<jobstatus>0</jobstatus>
</volume>
</jobresult>
<created>2017-03-06T13:42:59+0900</created>
<jobid>901673a9-3c0c-4feb-ac50-6d58b2f2a34b</jobid>
</queryasyncjobresultresponse>

 

 

(2)スナップショットからボリュームを作成する場合

【API実行結果】
<?xml version=”1.0″ encoding=”UTF-8″?>
<createvolumeresponse cloud-stack-version=”4.3.0.2″>
<id>9fb0bea1-640a-4cc8-8de4-b9174290ade6</id>
<jobid>2331573b-943e-40cc-b015-aaba941edac9</jobid>
</createvolumeresponse>

 

(参考)API応答のjobidより、そのjobの状況/結果を確認するためには、「queryAsyncJobResult」のAPIにて確認してください。

【queryAsyncJobResultでの確認結果】
$ ./kick_api.sh command=queryAsyncJobResult jobid=2331573b-943e-40cc-b015-aaba941edac9
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
102 1429 102 1429 0 0 12495 0 –:–:– –:–:– –:–:– 59541
<?xml version=”1.0″ encoding=”UTF-8″?>
<queryasyncjobresultresponse cloud-stack-version=”4.3.0.2″>
<accountid>xxxxxxxx-24dc-4194-ac5f-2d78d5e38039</accountid>
<userid>xxxxxxxx-0529-4250-9e3e-bcb03c114002</userid>
<cmd>org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd</cmd>
<jobstatus>1</jobstatus>
<jobprocstatus>0</jobprocstatus>
<jobresultcode>0</jobresultcode>
<jobresulttype>object</jobresulttype>
<jobresult>
<volume>
<id>9fb0bea1-640a-4cc8-8de4-b9174290ade6</id>
<name>testVolumeFromSnapshot</name>
<zoneid>f4c460fd-06d9-44db-a54d-7a23b54d9133</zoneid>
<zonename>jp2-east01</zonename>
<type>DATADISK</type>
<size>10737418240</size>
<created>2017-03-06T13:44:32+0900</created>
<state>Ready</state>
<account>testaccount</account>
<domainid>xxxxxxxxx-0279-45f0-842a-d768c4ed0d47</domainid>
<domain>MXXXXXXXX</domain>
<storagetype>shared</storagetype>
<diskofferingid>f9729993-01a7-4f5f-b195-d2d62cd8c50b</diskofferingid>
<diskofferingname>FAST_STORAGE</diskofferingname>
<diskofferingdisplaytext>FAST_STORAGE</diskofferingdisplaytext>
<snapshotid>8e32c98c-df38-46bd-b622-567df535e66e</snapshotid>
<destroyed>false</destroyed>
<isextractable>true</isextractable>
<displayvolume>true</displayvolume>
<quiescevm>false</quiescevm>
<jobid>2331573b-943e-40cc-b015-aaba941edac9</jobid>
<jobstatus>0</jobstatus>
</volume>
</jobresult>
<created>2017-03-06T13:44:32+0900</created>
<jobid>2331573b-943e-40cc-b015-aaba941edac9</jobid>
</queryasyncjobresultresponse>

提供API一覧

2024/04/23 2024/04/23