找回密码
 注册
查看: 3129|回复: 4

cinder volume卷 扩容 extend

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2021-5-25 01:00:08 | 显示全部楼层 |阅读模式
(cinder-api)[root@controller1 ~]# cinder list8 e+ A* A/ F$ y8 M1 Q- U
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
9 J6 |& L2 i% _: e  y| ID                                   | Status    | Name | Size | Volume Type | Bootable | Attached to                          |
0 Q# t8 Q" R( S! t  t! Z# w0 R; o+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
$ H" l% U" F. i8 q0 {; R  O| 40daf4bc-e035-451c-8482-bb95db59d5fb | available |      | 120  | -           | true     |                                      |/ L+ L, N7 k. b( H; ~
| 6937e5e2-0fcc-43b4-a3df-7f64231f82bc | in-use    |      | 60   | -           | true     | 5fc754bc-0c08-4364-8893-1ee686478293 |* C+ K- D% _8 q& j1 d
| 85a66c51-764e-45bb-819a-4bcd240cbcf8 | in-use    |      | 20   | -           | true     | 652e496f-0f4a-437b-b479-1c0d48c663e5 |
: F5 Q8 S8 Q7 e0 k, K! f| c5c208c1-12a1-44f1-990f-0d7d408fd13f | in-use    |      | 120  | -           | true     | 896f6657-650b-43d7-93f6-bfe76c6c6c30 |6 D' L7 q& Z$ u8 n  x4 {* b
| d7268039-1060-4450-a0d8-c4385c228170 | in-use    |      | 60   | -           | true     | 62bf6d23-754e-4b57-9b28-1085303c355c |& A8 ?) D" K+ L9 [% e
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+' l$ M  F& Z# Z* k2 N; [
(cinder-api)[root@controller1 ~]# cinder extend 85a66c51-764e-45bb-819a-4bcd240cbcf8 40( M2 g1 W0 E+ p3 T2 h
ERROR: Invalid volume: Volume 85a66c51-764e-45bb-819a-4bcd240cbcf8 status must be '{'status': 'available'}' to extend, currently in-use. (HTTP 400) (Request-ID: req-fa8c07fb-25ed-4411-9805-234e2d75fed8)
9 e) d7 F) f9 M0 i1 b4 p9 f# B3 C# [! W/ d' {
8 b- w9 t( f( V5 c
(cinder-api)[root@controller1 ~]#  cinder extend 40daf4bc-e035-451c-8482-bb95db59d5fb 1302 H/ q+ q  H' d% S
(cinder-api)[root@controller1 ~]# cinder list3 I& F6 e% F7 a
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+6 r+ l. x4 k5 A6 \5 R( z1 T- B  \. M
| ID                                   | Status    | Name | Size | Volume Type | Bootable | Attached to                          |
' d# \! I; {9 ?; u; _! U7 Q1 w+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+* d7 B$ p% U& k5 a. E
| 40daf4bc-e035-451c-8482-bb95db59d5fb | available |      | 130  | -           | true     |                                      |
6 I# j/ L: J4 v" J' s$ s| 6937e5e2-0fcc-43b4-a3df-7f64231f82bc | in-use    |      | 60   | -           | true     | 5fc754bc-0c08-4364-8893-1ee686478293 |
- y5 x, w$ _! U! i6 E| 85a66c51-764e-45bb-819a-4bcd240cbcf8 | in-use    |      | 20   | -           | true     | 652e496f-0f4a-437b-b479-1c0d48c663e5 |
7 P. x( x2 i  H) t  ]) K- c| c5c208c1-12a1-44f1-990f-0d7d408fd13f | in-use    |      | 120  | -           | true     | 896f6657-650b-43d7-93f6-bfe76c6c6c30 |# ?2 l' R( v; U+ u
| d7268039-1060-4450-a0d8-c4385c228170 | in-use    |      | 60   | -           | true     | 62bf6d23-754e-4b57-9b28-1085303c355c |
+ ^1 Q2 m# p. `0 I- N, P+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
8 v" e* |4 B6 X9 h" ?1 ?$ K" n; w

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2021-5-25 01:00:09 | 显示全部楼层
A volume is a detachable block storage device, similar to a USB hard drive. You can attach a volume to only one instance. Use the openstack client commands to create and manage volumes.
Create a volume
This example creates a my-new-volume volume based on an image.
  • List images, and note the ID of the image that you want to use for your volume:
    $ openstack image list+--------------------------------------+---------------------------------+| ID                                   | Name                            |+--------------------------------------+---------------------------------+| 8bf4dc2a-bf78-4dd1-aefa-f3347cf638c8 | cirros-0.3.5-x86_64-uec         || 9ff9bb2e-3a1d-4d98-acb5-b1d3225aca6c | cirros-0.3.5-x86_64-uec-kernel  || 4b227119-68a1-4b28-8505-f94c6ea4c6dc | cirros-0.3.5-x86_64-uec-ramdisk |+--------------------------------------+---------------------------------+
    8 Q; A$ ^7 H7 o! X) Y7 ~8 r! o- U+ l9 @; e. `; W2 }- y
  • List the availability zones, and note the ID of the availability zone in which you want to create your volume:
    $ openstack availability zone list+------+-----------+| Name |   Status  |+------+-----------+| nova | available |+------+-----------+
    3 x; L- @3 `  c6 o# H
    6 d8 s2 {1 L& k
  • Create a volume with 8 gibibytes (GiB) of space, and specify the availability zone and image:
    $ openstack volume create --image 8bf4dc2a-bf78-4dd1-aefa-f3347cf638c8 \  --size 8 --availability-zone nova my-new-volume+------------------------------+--------------------------------------+| Property                     | Value                                |+------------------------------+--------------------------------------+| attachments                  | []                                   || availability_zone            | nova                                 || bootable                     | false                                || consistencygroup_id          | None                                 || created_at                   | 2016-09-23T07:52:42.000000           || description                  | None                                 || encrypted                    | False                                || id                           | bab4b0e0-ce3d-4d57-bf57-3c51319f5202 || metadata                     | {}                                   || multiattach                  | False                                || name                         | my-new-volume                        || os-vol-tenant-attr:tenant_id | 3f670abbe9b34ca5b81db6e7b540b8d8     || replication_status           | disabled                             || size                         | 8                                    || snapshot_id                  | None                                 || source_volid                 | None                                 || status                       | creating                             || updated_at                   | None                                 || user_id                      | fe19e3a9f63f4a14bd4697789247bbc5     || volume_type                  | lvmdriver-1                          |+------------------------------+--------------------------------------+
    + l, G$ R( S1 D5 [% C( e) V7 }
    3 ]2 W- J9 s9 o7 v8 I7 y
  • To verify that your volume was created successfully, list the available volumes:
    $ openstack volume list+--------------------------------------+---------------+-----------+------+-------------+| ID                                   | DisplayName   |  Status   | Size | Attached to |+--------------------------------------+---------------+-----------+------+-------------+| bab4b0e0-ce3d-4d57-bf57-3c51319f5202 | my-new-volume | available | 8    |             |+--------------------------------------+---------------+-----------+------+-------------+
    ) O. y, J. e9 K+ Q% m6 v' W# i
    : V' }+ n$ _3 p, o1 }' s
    If your volume was created successfully, its status is available. If its status is error, you might have exceeded your quota.

    4 R# V) Q; v( ~7 n; ^: \, M
Volume Types
Cinder supports these three ways to specify volume type during volume creation.
  • volume_type
  • cinder_img_volume_type (via glance image metadata)
  • default_volume_type (via cinder.conf)
    : t6 a5 N5 n& G+ x) r9 n4 m
volume-type
User can specify volume type when creating a volume.
$ openstack volume create -h -f {json,shell,table,value,yaml}                         -c COLUMN --max-width <integer>                         --noindent --prefix PREFIX --size <size>                         --type <volume-type> --image <image>                         --snapshot <snapshot> --source <volume>                         --description <description> --user <user>                         --project <project>                         --availability-zone <availability-zone>                         --property <key=value>                         <name>; E" {! T: F4 G+ r1 T
$ K, [, ?2 k+ p% |1 v( G! y
  P2 y" H7 ~1 b' J
cinder_img_volume_type
If glance image has cinder_img_volume_type property, Cinder uses this parameter to specify volume type when creating a volume.
Choose glance image which has cinder_img_volume_type property and create a volume from the image.
$ openstack image list+----------------------------------+---------------------------------+--------+| ID                               | Name                            | Status |+----------------------------------+---------------------------------+--------+| 376bd633-c9c9-4c5d-a588-342f4f66 | cirros-0.3.5-x86_64-uec         | active || d086                             |                                 |        || 2c20fce7-2e68-45ee-ba8d-         | cirros-0.3.5-x86_64-uec-ramdisk | active || beba27a91ab5                     |                                 |        || a5752de4-9faf-4c47-acbc-         | cirros-0.3.5-x86_64-uec-kernel  | active || 78a5efa7cc6e                     |                                 |        |+----------------------------------+---------------------------------+--------+$ openstack image show 376bd633-c9c9-4c5d-a588-342f4f66d086+------------------------+------------------------------------------------------+| Field                  | Value                                                |+------------------------+------------------------------------------------------+| checksum               | eb9139e4942121f22bbc2afc0400b2a                      || cinder_img_volume_type | nfstype                                              || container_format       | ami                                                  || created_at             | 2016-10-13T03:28:55Z                                 || disk_format            | ami                                                  || file                   | /v2/images/376bd633-c9c9-4c5d-a588-342f4f66d086/file || id                     | 376bd633-c9c9-4c5d-a588-342f4f66d086                 || min_disk               | 0                                                    || min_ram                | 0                                                    || name                   | cirros-0.3.5-x86_64-uec                              || owner                  | 88ba456e3a884c318394737765e0ef4d                     || properties             | kernel_id='a5752de4-9faf-4c47-acbc-78a5efa7cc6e',    ||                        | ramdisk_id='2c20fce7-2e68-45ee-ba8d-beba27a91ab5'    || protected              | False                                                || schema                 | /v2/schemas/image                                    || size                   | 25165824                                             || status                 | active                                               || tags                   |                                                      || updated_at             | 2016-10-13T03:28:55Z                                 || virtual_size           | None                                                 || visibility             | public                                               |+------------------------+------------------------------------------------------+$ openstack volume create --image 376bd633-c9c9-4c5d-a588-342f4f66d086 \  --size 1 --availability-zone nova test+---------------------+--------------------------------------+| Field               | Value                                |+---------------------+--------------------------------------+| attachments         | []                                   || availability_zone   | nova                                 || bootable            | false                                || consistencygroup_id | None                                 || created_at          | 2016-10-13T06:29:53.688599           || description         | None                                 || encrypted           | False                                || id                  | e6e6a72d-cda7-442c-830f-f306ea6a03d5 || multiattach         | False                                || name                | test                                 || properties          |                                      || replication_status  | disabled                             || size                | 1                                    || snapshot_id         | None                                 || source_volid        | None                                 || status              | creating                             || type                | nfstype                              || updated_at          | None                                 || user_id             | 33fdc37314914796883706b33e587d51     |+---------------------+--------------------------------------+& z6 O- ^# }5 X; b6 J

& \9 X/ m! z% v7 q) d' T$ O" Z, h' D
default_volume_type
If above parameters are not set, Cinder uses default_volume_type which is defined in cinder.conf during volume creation.
Example cinder.conf file configuration.
[default]default_volume_type = lvmdriver-1
) G. Y; V4 ]$ K
# [7 f5 x& w4 z! p, j! n* F1 a
- b% G& R% J- o& V0 {7 W/ j) n  V7 i
( k. G3 f+ {; g

: N) P8 V- t$ c6 u7 k- B' b0 uAttach a volume to an instance
  • Attach your volume to a server, specifying the server ID and the volume ID:
    $ openstack server add volume 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 \  573e024d-5235-49ce-8332-be1576d323f8 --device /dev/vdb# f9 d- @; q* S+ F, ~
    % M, i- l- E! J: s: w, E& y: A
  • Show information for your volume:
    $ openstack volume show 573e024d-5235-49ce-8332-be1576d323f8+ N5 |+ E5 k' ^
    . L# }  y, k; C; M$ k# v4 W) Q
    The output shows that the volume is attached to the server with ID 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5, is in the nova availability zone, and is bootable.
    +------------------------------+-----------------------------------------------+| Field                        | Value                                         |+------------------------------+-----------------------------------------------+| attachments                  | [{u'device': u'/dev/vdb',                     ||                              |        u'server_id': u'84c6e57d-a             ||                              |           u'id': u'573e024d-...               ||                              |        u'volume_id': u'573e024d...            || availability_zone            | nova                                          || bootable                     | true                                          || consistencygroup_id          | None                                          || created_at                   | 2016-10-13T06:08:07.000000                    || description                  | None                                          || encrypted                    | False                                         || id                           | 573e024d-5235-49ce-8332-be1576d323f8          || multiattach                  | False                                         || name                         | my-new-volume                                 || properties                   |                                               || replication_status           | disabled                                      || size                         | 8                                             || snapshot_id                  | None                                          || source_volid                 | None                                          || status                       | in-use                                        || type                         | lvmdriver-1                                   || updated_at                   | 2016-10-13T06:08:11.000000                    || user_id                      | 33fdc37314914796883706b33e587d51              |+------------------------------+-----------------------------------------------+
    , Q/ C8 Z' u0 z1 M1 N4 }0 A0 I& o5 z7 r% h5 i4 ~0 X3 p8 o/ n( z

    + {  i: k6 w8 z5 ~

8 y$ n$ n' t: m) a1 n0 [- k) n8 y7 [Detach a volume from an instance
  • Detach your volume from a server, specifying the server ID and the volume ID:
    $ openstack server remove volume 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 \  573e024d-5235-49ce-8332-be1576d323f8; {* ^$ Q* S7 D" g- Y; s4 M$ h
    ( |: {. r: K) }  G# Z8 i% ?7 V
  • Show information for your volume:
    $ openstack volume show 573e024d-5235-49ce-8332-be1576d323f8
    ! A0 ?9 Z/ r0 q( ?6 m; U3 H) {  E; s) T  d% Z9 d  y8 l; c
    The output shows that the volume is no longer attached to the server:
    +------------------------------+-----------------------------------------------+| Field                        | Value                                         |+------------------------------+-----------------------------------------------+| attachments                  | []                                            || availability_zone            | nova                                          || bootable                     | true                                          || consistencygroup_id          | None                                          || created_at                   | 2016-10-13T06:08:07.000000                    || description                  | None                                          || encrypted                    | False                                         || id                           | 573e024d-5235-49ce-8332-be1576d323f8          || multiattach                  | False                                         || name                         | my-new-volume                                 || properties                   |                                               || replication_status           | disabled                                      || size                         | 8                                             || snapshot_id                  | None                                          || source_volid                 | None                                          || status                       | in-use                                        || type                         | lvmdriver-1                                   || updated_at                   | 2016-10-13T06:08:11.000000                    || user_id                      | 33fdc37314914796883706b33e587d51              |+------------------------------+-----------------------------------------------+
    5 L+ ^" k( a2 k. N
    $ w( Q/ A! {1 ~7 l8 u7 F5 M- v: ]. x( @  Z8 l2 ?1 e7 a; i5 E
, Z) X' S) x9 h! F
Delete a volume
  • To delete your volume, you must first detach it from the server. To detach the volume from your server and check for the list of existing volumes, see steps 1 and 2 in Resize_a_volume.
    Delete the volume using either the volume name or ID:
    $ openstack volume delete my-new-volume
    7 B3 \% J" M; p3 F
    , j1 G& l0 w: a% r: w2 ]$ E
    This command does not provide any output.
  • List the volumes again, and note that the status of your volume is deleting:
    $ openstack volume list+----------------+-----------------+-----------+------+-------------+|       ID       |   Display Name  |  Status   | Size | Attached to |+----------------+-----------------+-----------+------+-------------+| 573e024d-52... |  my-new-volume  |  deleting |  8   |             || bd7cf584-45... | my-bootable-vol | available |  8   |             |+----------------+-----------------+-----------+------+-------------+$ [+ a1 M4 k- H3 ]; ^* K
    : N  j. X# u! l
    When the volume is fully deleted, it disappears from the list of volumes:
    $ openstack volume list+----------------+-----------------+-----------+------+-------------+|       ID       |   Display Name  |  Status   | Size | Attached to |+----------------+-----------------+-----------+------+-------------+| bd7cf584-45... | my-bootable-vol | available |  8   |             |+----------------+-----------------+-----------+------+-------------+
    8 |' B3 r; K7 s, _4 \& J1 s
    ( T, D! B9 W% ?) O6 B! H8 ?$ }" D% j+ v2 u

  ?: v7 B4 f8 |1 {+ I! IResize a volume
  • To resize your volume, you must first detach it from the server. To detach the volume from your server, pass the server ID and volume ID to the following command:
    $ openstack server remove volume 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 573e024d-5235-49ce-8332-be1576d323f8- j* {# A# k1 ]8 [; G4 M1 @4 o
    4 L$ p2 o: ]4 C
    This command does not provide any output.
  • List volumes:
    $ openstack volume list+----------------+-----------------+-----------+------+-------------+|       ID       |   Display Name  |  Status   | Size | Attached to |+----------------+-----------------+-----------+------+-------------+| 573e024d-52... |  my-new-volume  | available |  8   |             || bd7cf584-45... | my-bootable-vol | available |  8   |             |+----------------+-----------------+-----------+------+-------------++ v- y/ m: n4 `) B; ]/ Q
    - F- g( L2 p! k* G  l/ U
    Note that the volume is now available.
  • Resize the volume by passing the volume ID and the new size (a value greater than the old one) as parameters:
    $ openstack volume set 573e024d-5235-49ce-8332-be1576d323f8 --size 10
    " Q3 P. o. O! E6 I
    - j3 I5 [5 ^9 T6 h7 m
    This command does not provide any output.
    5 j3 B2 {- t) b! O
    Note: X5 n. r7 Y( I# a: }# U
    When extending an LVM volume with a snapshot, the volume will be deactivated. The reactivation is automatic unless auto_activation_volume_list is defined in lvm.conf. See lvm.conf for more information.
    " w1 _# [0 t" A7 V" ?

    % ?0 g; i3 Y) u, X

$ n" _  l1 _( b- t- EMigrate a volume
As an administrator, you can migrate a volume with its data from one location to another in a manner that is transparent to users and workloads. You can migrate only detached volumes with no snapshots.
Possible use cases for data migration include:
  • Bring down a physical storage device for maintenance without disrupting workloads.
  • Modify the properties of a volume.
  • Free up space in a thinly-provisioned back end.  s" B2 S3 m# x8 ]3 K- p$ R0 }
Migrate a volume with the openstack volume migrate command, as shown in the following example:
$ openstack volume migrate [-h --host <host> [--force-host-copy                                  [--lock-volume] <volume>
: Z& K( j! b+ I- M4 A; e0 R
& g* q* t6 F- J: X/ o( s, Y' k$ V
The arguments for this command are:
hostThe destination host in the format host@backend-name#pool.volumeThe ID of the volume to migrate.force-host-copyDisables any driver optimizations and forces the data to be copied by the host.lock-volumePrevents other processes from aborting the migration.( w5 g- m4 ~+ N! F8 f
Note: q4 Q* `( O) [9 D7 Z( c- {# a8 n( k
If the volume has snapshots, the specified host destination cannot accept the volume. If the user is not an administrator, the migration fails.
7 y# E9 A8 p* C& y' S8 B& c4 J

; @& f% S, `) \2 D) u% _Transfer a volume
You can transfer a volume from one owner to another by using the openstack volume transfer request create command. The volume donor, or original owner, creates a transfer request and sends the created transfer ID and authorization key to the volume recipient. The volume recipient, or new owner, accepts the transfer by using the ID and key.
In Rocky, Cinder changes the API behavior for V2 and 3.x < 3.55, snapshots will be transferred with volume by default. That means if the volume has some snapshots, when a user transfers a volume from one owner to another, then those snapshots will be transferred with the volume as well. After microversion 3.55, Cinder supports the ability to transfer volume without snapshots. If users don’t want to transfer snapshots, they need to specify the new optional argument –no_snapshots.

6 H1 B3 }* b. {Note
9 x% _' r+ Q$ J5 l* ^# T4 E
The procedure for volume transfer is intended for projects (both the volume donor and recipient) within the same cloud.
# d/ u" r6 A! G9 r
Use cases include:
  • Create a custom bootable volume or a volume with a large data set and transfer it to a customer.
  • For bulk import of data to the cloud, the data ingress system creates a new Block Storage volume, copies data from the physical device, and transfers device ownership to the end user.
    6 J+ L9 e' ?# C( X0 r, n5 a
Create a volume transfer request
  • While logged in as the volume donor, list the available volumes:
    $ openstack volume list+-----------------+-----------------+-----------+------+-------------+|       ID        |   Display Name  |  Status   | Size | Attached to |+-----------------+-----------------+-----------+------+-------------+| 72bfce9f-cac... |       None      |   error   |  1   |             || a1cdace0-08e... |       None      | available |  1   |             |+-----------------+-----------------+-----------+------+-------------+/ z0 W8 Y; J  L# d' |9 J- @+ Z
    3 t+ r( A+ }3 ^+ W! g0 T6 _3 g
  • As the volume donor, request a volume transfer authorization code for a specific volume:
    $ openstack volume transfer request create [--no-snapshots <volume>
    1 p" l" w3 Q( d  T4 e/ W: I+ h# I9 d4 U( w# E
    6 V( Y5 [+ l' d
The arguments to be passed are:
<volume> Name or ID of volume to transfer.
--no-snapshots Transfer the volume without snapshots.
The volume must be in an available state or the request will be denied. If the transfer request is valid in the database (that is, it has not expired or been deleted), the volume is placed in an awaiting-transfer state. For example:
$ openstack volume transfer request create a1cdace0-08e4-4dc7-b9dc-457e9bcfe25f3 u; a9 H: ^' _$ g. C5 d

( M' q9 n6 @) V% @9 m
The output shows the volume transfer ID in the id row and the authorization key.
+------------+--------------------------------------+| Field      | Value                                |+------------+--------------------------------------+| auth_key   | 0a59e53630f051e2                     || created_at | 2016-11-03T11:49:40.346181           || id         | 34e29364-142b-4c7b-8d98-88f765bf176f || name       | None                                 || volume_id  | a1cdace0-08e4-4dc7-b9dc-457e9bcfe25f |+------------+--------------------------------------+% M8 ~8 j9 y8 v, C* f! q! k

2 I9 K$ y% T0 i1 s$ X0 G% p/ `, @* ?
Note: @' r: S. B2 Z1 ^/ Y1 s
Optionally, you can specify a name for the transfer by using the --name transferName parameter.

/ r/ a" L! |$ \
% a, a  a% D' k  b/ c: MNote
8 e+ j# l- R, Y" b9 f
While the auth_key property is visible in the output of openstack volume transfer request create VOLUME_ID, it will not be available in subsequent openstack volume transfer request show TRANSFER_ID command.

+ q) \, k; s# t3 A6 ^3 u4 ~% ~' {
  • Send the volume transfer ID and authorization key to the new owner (for example, by email).
  • View pending transfers:
    $ openstack volume transfer request list+--------------------------------------+--------------------------------------+------+|               ID                     |             Volume                   | Name |+--------------------------------------+--------------------------------------+------+| 6e4e9aa4-bed5-4f94-8f76-df43232f44dc | a1cdace0-08e4-4dc7-b9dc-457e9bcfe25f | None |+--------------------------------------+--------------------------------------+------+
      F1 g) Y* R8 m9 K4 |) a5 K4 k; `" A1 z$ |( T5 Z( |* e
  • After the volume recipient, or new owner, accepts the transfer, you can see that the transfer is no longer available:
    $ openstack volume transfer request list+----+-----------+------+| ID | Volume ID | Name |+----+-----------+------++----+-----------+------+
    # g2 W, J7 W# S1 R. V% Q, P
    , n" F# i+ }  W% ^
    1 i& \/ N2 o: G0 s9 P# O  ?
; v8 Z3 [2 `9 X) i' Y) P* n  U
Accept a volume transfer request
  • As the volume recipient, you must first obtain the transfer ID and authorization key from the original owner.
  • Accept the request:
    $ openstack volume transfer request accept transferID authKey
    : C  f' v" Q$ w" o: y0 c
    0 p2 e6 ^+ a  }
    For example:
    $ openstack volume transfer request accept 6e4e9aa4-bed5-4f94-8f76-df43232f44dc b2c8e585cbc68a80+-----------+--------------------------------------+|  Property |                Value                 |+-----------+--------------------------------------+|     id    | 6e4e9aa4-bed5-4f94-8f76-df43232f44dc ||    name   |                 None                 || volume_id | a1cdace0-08e4-4dc7-b9dc-457e9bcfe25f |+-----------+--------------------------------------+
    & U+ W4 x& f! {+ r8 z( w7 `3 d
    + p* I0 R  I' U) u5 a) k, U4 I/ L- |3 U
    Note3 h& o7 O, m  F: K2 z- ~* g
    If you do not have a sufficient quota for the transfer, the transfer is refused.
    : o- l  @" F' q  I  X6 a

    8 v* m6 x4 R% f. v  N6 B
& M; s5 l" R6 D" |' S: J$ o
Delete a volume transfer
  • List available volumes and their statuses:
    $ openstack volume list+-----------------+-----------------+-----------------+------+-------------+|       ID        |   Display Name  |      Status     | Size | Attached to |+-----------------+-----------------+-----------------+------+-------------+| 72bfce9f-cac... |       None      |      error      |  1   |             || a1cdace0-08e... |       None      |awaiting-transfer|  1   |             |+-----------------+-----------------+-----------------+------+-------------+
    5 R: L6 Z: N8 f# t6 P# W' Y, @1 n7 x% v* W4 L
  • Find the matching transfer ID:
    $ openstack volume transfer request list+--------------------------------------+--------------------------------------+------+|               ID                     |             VolumeID                 | Name |+--------------------------------------+--------------------------------------+------+| a6da6888-7cdf-4291-9c08-8c1f22426b8a | a1cdace0-08e4-4dc7-b9dc-457e9bcfe25f | None |+--------------------------------------+--------------------------------------+------+
    ) T! t6 m5 R- `6 h; g6 [% |. Z% ]1 l: Y
    + C: y4 A5 x! l/ f' P
  • Delete the volume:
    $ openstack volume transfer request delete <transfer>: W/ W, m: v0 m8 w5 x* \- D3 D# ]

    8 H- g/ ~+ r+ G<transfer>
    Name or ID of transfer to delete.
    For example:
    $ openstack volume transfer request delete a6da6888-7cdf-4291-9c08-8c1f22426b8a# e% z7 T: w+ e5 J6 F

    ' g; V5 s8 X- [, B
  • Verify that transfer list is now empty and that the volume is again available for transfer:
    $ openstack volume transfer request list+----+-----------+------+| ID | Volume ID | Name |+----+-----------+------++----+-----------+------+
    . \+ H8 H* a% J6 n
    ! @( D, E6 p2 b9 h  V; r$ openstack volume list+-----------------+-----------+--------------+------+-------------+----------+-------------+|       ID        |   Status  | Display Name | Size | Volume Type | Bootable | Attached to |+-----------------+-----------+--------------+------+-------------+----------+-------------+| 72bfce9f-ca...  |   error   |     None     |  1   |     None    |  false   |             || a1cdace0-08...  | available |     None     |  1   |     None    |  false   |             |+-----------------+-----------+--------------+------+-------------+----------+-------------+" a  ^- E0 D- s% I

    4 U3 e- V# q1 i' A: V$ M! p" t; _  L8 p: I/ l: r) F; t

3 e; o4 u6 A. y) O$ O5 a$ Z! q7 H- L+ V

: K- ?3 e( L$ `" g: dManage and unmanage a snapshot
A snapshot is a point in time version of a volume. As an administrator, you can manage and unmanage snapshots.
Manage a snapshot
Manage a snapshot with the openstack volume snapshot set command:
$ openstack volume snapshot set [-h                                [--name <name>]                                [--description <description>]                                [--no-property]                                [--property <key=value>]                                [--state <state>]                                <snapshot>* [9 u6 ]/ L, F" e  f3 `

5 z5 ?# {5 P* T, m( a8 R
The arguments to be passed are:
--name <name>New snapshot name--description <description>New snapshot description--no-propertyRemove all properties from <snapshot> (specify both –no-property and –property to remove the current properties before setting new properties.)--property <key=value>Property to add or modify for this snapshot (repeat option to set multiple properties)--state <state>New snapshot state. (“available”, “error”, “creating”, “deleting”, or “error_deleting”) (admin only) (This option simply changes the state of the snapshot in the database with no regard to actual status, exercise caution when using)<snapshot>Snapshot to modify (name or ID)$ openstack volume snapshot set my-snapshot-id& f, Q* z; W" Q3 t/ s: q6 ~
% {: ], p- e4 |+ U. j0 s  H$ @

5 L3 X9 S* ^: G  w, s: ]5 `( zUnmanage a snapshot
Unmanage a snapshot with the openstack volume snapshot unset command:
$ openstack volume snapshot unset [-h                                  [--property <key>]                                  <snapshot>
/ t% f6 B8 T# Y+ q& Z6 B* i0 F- \# o
The arguments to be passed are:
--property <key>Property to remove from snapshot (repeat option to remove multiple properties)<snapshot>Snapshot to modify (name or ID).
The following example unmanages the my-snapshot-id image:
$ openstack volume snapshot unset my-snapshot-id
& Z& b: ]8 P) D+ f3 s, l3 d  j' z3 |) g, P! h
; P2 C, {9 d( j" f0 B3 i+ N
3 R& U- F+ [; B; T( [! m
Report backend state in service list
Each of the Cinder services report a Status and a State. These are the administrative state and the runtime state, respectively.
To get a listing of all Cinder services and their states, run the command:
$ openstack volume service list+------------------+-------------------+------+---------+-------+----------------------------+| Binary           | Host              | Zone | Status  | State | Updated At                 |+------------------+-------------------+------+---------+-------+----------------------------+| cinder-scheduler | tower             | nova | enabled | up    | 2018-03-30T21:16:11.000000 || cinder-volume    | tower@lvmdriver-1 | nova | enabled | up    | 2018-03-30T21:16:15.000000 || cinder-backup    | tower             | nova | enabled | up    | 2018-03-30T21:16:14.000000 |+------------------+-------------------+------+---------+-------+----------------------------+$ X9 M5 s8 C8 T. R1 O7 M

( z* ?$ X2 k' h- j1 s$ l
5 @( N0 i2 a6 _$ j4 E6 u* d

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2021-5-25 01:00:10 | 显示全部楼层
A volume is a detachable block storage device, similar to a USB hard drive. You can attach a volume to only one instance. Use the openstack client commands to create and manage volumes.
Create a volume
This example creates a my-new-volume volume based on an image.
  • List images, and note the ID of the image that you want to use for your volume:
    $ openstack image list+--------------------------------------+---------------------------------+| ID                                   | Name                            |+--------------------------------------+---------------------------------+| 8bf4dc2a-bf78-4dd1-aefa-f3347cf638c8 | cirros-0.3.5-x86_64-uec         || 9ff9bb2e-3a1d-4d98-acb5-b1d3225aca6c | cirros-0.3.5-x86_64-uec-kernel  || 4b227119-68a1-4b28-8505-f94c6ea4c6dc | cirros-0.3.5-x86_64-uec-ramdisk |+--------------------------------------+---------------------------------+4 R0 v( q. n8 w& |

    % c. m* y( J, \% O! K' b4 g: G
  • List the availability zones, and note the ID of the availability zone in which you want to create your volume:
    $ openstack availability zone list+------+-----------+| Name |   Status  |+------+-----------+| nova | available |+------+-----------+5 J  p6 A& N4 D: L3 d
    ( I% o0 @4 x0 r, W' E7 Z
  • Create a volume with 8 gibibytes (GiB) of space, and specify the availability zone and image:
    $ openstack volume create --image 8bf4dc2a-bf78-4dd1-aefa-f3347cf638c8 \  --size 8 --availability-zone nova my-new-volume+------------------------------+--------------------------------------+| Property                     | Value                                |+------------------------------+--------------------------------------+| attachments                  | []                                   || availability_zone            | nova                                 || bootable                     | false                                || consistencygroup_id          | None                                 || created_at                   | 2016-09-23T07:52:42.000000           || description                  | None                                 || encrypted                    | False                                || id                           | bab4b0e0-ce3d-4d57-bf57-3c51319f5202 || metadata                     | {}                                   || multiattach                  | False                                || name                         | my-new-volume                        || os-vol-tenant-attr:tenant_id | 3f670abbe9b34ca5b81db6e7b540b8d8     || replication_status           | disabled                             || size                         | 8                                    || snapshot_id                  | None                                 || source_volid                 | None                                 || status                       | creating                             || updated_at                   | None                                 || user_id                      | fe19e3a9f63f4a14bd4697789247bbc5     || volume_type                  | lvmdriver-1                          |+------------------------------+--------------------------------------+
    1 ~0 `& u$ A' y( c0 \0 D
    6 Q9 q* W0 G# r
  • To verify that your volume was created successfully, list the available volumes:
    $ openstack volume list+--------------------------------------+---------------+-----------+------+-------------+| ID                                   | DisplayName   |  Status   | Size | Attached to |+--------------------------------------+---------------+-----------+------+-------------+| bab4b0e0-ce3d-4d57-bf57-3c51319f5202 | my-new-volume | available | 8    |             |+--------------------------------------+---------------+-----------+------+-------------+
    # X0 y4 L* `1 M% o* R
    2 u, ^2 q( C9 T7 X2 }
    If your volume was created successfully, its status is available. If its status is error, you might have exceeded your quota.

    3 @6 F2 n" }2 q
Volume Types
Cinder supports these three ways to specify volume type during volume creation.
  • volume_type
  • cinder_img_volume_type (via glance image metadata)
  • default_volume_type (via cinder.conf)
    $ ^* E. T! W( K6 B" W  g/ U. H
volume-type
User can specify volume type when creating a volume.
$ openstack volume create -h -f {json,shell,table,value,yaml}                         -c COLUMN --max-width <integer>                         --noindent --prefix PREFIX --size <size>                         --type <volume-type> --image <image>                         --snapshot <snapshot> --source <volume>                         --description <description> --user <user>                         --project <project>                         --availability-zone <availability-zone>                         --property <key=value>                         <name>6 h* h* p+ g  h8 u. O) J

. T0 k& k2 e& [" I( R9 e, q8 \6 j& H( t
cinder_img_volume_type
If glance image has cinder_img_volume_type property, Cinder uses this parameter to specify volume type when creating a volume.
Choose glance image which has cinder_img_volume_type property and create a volume from the image.
$ openstack image list+----------------------------------+---------------------------------+--------+| ID                               | Name                            | Status |+----------------------------------+---------------------------------+--------+| 376bd633-c9c9-4c5d-a588-342f4f66 | cirros-0.3.5-x86_64-uec         | active || d086                             |                                 |        || 2c20fce7-2e68-45ee-ba8d-         | cirros-0.3.5-x86_64-uec-ramdisk | active || beba27a91ab5                     |                                 |        || a5752de4-9faf-4c47-acbc-         | cirros-0.3.5-x86_64-uec-kernel  | active || 78a5efa7cc6e                     |                                 |        |+----------------------------------+---------------------------------+--------+$ openstack image show 376bd633-c9c9-4c5d-a588-342f4f66d086+------------------------+------------------------------------------------------+| Field                  | Value                                                |+------------------------+------------------------------------------------------+| checksum               | eb9139e4942121f22bbc2afc0400b2a                      || cinder_img_volume_type | nfstype                                              || container_format       | ami                                                  || created_at             | 2016-10-13T03:28:55Z                                 || disk_format            | ami                                                  || file                   | /v2/images/376bd633-c9c9-4c5d-a588-342f4f66d086/file || id                     | 376bd633-c9c9-4c5d-a588-342f4f66d086                 || min_disk               | 0                                                    || min_ram                | 0                                                    || name                   | cirros-0.3.5-x86_64-uec                              || owner                  | 88ba456e3a884c318394737765e0ef4d                     || properties             | kernel_id='a5752de4-9faf-4c47-acbc-78a5efa7cc6e',    ||                        | ramdisk_id='2c20fce7-2e68-45ee-ba8d-beba27a91ab5'    || protected              | False                                                || schema                 | /v2/schemas/image                                    || size                   | 25165824                                             || status                 | active                                               || tags                   |                                                      || updated_at             | 2016-10-13T03:28:55Z                                 || virtual_size           | None                                                 || visibility             | public                                               |+------------------------+------------------------------------------------------+$ openstack volume create --image 376bd633-c9c9-4c5d-a588-342f4f66d086 \  --size 1 --availability-zone nova test+---------------------+--------------------------------------+| Field               | Value                                |+---------------------+--------------------------------------+| attachments         | []                                   || availability_zone   | nova                                 || bootable            | false                                || consistencygroup_id | None                                 || created_at          | 2016-10-13T06:29:53.688599           || description         | None                                 || encrypted           | False                                || id                  | e6e6a72d-cda7-442c-830f-f306ea6a03d5 || multiattach         | False                                || name                | test                                 || properties          |                                      || replication_status  | disabled                             || size                | 1                                    || snapshot_id         | None                                 || source_volid        | None                                 || status              | creating                             || type                | nfstype                              || updated_at          | None                                 || user_id             | 33fdc37314914796883706b33e587d51     |+---------------------+--------------------------------------+
0 Y7 v3 G0 v. C& L) b% |& |6 R! C$ n
( U5 ^$ P4 V) n
default_volume_type
If above parameters are not set, Cinder uses default_volume_type which is defined in cinder.conf during volume creation.
Example cinder.conf file configuration.
[default]default_volume_type = lvmdriver-1; G4 _1 ~' \* m( c5 i. o; A

4 ?$ q1 x' M) c; X2 _: c% P: {: J. d4 a) ]- m. h
" s5 V& x, U0 d% P% K
9 d- P+ \5 l" \5 t2 Z0 U
Attach a volume to an instance
  • Attach your volume to a server, specifying the server ID and the volume ID:
    $ openstack server add volume 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 \  573e024d-5235-49ce-8332-be1576d323f8 --device /dev/vdb
    4 M7 e5 w4 V7 a/ v1 y+ h; Q& F  X' K/ S/ n) K0 t
  • Show information for your volume:
    $ openstack volume show 573e024d-5235-49ce-8332-be1576d323f8
    ' x' Q  o, K3 ^- Y3 m; R0 |6 B
    ! S1 o& H# U& W2 ?$ k
    The output shows that the volume is attached to the server with ID 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5, is in the nova availability zone, and is bootable.
    +------------------------------+-----------------------------------------------+| Field                        | Value                                         |+------------------------------+-----------------------------------------------+| attachments                  | [{u'device': u'/dev/vdb',                     ||                              |        u'server_id': u'84c6e57d-a             ||                              |           u'id': u'573e024d-...               ||                              |        u'volume_id': u'573e024d...            || availability_zone            | nova                                          || bootable                     | true                                          || consistencygroup_id          | None                                          || created_at                   | 2016-10-13T06:08:07.000000                    || description                  | None                                          || encrypted                    | False                                         || id                           | 573e024d-5235-49ce-8332-be1576d323f8          || multiattach                  | False                                         || name                         | my-new-volume                                 || properties                   |                                               || replication_status           | disabled                                      || size                         | 8                                             || snapshot_id                  | None                                          || source_volid                 | None                                          || status                       | in-use                                        || type                         | lvmdriver-1                                   || updated_at                   | 2016-10-13T06:08:11.000000                    || user_id                      | 33fdc37314914796883706b33e587d51              |+------------------------------+-----------------------------------------------+- k& k' Q( p4 V1 l9 P  s. ?
    # C* `0 g. B6 t% ]2 c4 j" k0 _

    - [" P; P# I3 V. U) v$ a
4 H. S5 k3 A9 Z# r' R
Detach a volume from an instance
  • Detach your volume from a server, specifying the server ID and the volume ID:
    $ openstack server remove volume 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 \  573e024d-5235-49ce-8332-be1576d323f8
    7 s2 u6 A; t/ v7 o  M
    * }" l7 D! D5 c9 U9 w  X
  • Show information for your volume:
    $ openstack volume show 573e024d-5235-49ce-8332-be1576d323f8* u4 k- S1 y+ G" O

    : `2 z" x" P2 v4 k, b! Z" x8 x
    The output shows that the volume is no longer attached to the server:
    +------------------------------+-----------------------------------------------+| Field                        | Value                                         |+------------------------------+-----------------------------------------------+| attachments                  | []                                            || availability_zone            | nova                                          || bootable                     | true                                          || consistencygroup_id          | None                                          || created_at                   | 2016-10-13T06:08:07.000000                    || description                  | None                                          || encrypted                    | False                                         || id                           | 573e024d-5235-49ce-8332-be1576d323f8          || multiattach                  | False                                         || name                         | my-new-volume                                 || properties                   |                                               || replication_status           | disabled                                      || size                         | 8                                             || snapshot_id                  | None                                          || source_volid                 | None                                          || status                       | in-use                                        || type                         | lvmdriver-1                                   || updated_at                   | 2016-10-13T06:08:11.000000                    || user_id                      | 33fdc37314914796883706b33e587d51              |+------------------------------+-----------------------------------------------+0 ~. E8 L. T/ Q5 t

    ) g! z) G+ ]4 h0 r- u0 g* g
    : q' `% k3 N" s. Z: U
5 e- {( F, b4 Y5 {3 A; H
Delete a volume
  • To delete your volume, you must first detach it from the server. To detach the volume from your server and check for the list of existing volumes, see steps 1 and 2 in Resize_a_volume.
    Delete the volume using either the volume name or ID:
    $ openstack volume delete my-new-volume
    & x  W$ h& P: |( `
    5 T9 Q; \7 X) T! `, \6 L9 Y( V
    This command does not provide any output.
  • List the volumes again, and note that the status of your volume is deleting:
    $ openstack volume list+----------------+-----------------+-----------+------+-------------+|       ID       |   Display Name  |  Status   | Size | Attached to |+----------------+-----------------+-----------+------+-------------+| 573e024d-52... |  my-new-volume  |  deleting |  8   |             || bd7cf584-45... | my-bootable-vol | available |  8   |             |+----------------+-----------------+-----------+------+-------------+9 }" W* Z2 q7 `$ d

    ! |# L( ]- J) }8 e
    When the volume is fully deleted, it disappears from the list of volumes:
    $ openstack volume list+----------------+-----------------+-----------+------+-------------+|       ID       |   Display Name  |  Status   | Size | Attached to |+----------------+-----------------+-----------+------+-------------+| bd7cf584-45... | my-bootable-vol | available |  8   |             |+----------------+-----------------+-----------+------+-------------+% I/ c( E) \5 U: ?2 s# N- j" k

    ) ^/ u- @2 V8 l( d' G& `; J9 h* T8 z8 s# q; b  t% n

: S4 R0 g5 G+ y3 l9 ]! G1 P' lResize a volume
  • To resize your volume, you must first detach it from the server. To detach the volume from your server, pass the server ID and volume ID to the following command:
    $ openstack server remove volume 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 573e024d-5235-49ce-8332-be1576d323f89 Q( v- d+ a" t3 ]
    ( R& t- @/ ^# x( m9 ]6 T
    This command does not provide any output.
  • List volumes:
    $ openstack volume list+----------------+-----------------+-----------+------+-------------+|       ID       |   Display Name  |  Status   | Size | Attached to |+----------------+-----------------+-----------+------+-------------+| 573e024d-52... |  my-new-volume  | available |  8   |             || bd7cf584-45... | my-bootable-vol | available |  8   |             |+----------------+-----------------+-----------+------+-------------+/ A" p8 J0 J9 J* C4 @1 y4 n7 D( Q
    5 J2 z8 ?% k- G6 V" a2 p
    Note that the volume is now available.
  • Resize the volume by passing the volume ID and the new size (a value greater than the old one) as parameters:
    $ openstack volume set 573e024d-5235-49ce-8332-be1576d323f8 --size 10
    ' e! }6 m% r5 s7 ]* T- p9 W4 U4 r$ Y1 K$ l: `
    This command does not provide any output.
    3 M. z1 M3 t$ b) s+ Q8 @
    Note
    When extending an LVM volume with a snapshot, the volume will be deactivated. The reactivation is automatic unless auto_activation_volume_list is defined in lvm.conf. See lvm.conf for more information.

    + [5 |8 |# a+ ]/ z  U" h+ \: e
    $ ]. n4 z+ m7 R

1 m! h5 g3 _& b8 ^4 f8 S0 A* P! i2 O; ~0 ]Migrate a volume
As an administrator, you can migrate a volume with its data from one location to another in a manner that is transparent to users and workloads. You can migrate only detached volumes with no snapshots.
Possible use cases for data migration include:
  • Bring down a physical storage device for maintenance without disrupting workloads.
  • Modify the properties of a volume.
  • Free up space in a thinly-provisioned back end.
    + r( x& ^: l8 j: C  n
Migrate a volume with the openstack volume migrate command, as shown in the following example:
$ openstack volume migrate [-h] --host <host> [--force-host-copy]                                  [--lock-volume] <volume>
9 g. i& k& y( _( f: u& S2 c# c( W$ V  ^9 y0 y
The arguments for this command are:
hostThe destination host in the format host@backend-name#pool.volumeThe ID of the volume to migrate.force-host-copyDisables any driver optimizations and forces the data to be copied by the host.lock-volumePrevents other processes from aborting the migration.
* K, ^: Q, R2 I  p+ K4 V+ f6 J
Note
If the volume has snapshots, the specified host destination cannot accept the volume. If the user is not an administrator, the migration fails.

& N* W! a' O7 _9 W, ~& X8 N
: `( i2 y7 L7 V1 X% K
Transfer a volume
You can transfer a volume from one owner to another by using the openstack volume transfer request create command. The volume donor, or original owner, creates a transfer request and sends the created transfer ID and authorization key to the volume recipient. The volume recipient, or new owner, accepts the transfer by using the ID and key.
In Rocky, Cinder changes the API behavior for V2 and 3.x < 3.55, snapshots will be transferred with volume by default. That means if the volume has some snapshots, when a user transfers a volume from one owner to another, then those snapshots will be transferred with the volume as well. After microversion 3.55, Cinder supports the ability to transfer volume without snapshots. If users don’t want to transfer snapshots, they need to specify the new optional argument –no_snapshots.
' L& b6 _, {! t$ k3 W
Note
The procedure for volume transfer is intended for projects (both the volume donor and recipient) within the same cloud.

1 ]# Q1 F7 ~' l2 D; S% J
Use cases include:
  • Create a custom bootable volume or a volume with a large data set and transfer it to a customer.
  • For bulk import of data to the cloud, the data ingress system creates a new Block Storage volume, copies data from the physical device, and transfers device ownership to the end user.4 M) J5 ]. Z* f+ b
Create a volume transfer request
  • While logged in as the volume donor, list the available volumes:
    $ openstack volume list+-----------------+-----------------+-----------+------+-------------+|       ID        |   Display Name  |  Status   | Size | Attached to |+-----------------+-----------------+-----------+------+-------------+| 72bfce9f-cac... |       None      |   error   |  1   |             || a1cdace0-08e... |       None      | available |  1   |             |+-----------------+-----------------+-----------+------+-------------+
    " R' Z9 T0 t: j& N0 B6 S. ?( e/ S* o! F/ t; T/ h
  • As the volume donor, request a volume transfer authorization code for a specific volume:
    $ openstack volume transfer request create [--no-snapshots] <volume>
    $ F* m" O) j1 n) b/ c; I1 p3 a9 c4 C" @/ S1 S0 Y  L( A- e
    , h- W/ I8 F! E5 g/ l
The arguments to be passed are:
<volume> Name or ID of volume to transfer.
--no-snapshots Transfer the volume without snapshots.
The volume must be in an available state or the request will be denied. If the transfer request is valid in the database (that is, it has not expired or been deleted), the volume is placed in an awaiting-transfer state. For example:
$ openstack volume transfer request create a1cdace0-08e4-4dc7-b9dc-457e9bcfe25f
, e  o# _/ g+ k1 E7 R2 s% t
; j0 E$ n$ p" U: y
The output shows the volume transfer ID in the id row and the authorization key.
+------------+--------------------------------------+| Field      | Value                                |+------------+--------------------------------------+| auth_key   | 0a59e53630f051e2                     || created_at | 2016-11-03T11:49:40.346181           || id         | 34e29364-142b-4c7b-8d98-88f765bf176f || name       | None                                 || volume_id  | a1cdace0-08e4-4dc7-b9dc-457e9bcfe25f |+------------+--------------------------------------+
( N, g) y1 V0 W# ]$ |+ V5 q  v- V& A) f, f2 Z2 U. H# y

! ]0 T4 h3 a7 q, s# p0 `0 VNote
Optionally, you can specify a name for the transfer by using the --name transferName parameter.

) o: u: I# Z7 s$ b

( `* }! Q- T* m1 s. e) f: T/ MNote
While the auth_key property is visible in the output of openstack volume transfer request create VOLUME_ID, it will not be available in subsequent openstack volume transfer request show TRANSFER_ID command.

2 n6 K, e, w& a( \
  • Send the volume transfer ID and authorization key to the new owner (for example, by email).
  • View pending transfers:
    $ openstack volume transfer request list+--------------------------------------+--------------------------------------+------+|               ID                     |             Volume                   | Name |+--------------------------------------+--------------------------------------+------+| 6e4e9aa4-bed5-4f94-8f76-df43232f44dc | a1cdace0-08e4-4dc7-b9dc-457e9bcfe25f | None |+--------------------------------------+--------------------------------------+------+
    5 s: [+ W( o% t4 L! k; X$ ?7 \. s0 `2 S& U* k- M
  • After the volume recipient, or new owner, accepts the transfer, you can see that the transfer is no longer available:
    $ openstack volume transfer request list+----+-----------+------+| ID | Volume ID | Name |+----+-----------+------++----+-----------+------+
      ^- O0 b; `  X0 e- j
      o8 A) D# Q+ d- Q; P( g1 H/ |" X/ z! e+ R

- D- t2 a' S! l3 G" J7 I3 iAccept a volume transfer request
  • As the volume recipient, you must first obtain the transfer ID and authorization key from the original owner.
  • Accept the request:
    $ openstack volume transfer request accept transferID authKey
    * ^2 m' c9 B, u+ V2 u
    6 g: e& z* a! E
    For example:
    $ openstack volume transfer request accept 6e4e9aa4-bed5-4f94-8f76-df43232f44dc b2c8e585cbc68a80+-----------+--------------------------------------+|  Property |                Value                 |+-----------+--------------------------------------+|     id    | 6e4e9aa4-bed5-4f94-8f76-df43232f44dc ||    name   |                 None                 || volume_id | a1cdace0-08e4-4dc7-b9dc-457e9bcfe25f |+-----------+--------------------------------------+& w, j5 j* \4 @/ }

    ; F9 W* o* m% Y3 f" s
    ; e4 u* R: [+ m* z4 [
    Note
    If you do not have a sufficient quota for the transfer, the transfer is refused.

      I& i% W; G6 V9 z: G
    8 g5 }* y* Z8 [' q3 b/ ~' \

' Y" j: `! X- m% |! e$ QDelete a volume transfer
  • List available volumes and their statuses:
    $ openstack volume list+-----------------+-----------------+-----------------+------+-------------+|       ID        |   Display Name  |      Status     | Size | Attached to |+-----------------+-----------------+-----------------+------+-------------+| 72bfce9f-cac... |       None      |      error      |  1   |             || a1cdace0-08e... |       None      |awaiting-transfer|  1   |             |+-----------------+-----------------+-----------------+------+-------------+
    * P6 g1 A0 L9 i& \7 [; I: f% l8 `. o
  • Find the matching transfer ID:
    $ openstack volume transfer request list+--------------------------------------+--------------------------------------+------+|               ID                     |             VolumeID                 | Name |+--------------------------------------+--------------------------------------+------+| a6da6888-7cdf-4291-9c08-8c1f22426b8a | a1cdace0-08e4-4dc7-b9dc-457e9bcfe25f | None |+--------------------------------------+--------------------------------------+------+
    : u& D% p' ~6 k7 ~+ F6 B
    ( f* L  f# N" {: s0 T! x+ z5 ~! U
  • Delete the volume:
    $ openstack volume transfer request delete <transfer>, f+ v& @1 y! K# ~4 e9 L
    # {; c6 e5 E( o  i' H9 Q
    <transfer>
    Name or ID of transfer to delete.
    For example:
    $ openstack volume transfer request delete a6da6888-7cdf-4291-9c08-8c1f22426b8a# e8 }" C) W7 U$ F+ w& P

    , `9 o, ^. I8 Z3 J
  • Verify that transfer list is now empty and that the volume is again available for transfer:
    $ openstack volume transfer request list+----+-----------+------+| ID | Volume ID | Name |+----+-----------+------++----+-----------+------+
    4 `8 e( n; S' A4 ?: d1 J) j  a/ }4 W; ~
    $ openstack volume list+-----------------+-----------+--------------+------+-------------+----------+-------------+|       ID        |   Status  | Display Name | Size | Volume Type | Bootable | Attached to |+-----------------+-----------+--------------+------+-------------+----------+-------------+| 72bfce9f-ca...  |   error   |     None     |  1   |     None    |  false   |             || a1cdace0-08...  | available |     None     |  1   |     None    |  false   |             |+-----------------+-----------+--------------+------+-------------+----------+-------------+
    , B+ m- `: {1 L' w# C! W- q& i# g# k% \

    ! X( j8 G& ]6 N3 Y: h

, k: x4 C' p, X, y4 M- a. a# ]. ~+ e

' {7 i. L9 z% N: BManage and unmanage a snapshot
A snapshot is a point in time version of a volume. As an administrator, you can manage and unmanage snapshots.
Manage a snapshot
Manage a snapshot with the openstack volume snapshot set command:
$ openstack volume snapshot set [-h]                                [--name <name>]                                [--description <description>]                                [--no-property]                                [--property <key=value>]                                [--state <state>]                                <snapshot>/ {5 g( F8 @- N, ?" }! T

7 K( V4 D5 z8 y' h! [* a6 a
The arguments to be passed are:
--name <name>New snapshot name--description <description>New snapshot description--no-propertyRemove all properties from <snapshot> (specify both –no-property and –property to remove the current properties before setting new properties.)--property <key=value>Property to add or modify for this snapshot (repeat option to set multiple properties)--state <state>New snapshot state. (“available”, “error”, “creating”, “deleting”, or “error_deleting”) (admin only) (This option simply changes the state of the snapshot in the database with no regard to actual status, exercise caution when using)<snapshot>Snapshot to modify (name or ID)$ openstack volume snapshot set my-snapshot-id
+ I1 R) k5 o5 C* C/ L2 e. f- [$ G) s; H
* h) d% B7 ~+ y+ x' H* T7 `
: r/ q$ X" {. @Unmanage a snapshot
Unmanage a snapshot with the openstack volume snapshot unset command:
$ openstack volume snapshot unset [-h]                                  [--property <key>]                                  <snapshot># t7 e6 N2 q& @$ s4 f+ \- @2 U

  @) G, n; b$ Z& g/ y
The arguments to be passed are:
--property <key>Property to remove from snapshot (repeat option to remove multiple properties)<snapshot>Snapshot to modify (name or ID).
The following example unmanages the my-snapshot-id image:
$ openstack volume snapshot unset my-snapshot-id( j8 H5 P( A# N3 ]) N' p
9 M  K3 v" q- S9 P" q" C
# ^% B3 q% D$ L8 o1 v$ X. v

3 ~4 V8 H4 q9 n5 C' x7 MReport backend state in service list
Each of the Cinder services report a Status and a State. These are the administrative state and the runtime state, respectively.
To get a listing of all Cinder services and their states, run the command:
$ openstack volume service list+------------------+-------------------+------+---------+-------+----------------------------+| Binary           | Host              | Zone | Status  | State | Updated At                 |+------------------+-------------------+------+---------+-------+----------------------------+| cinder-scheduler | tower             | nova | enabled | up    | 2018-03-30T21:16:11.000000 || cinder-volume    | tower@lvmdriver-1 | nova | enabled | up    | 2018-03-30T21:16:15.000000 || cinder-backup    | tower             | nova | enabled | up    | 2018-03-30T21:16:14.000000 |+------------------+-------------------+------+---------+-------+----------------------------+, q& u. D# R1 K( f* G3 h" r9 U% z
) g8 u7 Z1 d9 [  D6 ^& v

' v8 D: ^: S6 N$ n! }) B# J. r9 p

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2021-9-14 15:01:24 | 显示全部楼层
创建卷' B) H% X( H& R- V
cinder create test
! z0 l0 k( U/ k$ g1 E3 S2 J% f; g) j/ q3 u; L8 X% T5 t! M# W
cinder create test --volume-type ssd0 S' j/ G- G' G, \* v3 X
; |1 p# p# d- \" e$ K& ]
cinder create test --volume-type sata
. f( a  Q. v1 v1 H, l% {0 q$ s0 J
- }" w9 o5 D" g2 R% ~列举所有卷
5 s* q$ X8 \2 N5 n( q1 dcinder list
3 q+ w- E* M9 M! q
7 k8 x9 _7 e7 w+ W3 B1 o+ p删除卷
7 j; B8 Y$ o# x) L! t- s- X1 ucinder delete $volume_id
$ a  H8 d: e( p0 C, J/ B
9 `$ b7 E9 e. J! C( t! \$ F' U" [: n强制删除卷
# L. w$ o5 `9 e6 W# f8 ?; Y' Ucinder force-delete $volume_id9 [5 `/ t& r( @( a: t4 c

/ {: w+ S( m. O* T! G" G& f重命名卷
! t, \$ x+ p  mcinder rename $volume_id $volume_name
- F" w# f! H  S& w9 y4 x$ a) x) X# @3 ^' n
查看卷详情
" o8 j6 }5 K% E; ucinder show $volume_id
9 S0 J6 `( q, ?
7 f0 M9 f+ z# D, G重置卷状态& C  N( U& y: d# N4 h/ @
cinder reset-state $volume_id
+ a0 S3 N8 M) m/ p8 n" [4 o. ?7 E. X" u6 }, l
设置metadata8 h% k5 M! d7 W% c
cinder metadata $volume set $key=$value6 z3 R0 l- {9 W4 L9 w$ Z
- D( w0 b( B; Z  L; }" G, R' p7 U
查看metadata
* x0 I9 l5 Y9 rcinder metadata-show $volume_id
- Z! G% c* v8 g+ a5 I$ x4 |. s/ G$ Q2 U/ U+ \
取消metadata
! p9 M8 h0 H# v/ G3 b  }  @2 ucinder metadata $volume unset $key
: A* }' e) i: G: d: I: u: ^* @- {) y7 ?
创建snapshot/ a: R, O' P5 `  x8 D# G
cinder snapshot-create $volume_id$ ]0 X# X5 C/ r% D: f

( u) n' ]1 Z7 E: C列举所有snapshot: `9 ]! X. e$ S0 y% ]7 U
cinder snapshot-list
4 {1 G  \/ j8 J! n" ]8 c" _5 O* i& w, p
删除snapshot+ R. N, G# E5 F' ~5 c6 R
cinder snapshot-delete $snapshot_id" ^2 C/ |$ w* \$ P& V. {1 ?

9 Y  U5 |0 F( O% ?4 t$ Q) c) }: A设置snapshot metadata- b& \" R9 n0 X
cinder snapshot-metadata $snapshot_id set $key=$value
. a$ V9 o7 l3 r6 s; ~( P* S( x  n4 M/ w1 R/ h$ G4 y
查看snapshot metadata
& T% V2 G" a! ?1 w) jcinder snapshot-metadata-show $snapshot_id
" x4 J: J  A8 f+ e+ D" H& f& n0 q
: _8 j  b9 W) z$ _; y) a5 i1 k% {" T取消snapshot metadata( [/ B9 X8 R9 l- Q9 W, b% `
cinder snapshot-metadata $snapshot_id unset $key
$ Z8 F7 f, C- ^4 f  x+ ]+ v# b7 ?6 a
显示卷类型
8 |& A6 R1 r+ pcinder type-list
( I/ C7 v, q4 V3 {1 r
7 c' ^4 B! w; i1 ]创建卷类型4 y. F) D# c+ I$ Y0 q4 p
cinder type-create $type_name
# _: e/ H7 a) w* C8 c! g9 n/ E' W  c9 n
删除卷类型! ~+ ~# E' x3 E4 \: @3 ?
cinder type-delete $type_id
; \( @9 Z; }- _; Z+ ]) I% w
1 U! a* a% l- d' f" q/ A3 f列举后端服务
1 o% U0 B5 l$ L) P% D) L& jcinder service-list

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2021-9-14 15:03:06 | 显示全部楼层
列表类$ }7 G, t4 }( l" ]: p( ?# `
cinder list                 //列出所有volumes
) S* J3 |; e9 x# |0 L" kcinder type-list            //列出所有volume类型
! q+ A  s, _$ E7 Lcinder snapshot-list        //列出所有快照snapshot
! l* f2 x5 P: G# d% j7 x, i9 q/ Zcinder backup-list          //列出所有备份backup
. J5 r$ i5 N8 m: P) F6 scinder qos-list             //列出所有qos9 E6 M7 R4 M' P5 t/ G3 R9 G  p* s3 |# ~+ l
cinder service-list         //列出所有服务& y% o2 k0 d: \* m+ c9 V* f
cinder transfer-list        //列出所有transfer
8 Y5 q! b* ^( f: t. p7 I  s% Gcinder list-extensions      //列出所有扩展extensions) z5 h% [3 B6 [6 [5 c

- G$ }* B4 M, Y( F6 z. }
2 E# e) H# n. {4 K3 E' T创建类8 X$ N: K  k- t% E
cinder create <size> --dispaly-name --volume-type   //创建volume6 r/ M  C% x0 M# D0 q
cinder snapshot-create <volume> --dispaly-name      //创建快照& C3 X6 n0 y+ [0 G' L2 i; i
cinder backup-create <volume> --dispaly-name        //创建备份5 s# @& e0 t$ R
cinder qos-create <name> <key=value>                //创建qos" @; F. m, I+ S$ |0 ~$ P% L) V2 w
cinder type-create <name>                           //创建类型# G: y  a1 y) h8 B7 S; W1 E7 M; ^9 b
cinder transfer-create <volume> --dispaly-name      //创建传输0 ?# w. N' I9 o. a* y

, ~" r: f8 Q; j9 M4 l$ ^, K显示详情类
& M0 S$ B6 l8 F  j" x& Y3 x5 zcinder show <volume>                    //显示volume详情
, {) ?% y/ q- H, icinder metadata-show <volume>           //显示volume下元数据, K7 H, P! S2 N- [# ~/ ^
cinder backup-show <backup>             //显示backup详情! Y$ r8 A, `) c- g5 e* L" R
cinder qos-show <qos>                   //显示qos详情1 t% m' E7 z0 ]* z: p
cinder snapshot-show <snapshot>         //显示快照详情
& a. k: C( H! Kcinder snapshot-metadata-show <snapshot>//显示快照元数据详情( K) g- H4 s1 P, B# u
cinder transfer-show <transfer>         //显示传输详情
$ c  q$ j9 P9 y. E6 ~* N# scinder quota-show <tenant_id>           //显示一个租户下面的quota详情9 M( y2 I/ c0 Z+ A' t

3 B5 m* W+ f. I# K* [/ h3 }" d删除类, R2 h2 {% @6 R$ i
cinder delete <volume>                  //删除volume' }$ I: ~4 |7 }5 B
cinder force-delete <volume>            //强制删除volume
& O5 K3 N8 l& d3 `* c& [cinder backup-delete <backup>           //删除备份
; m' p  B0 z8 O. y- [cinder qos-delete <qos_specs> --force <True|False>      //删除qos
# E6 Y" e2 Z1 L% D2 Dcinder quota-delete <tenant_id>         //删除租户下的quota
0 W5 Q2 d) c6 lcinder snapshot-delete <snapshot>       //删除快照6 j0 G9 O/ B$ R  b7 Z
cinder type-delete <id>                 //删除类型3 a! m6 N" h7 F- o( y: b, F
cinder transfer-delete <transfer>       //删除传输
+ o6 E, n0 l4 C$ N. G0 e
4 C$ X2 ^$ W: s) O' e) X, h$ B分类浏览' b& Q- g5 w( j) e0 R6 }, S
Volume操作
8 e' ~9 O* B  W* `0 d4 ^cinder list                                         //列出所有volumes
4 P) _4 ^& I9 I, R; {. L  ^cinder create <size> --dispaly-name --volume-type   //创建volume' C! O0 p# z6 J- X% O% p& n
cinder show <volume>                                //显示volume详情
5 n/ k3 }; j, J$ j! n. dcinder delete <volume>                              //删除volume3 ?" }) f1 \0 m' ?3 G# \5 _
cinder migrate [--force-host-copy <True|False>]
' H8 m& [/ R4 D, x9 z0 W6 ^! a% J                     <volume> <host>                //迁移0 Q5 q8 V/ J! c1 E- o
cinder rename [--display-description <display-description>]
( f" r6 v  ^  L# O                     <volume> [<display-name>]      //重命名6 \( j: r: @$ x8 H' G
cinder reset-state <volume> --state <state>         //重置状态5 g! V- u' t/ K
cinder set-bootable <volume> <TRUE|FALSE>           //可启动
" S* P: E1 s! q  f9 U5 O; @cinder endpoints                                    //发现endpoints
; H; M$ m& z: Lcinder credentials   //Shows user credentials returned from auth.
4 t: |. l+ ^# j/ [7 ?3 ?
5 r8 `: t! a* S4 k6 [4 x8 q6 ?Backup操作+ M, i6 h7 w8 l; H
cinder backup-create <volume> --dispaly-name    //创建备份* [- A' W' j" k7 f+ q% R6 Y7 h
cinder backup-delete <backup>                   //删除备份
7 P- H# x, b  F2 ocinder backup-list                              //列出备份
# |0 D& \  h9 i) J$ z) ]$ hcinder backup-restore [--volume-id <volume>] <backup>      ; V7 s( C6 L$ x
                                                //重置备份1 o6 T3 ?2 [* P5 E- b  l
cinder backup-show <backup>                     //显示备份详情& H$ n+ D+ C* ~

) `& e' z$ [5 H7 o, ASnapshot操作: Z' r, y& }3 M& t6 p" y
snapshot-create     Creates a snapshot.
4 V: g! `5 K9 F, M$ |2 q) Gsnapshot-delete     Remove one or more snapshots.  F/ d3 Q4 c3 @- e' \
snapshot-list       Lists all snapshots.
4 e0 Q/ t. _) G4 U2 |snapshot-metadata   Sets or deletes snapshot metadata.
1 D9 z* e; q7 X- Q' D" C( Rsnapshot-metadata-show
( [- _2 e  j) H+ B                    Shows snapshot metadata.) b0 K$ C7 W4 A0 H/ Y2 g+ ]
snapshot-metadata-update-all
" l2 K! P$ W$ U. }( J9 S, B3 i8 q                    Updates snapshot metadata.
& r6 u+ R% h* Hsnapshot-rename     Renames a snapshot.9 D% Y* j( M7 ?% D- N- ]" f' Y) U/ O
snapshot-reset-state
. j, g6 I. O3 I                    Explicitly updates the snapshot state.
/ I# K: X3 V1 Msnapshot-show       Shows snapshot details.
7 U! S4 y! C1 {/ e
- b* Y1 R: z' [( L9 I4 }" Y7 L( T# G5 v4 J7 v
Type操作
" b* f) u" a/ ?' D3 F$ dtype-create         Creates a volume type./ `7 M, x5 b/ h1 U
type-delete         Deletes a specified volume type.5 D! M4 M) L; [. J# g
type-key            Sets or unsets extra_spec for a volume type.
1 ~+ l7 {2 n* ~$ ptype-list           Lists available 'volume types'.( D7 S( v9 l. l8 [
' t7 J3 w2 x* i6 o" w
qos操作6 z  C" L* W' h6 U
qos-associate       Associates qos specs with specified volume type.7 U# v( N& D6 w" Z% U
qos-create          Creates a qos specs.; F$ ?2 ~3 U; T
qos-delete          Deletes a specified qos specs.
3 b( |; O, J/ Z$ ~qos-disassociate    Disassociates qos specs from specified volume type.
1 S/ C" R  x7 r- Kqos-disassociate-all
9 ~: G6 W  f) [+ X                    Disassociates qos specs from all associations.
% q- j( c8 \9 Q( p* o/ B; S1 Jqos-get-association9 f: }4 i' r$ Y
                    Gets all associations for specified qos specs.% A' L4 x9 }8 J* [3 C; I
qos-key             Sets or unsets specifications for a qos spec." s, ?2 Y: T* o/ _6 d
qos-list            Lists qos specs.9 Z/ F. b  p/ A& g* G
qos-show            Shows a specified qos specs./ i# u" q1 K) s( E
- J' p& a& }5 z9 |. o, @# u' S
quota操作
! O( z0 B0 Y  U7 j9 G: n/ j8 N" y: zquota-class-show    Lists quotas for a quota class.5 y& u  W4 s0 ?) k% l& {
quota-class-update  Updates quotas for a quota class.
. A9 H! E, |! z2 r5 |quota-defaults      Lists default quotas for a tenant.8 b1 o" G  v! M: Z! o
quota-delete        Delete the quotas for a tenant.7 t  S% a0 d+ [# n# G: T
quota-show          Lists quotas for a tenant.1 p6 ]' y$ t) Q, E* h& f
quota-update        Updates quotas for a tenant.
6 H$ _& c0 _, i" Q6 b  ^quota-usage         Lists quota usage for a tenant.
7 c6 A) L: O& l: N+ I* V# \' d: w7 @/ }, P- [
Transfer操作
' P0 r; d# U6 t8 T3 k8 `transfer-accept     Accepts a volume transfer.0 h* B$ N3 N; J" J' e( w5 b* h
transfer-create     Creates a volume transfer.
) u- K6 C, B# `transfer-delete     Undoes a transfer., J6 @" }6 w0 o# S8 _4 }! p
transfer-list       Lists all transfers.
# c; v# m$ }# O: q4 s5 Q  `: utransfer-show       Show transfer details.
# V- w; X: x; B' c: c6 Z
5 g; u* J3 Q+ n, pService操作. Q" Y9 t3 D8 c: ^
service-disable     Disables the service." ], B) I$ A6 {0 z; G
service-enable      Enables the service.
& u+ j3 Q- c# }/ ~3 xservice-list        Lists all services.9 D' k* H" h- X' \+ X5 k: z
2 s3 U! M" t9 S! V
Encryption操作
0 ~& E4 Q" F5 x0 @8 w- ?) g+ Rencryption-type-create. N3 g5 y0 }  F& i( W/ {
    Creates encryption type for a volume type. Admin only.% z: k; ], j0 t9 v/ @( ~0 a9 G
encryption-type-delete
0 J  G4 ~8 n) N" A; n, R' a. _    Deletes encryption type for a volume type. Admin only.
% S# w+ Z3 l0 i5 yencryption-type-list+ n. c9 M6 v0 T8 o) y. a
    Shows encryption type details for volume types. Admin only.) x8 D2 Y0 L( C2 S  ~5 e1 z
encryption-type-show: ^" q( v/ U& Q! n; ~/ C1 @6 \
    Shows encryption type details for volume type. Admin only.% a- M/ B1 _3 \$ e. ?

% j( @$ m! p: n. E& ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 02:05 , Processed in 0.028360 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表