迁移(migrate)volume
$ cinder migrate volumeID destinationHost –force-host-copy=True|False
destinationHost目标主机
–force-host-copy 强制迁移
创建(create)volume
只创建volume
$ cinder create –display-name myvo1 10
myvo1是创建完毕后显示名称
10是创建volume大小为10GB
创建一个附带镜像的volume,下次启动instance可以从此volume直接启动
$ cinder create 10 –display-name mybootvolume –image-id $image_id
10volume大小不能小于image最小限制大小;
给instance添加volumes(相当于给instance添加了一块硬盘)
$ nova volume-attach $instance_ID $volumes_ID /dev/vdb
/dev/vdb 这个是挂载到instance的那个设备下,想使用此空间需进行分区格式化,及再挂载。
提示:设置开机自动挂载!
查看volume
$ cinder show $volume_ID
更改(resize)volume大小:
注意:如已挂载到instance上,需要先卸载掉;
$ nova volume-detach $instance_ID $volume_ID$ cinder extend $volume_ID 20
20是你新给volume设置的大小;
删除(delete)volume
$ cinder delete $volume_ID
转移(transfer)volumes
由管理员创建一个transfer-volume,可以提供给其它用户使用;
transfer-volume通过cinder transfer*等命令来实现,由admin贡献一个大容量的volume出来,然后通过created_id和key_id来授权这个volume;
创建一个volume transfer request(请求)
先查看一个admin提供的是volume是那个;
$ cinder list$ cinder transfer-create $volume_id
可以附加此选项添加名称:–display_name mytrvolume
+------------+--------------------------------------+| Property | Value |+------------+--------------------------------------+| auth_key | f4f2af3413c661e4 || created_at | 2013-12-27T02:23:08.679777 || id | 6df5c9d8-7f27-4846-88f6-a30b287040dd || name | None || volume_id | 548a428a-439b-4191-b679-c58f227ad4e0 |+------------+--------------------------------------+
!!!注意auth_key和id这2个字段
$ cinder list| 548a428a-439b-4191-b679-c58f227ad4e0 | awaiting-transfer | myvo5 |20| None | false |
备注awaiting-transfer等待转移
$ cinder transfer-list
+--------------------------+-----------+--------------------------------------+------+
| ID | | Volume ID | Name |
+--------------------------+--------------------------------------------------+------+
| 6df5c9d8-7f27-4846-88f6-a30b287040dd | 548a428a-439b-4191-b679-c58f227ad4e0 | None |
+--------------------------+-----------+--------------------------------------+------+
$ cinder transfer-show $transfer-volumes-id
授权volume可以转移
$ cinder transfer-accept $transfer-volume-id $key-id# cinder transfer-accept 6df5c9d8-7f27-4846-88f6-a30b287040dd f4f2af3413c661e4
+-----------+--------------------------------------+
| Property | Value |
+-----------+--------------------------------------+
| id | 6df5c9d8-7f27-4846-88f6-a30b287040dd |
| name | None |
| volume_id | 548a428a-439b-4191-b679-c58f227ad4e0 |
+-----------+--------------------------------------+
+-----------+--------------------------------------+
| Property | Value |
+-----------+--------------------------------------+
| id | 6df5c9d8-7f27-4846-88f6-a30b287040dd |
| name | None |
| volume_id | 548a428a-439b-4191-b679-c58f227ad4e0 |
+-----------+--------------------------------------+
删除transfer-volume
$ cinder ttansfer-delete $transfer-volume-id
对比一下transfer-volume和普通volume有什么区别:
| metadata | {} |
================================================
| metadata | {u‘readonly‘: u‘False‘}
openstack cinder manager volumes