doc-exports/docs/evs/dev/evs_03_0003.html
Zaoxu, Li 256e58e5d1 evs_dev_update
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Zaoxu, Li <lizaoxu@huawei.com>
Co-committed-by: Zaoxu, Li <lizaoxu@huawei.com>
2023-01-12 13:53:19 +00:00

282 lines
15 KiB
HTML

<a name="evs_03_0003"></a><a name="evs_03_0003"></a>
<h1 class="topictitle1">Creating EVS Disks</h1>
<div id="body1540263637627"><div class="section" id="evs_03_0003__section1063418559011"><h4 class="sectiontitle">Scenarios</h4><p id="evs_03_0003__p18162581911">This API is used to create one or multiple EVS disks.</p>
</div>
<div class="section" id="evs_03_0003__section5904633132518"><h4 class="sectiontitle">Constraints</h4><p id="evs_03_0003__p1490863310255">None</p>
</div>
<div class="section" id="evs_03_0003__section1531361811311"><h4 class="sectiontitle">Involved APIs</h4><p id="evs_03_0003__p07558226415">Query the AZs before you create EVS disks.</p>
<p id="evs_03_0003__p1736118331147">If you need to create system disks, query the image information and obtain the image ID.</p>
<p id="evs_03_0003__p33281854345">If you need to create the disk from a data source, for example a snapshot or backup, query the snapshot or backup information and obtain the snapshot ID or backup ID.</p>
<p id="evs_03_0003__p119901522142815">Obtain the required information and then create the disk.</p>
<p id="evs_03_0003__p73251180314">To meet the preceding requirements, call the following APIs:</p>
</div>
<ul id="evs_03_0003__ul1325151816318"><li id="evs_03_0003__li183251318838">Query AZs.</li><li id="evs_03_0003__li03259181319">Query images.</li><li id="evs_03_0003__li1432516181535">Query EVS snapshots.</li><li id="evs_03_0003__li332520181138">Query backups.</li><li id="evs_03_0003__li113257181433">Create EVS disks.</li></ul>
<div class="section" id="evs_03_0003__section12146183181218"><h4 class="sectiontitle">Procedure</h4><ol id="evs_03_0003__ol1369483117124"><li id="evs_03_0003__li12694183118120">Query the AZs.<ul id="evs_03_0003__ul1369433111128"><li id="evs_03_0003__li1694193118128">API information<p id="evs_03_0003__p1820021955218"><a name="evs_03_0003__li1694193118128"></a><a name="li1694193118128"></a>URI format: GET /v3/{project_id}/os-availability-zone</p>
<p id="evs_03_0003__p198311845115216">For details, see <strong id="evs_03_0003__b842352706152759">OpenStack Cinder API v3</strong> &gt; <strong id="evs_03_0003__b84235270615289">EVS Disk</strong> &gt; <strong id="evs_03_0003__b842352706152816">Querying Information About All AZs</strong> in the <em id="evs_03_0003__i1487883413152843">Elastic Volume Service API Reference</em>.</p>
</li><li id="evs_03_0003__li1069613116123">Example request<p id="evs_03_0003__p58923181017"><a name="evs_03_0003__li1069613116123"></a><a name="li1069613116123"></a>GET /v3/9c53a566cb3443ab910cf0daebca90c4/os-availability-zone</p>
</li><li id="evs_03_0003__li1869753117123">Example response<pre class="screen" id="evs_03_0003__screen10478246378"> {
"availabilityZoneInfo": [
{
"zoneState": {
"available": true
},
"zoneName": "az1.dc1"
},
{
"zoneState": {
"available": true
},
"zoneName": "vmware.az1"
}
]
}</pre>
</li></ul>
</li><li id="evs_03_0003__li19697123181213">(Optional) Query the images if system disks are going to be created.<ul id="evs_03_0003__ul1697133121218"><li id="evs_03_0003__li196971131201216">API information<p id="evs_03_0003__p12697631121216"><a name="evs_03_0003__li196971131201216"></a><a name="li196971131201216"></a>URI format: GET /v2/images</p>
<p id="evs_03_0003__p169241717205611">For details, see <strong id="evs_03_0003__b842352706153325">API</strong> &gt; <strong id="evs_03_0003__b842352706153331">Image (Native OpenStack APIs)</strong> &gt; <strong id="evs_03_0003__b842352706153339">Querying Images (Native OpenStack API)</strong> in the <em id="evs_03_0003__i99241031112117">Image Management Service API Reference</em>.</p>
</li><li id="evs_03_0003__li1769713151210">Example request<p id="evs_03_0003__p669810312127"><a name="evs_03_0003__li1769713151210"></a><a name="li1769713151210"></a>GET /v2/images</p>
</li><li id="evs_03_0003__li5698231101215">Example response<pre class="screen" id="evs_03_0003__screen3674179172317">{
"images": [
{
"status": "queued",
"name": "test",
"tags": [
"test",
"image"
],
"container_format": "bare",
"created_at": "2014-12-16T01:22:05Z",
"disk_format": "qcow2",
"updated_at": "2014-12-16T01:22:05Z",
"visibility": "private",
"self": "/v2/images/4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba90",
"min_disk": 1,
"protected": false,
"id": "4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba90",
"file": "/v2/images/4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba90/file",
"owner": "aed2c611711548a4a9c16fb8fe166af4",
"min_ram": 1024,
"schema": "/v2/schemas/image"
},
{
"status": "active",
"name": "cirros",
"tags": [
"new"
],
"container_format": "bare",
"created_at": "2014-12-11T03:53:43Z",
"size": 13147648,
"disk_format": "qcow2",
"updated_at": "2014-12-15T20:02:12Z",
"visibility": "private",
"self": "/v2/images/5155a22a-834e-4ffe-a95d-ed9665a8ed76",
"min_disk": 0,
"protected": false,
"id": "5155a22a-834e-4ffe-a95d-ed9665a8ed76",
"file": "/v2/images/5155a22a-834e-4ffe-a95d-ed9665a8ed76/file",
"checksum": "d972013792949d0d3ba628fbe8685bce",
"owner": "aed2c611711548a4a9c16fb8fe166af4",
"min_ram": 0,
"schema": "/v2/schemas/image"
}
],
"schema": "/v2/schemas/images",
"first": "/v2/images"
}</pre>
</li></ul>
</li><li id="evs_03_0003__li4698123120123">(Optional) Query the EVS snapshots if the disk is going to be created from a snapshot.<ul id="evs_03_0003__ul16698113113122"><li id="evs_03_0003__li106981731201217">API information<p id="evs_03_0003__p2553155365818"><a name="evs_03_0003__li106981731201217"></a><a name="li106981731201217"></a>URI format: GET /v3/{project_id}/snapshots</p>
<p id="evs_03_0003__p1959141718596">For details, see <strong id="evs_03_0003__b842352706154153">OpenStack Cinder API v3</strong> &gt; <strong id="evs_03_0003__b84235270615422">EVS Snapshot</strong> &gt; <strong id="evs_03_0003__b842352706154211">Querying EVS Snapshots</strong> in the <em id="evs_03_0003__i886446318154217">Elastic Volume Service API Reference</em>.</p>
</li><li id="evs_03_0003__li1369823191213">Example request<p id="evs_03_0003__p20160141711012"><a name="evs_03_0003__li1369823191213"></a><a name="li1369823191213"></a>GET /v3/9c53a566cb3443ab910cf0daebca90c4/snapshots</p>
</li><li id="evs_03_0003__li196981531101214">Example response<pre class="screen" id="evs_03_0003__screen965810446386">{
"snapshots": [
{
"created_at": "2016-02-16T16:54:14.981520",
"description": null,
"id": "b836dc3d-4e10-4ea4-a34c-8f6b0460a583",
"metadata": { },
"name": "test01",
"size": 1,
"status": "available",
"volume_id": "ba5730ea-8621-4ae8-b702-ff0ffc12c209",
"updated_at": null
},
{
"created_at": "2016-02-16T16:54:19.475397",
"description": null,
"id": "83be494d-329e-4a78-8ac5-9af900f48b95",
"metadata": { },
"name": "test02",
"size": 1,
"status": "available",
"volume_id": "ba5730ea-8621-4ae8-b702-ff0ffc12c209",
"updated_at": null
},
{
"created_at": "2016-02-16T16:54:24.367414",
"description": null,
"id": "dd360f46-7593-4d35-8f2c-5566fd0bd79e",
"metadata": { },
"name": "test03",
"size": 1,
"status": "available",
"volume_id": "ba5730ea-8621-4ae8-b702-ff0ffc12c209",
"updated_at": null
},
{
"created_at": "2016-02-16T16:54:29.766740",
"description": null,
"id": "4c29796a-8cf4-4482-9afc-e66da9a81240",
"metadata": { },
"name": "test04",
"size": 1,
"status": "available",
"volume_id": "ba5730ea-8621-4ae8-b702-ff0ffc12c209",
"updated_at": null
}
],
"snapshots_links": null
}</pre>
</li></ul>
</li><li id="evs_03_0003__li1670018311126">(Optional) Query the backups if the disk is going to be created from a backup.<ul id="evs_03_0003__ul11700131101211"><li id="evs_03_0003__li47008311125">API information<p id="evs_03_0003__p77001631131215"><a name="evs_03_0003__li47008311125"></a><a name="li47008311125"></a>URI format: GET /v3/{project_id}/backups</p>
<p id="evs_03_0003__p72226225614">For details, see <strong id="evs_03_0003__b8918143110510">CBR APIs</strong> &gt; <strong id="evs_03_0003__b1998919341158">Backups</strong> &gt; <strong id="evs_03_0003__b426418425515">Querying All Backups</strong> in the <em id="evs_03_0003__i75442718514">Cloud Backup and Recovery API Reference</em>.</p>
</li><li id="evs_03_0003__li670013161215">Example request<p id="evs_03_0003__p270111313122"><a name="evs_03_0003__li670013161215"></a><a name="li670013161215"></a>GET /v3/{project_id}/backups</p>
</li><li id="evs_03_0003__li670114318124">Example response<pre class="screen" id="evs_03_0003__screen199001017183117">{
"count" : 2,
"backups" : [ {
"provider_id" : "0daac4c5-6707-4851-97ba-169e36266b66",
"checkpoint_id" : "1fced58b-2a31-4851-bcbb-96216f83ce99",
"updated_at" : "2020-02-21T07:07:25.113761",
"vault_id" : "cca85ea5-00a4-418d-9222-bd83985bc515",
"id" : "b1c4afd9-e7a6-4888-9010-c2bac3aa7910",
"resource_az" : "br-iaas-odin1a",
"image_type" : "backup",
"resource_id" : "1a503932-ee8f-4dd5-8248-8dfb57e584c5",
"resource_size" : 40,
"children" : [ ],
"extend_info" : {
"auto_trigger" : true,
"supported_restore_mode" : "backup",
"contain_system_disk" : true,
"support_lld" : true,
"system_disk" : false
},
"project_id" : "0605767b5780d5762fc5c0118072a564",
"status" : "available",
"resource_name" : "test001-02",
"description" : "",
"expired_at" : "2020-05-21T07:00:54.060493",
"name" : "autobk_b629",
"created_at" : "2020-02-21T07:00:54.065135",
"resource_type" : "OS::Nova::Server"
}, {
"provider_id" : "d1603440-187d-4516-af25-121250c7cc97",
"checkpoint_id" : "f64c351f-769f-4c04-8806-fd90a59e9b12",
"updated_at" : "2020-02-21T07:09:37.767084",
"vault_id" : "79bd9daa-884f-4f84-b8fe-235d58cd927d",
"id" : "5606aab5-2dc2-4498-8144-dc848d099af5",
"resource_az" : "br-iaas-odin1a",
"image_type" : "backup",
"resource_id" : "54f7ccbc-072f-4ec5-a7b7-b24dabdb4539",
"resource_size" : 40,
"children" : [ ],
"extend_info" : {
"auto_trigger" : true,
"snapshot_id" : "e3def9a8-e4b4-4c12-b132-f4ba8ce9a34f",
"bootable" : true,
"support_lld" : true,
"encrypted" : false,
"system_disk" : false
},
"project_id" : "0605767b5780d5762fc5c0118072a564",
"status" : "available",
"resource_name" : "qsy_000",
"description" : "",
"expired_at" : "2020-03-22T07:00:34.877896",
"name" : "autobk_6809",
"created_at" : "2020-02-21T07:00:34.882174",
"resource_type" : "OS::Cinder::Volume"
} ]
}</pre>
</li></ul>
</li><li id="evs_03_0003__li18702153161213">Create EVS disks.<ul id="evs_03_0003__ul1270210314124"><li id="evs_03_0003__li2070293191210">API information<p id="evs_03_0003__p166717121481"><a name="evs_03_0003__li2070293191210"></a><a name="li2070293191210"></a>URI format: POST /v3/{project_id}/volumes</p>
<p id="evs_03_0003__p162772311989">For details, see <strong id="evs_03_0003__b842352706154740">OpenStack Cinder API v3</strong> &gt; <strong id="evs_03_0003__b842352706154751">EVS Disk</strong> &gt; <strong id="evs_03_0003__b842352706154758">Creating EVS Disks</strong> in the <em id="evs_03_0003__i6346153220216">Elastic Volume Service API Reference</em>.</p>
</li><li id="evs_03_0003__li197021531111216">Example request<p id="evs_03_0003__p115804351794"><a name="evs_03_0003__li197021531111216"></a><a name="li197021531111216"></a>POST /v3/9c53a566cb3443ab910cf0daebca90c4/volumes</p>
<pre class="screen" id="evs_03_0003__screen232742131213">{
"volume": {
"name": "openapi_vol01",
"imageRef": "027cf713-45a6-45f0-ac1b-0ccc57ac12e2",
"availability_zone": "xxx",
"description": "create for api test",
"volume_type": "SATA",
"metadata": {
"volume_owner": "openapi"
},
"consistencygroup_id": null,
"OS-SCH-HNT:scheduler_hints": {
"dedicated_storage_id": "eddc1a3e-4145-45be-98d7-bf6f65af9767"
},
"source_volid": null,
"snapshot_id": null,
"shareable": "false",
"multiattach": false,
"source_replica": null,
"size": 40
}
}</pre>
</li><li id="evs_03_0003__li3703173114126">Example response<pre class="screen" id="evs_03_0003__screen1749018346323">{
"volume": {
"attachments": [ ],
"availability_zone": "xxx",
"bootable": "false",
"consistencygroup_id": null,
"created_at": "2016-05-25T02:38:40.392463",
"description": "create for api test",
"encrypted": false,
"id": "8dd7c486-8e9f-49fe-bceb-26aa7e312b66",
"links": [
{
"href": "https://volume.localdomain.com:8776/v2/5dd0b0056f3d47b6ab4121667d35621a/volumes/8dd7c486-8e9f-49fe-bceb-26aa7e312b66",
"rel": "self"
},
{
"href": "https://volume.localdomain.com:8776/5dd0b0056f3d47b6ab4121667d35621a/volumes/8dd7c486-8e9f-49fe-bceb-26aa7e312b66",
"rel": "bookmark"
}
],
"metadata": {
"volume_owner": "openapi"
},
"name": "openapi_vol01",
"replication_status": "disabled",
"shareable": false,
"multiattach": false,
"size": 40,
"snapshot_id": null,
"source_volid": null,
"status": "creating",
"updated_at": null,
"user_id": "39f6696ae23740708d0f358a253c2637",
"volume_type": "SATA"
}
}</pre>
<div class="p" id="evs_03_0003__p0703163171217">or<pre class="screen" id="evs_03_0003__screen2699535114213">{
"error": {
"message": "XXXX",
"code": "XXX"
}
}</pre>
</div>
<div class="p" id="evs_03_0003__p370315317125">In the preceding example, <strong id="evs_03_0003__b842352706143959">error</strong> indicates a general error, for example, <strong id="evs_03_0003__b842352706144438">badRequest</strong> or <strong id="evs_03_0003__b842352706144454">itemNotFound</strong>. An example is provided as follows:<pre class="screen" id="evs_03_0003__screen5305191315435">{
"badRequest": {
"message": "XXXX",
"code": "XXX"
}
}</pre>
</div>
</li></ul>
</li></ol>
</div>
</div>