1:在cinder中裸磁盘通常为卷,所以就是对于卷的管理,创建,删除,更改之类的操作
一:volume管理
cinder来操作
1:创建卷
格式:
cinder create --name volume1 --description "new volume" --volume-type size c
创建了一个大小为2G的卷
[root@controller /]# cinder create --name volume1 --availabilitye nova 2
2:卷更新
1:重命名
格式:
cinder rename 旧卷名 新卷名
将volume1更改为test1
[root@controller /]# cinder rename volume1 test1 查看卷 [root@controller /]# cinder list +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ | ID | Status | Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ | 656460cf-1d1d-4fbb-81e1-d34e065ab340 | available | test1 | 2 | __DEFAULT__ | false | | +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ [root@controller /]#
2:修改状态
可修改的状态有以下几种
available,error,createing,deleting,in-use,attaching,detaching ,error_deleting,maintenance
附加的状态:atached,detached,默认状态为none
格式:
cinder reset-state --state 状态 卷名
将test1的状态改为deleting的状态
[root@controller /]# cinder reset-state --state deleting test1 [root@controller /]# cinder list +--------------------------------------+----------+-------+------+-------------+----------+-------------+ | ID | Status | Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+----------+-------+------+-------------+----------+-------------+ | 656460cf-1d1d-4fbb-81e1-d34e065ab340 | deleting | test1 | 2 | __DEFAULT__ | false | | +--------------------------------------+----------+-------+------+-------------+----------+-------------+ [root@controller /]#
3:修改类型
修改类型之前这个卷的状态必须是available状态才能修改卷的类型
先将之前的test1的状态修改成可用的
[root@controller /]# cinder reset-state --state available test1 [root@controller /]# cinder list +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ | ID | Status | Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ | 656460cf-1d1d-4fbb-81e1-d34e065ab340 | available | test1 | 2 | __DEFAULT__ | false | | +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ [root@controller /]#
成功将状态修改成available的状态
格式:
cinder retype 卷名 卷的类型
将test1的卷类型修改成lvm类型
[root@controller /]# cinder list +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ | ID | Status | Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ | 656460cf-1d1d-4fbb-81e1-d34e065ab340 | available | test1 | 2 | __DEFAULT__ | false | | +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ [root@controller /]# cinder type-list +--------------------------------------+-------------+---------------------+-----------+ | ID | Name | Description | Is_Public | +--------------------------------------+-------------+---------------------+-----------+ | 28550d3d-30cd-4c52-8d1a-c135ec2eee7f | __DEFAULT__ | Default Volume Type | True | | 6d590030-c967-4590-ac5f-9fc0cb72e7e4 | lvm | - | True | +--------------------------------------+-------------+---------------------+-----------+ [root@controller /]# cinder retype test1 6d590030-c967-4590-ac5f-9fc0cb72e7e4 [root@controller /]# cinder list +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ | ID | Status | Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ | 656460cf-1d1d-4fbb-81e1-d34e065ab340 | available | test1 | 2 | lvm | false | | +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ [root@controller /]#
4:扩容的操作
可以从小改到大,但是不能从大改成小
格式:
cinder extend 卷名 size
将test1的空间增加到5
[root@controller /]# cinder extend test1 5 [root@controller /]# cinder list +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ | ID | Status | Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ | 656460cf-1d1d-4fbb-81e1-d34e065ab340 | available | test1 | 5 | lvm | false | | +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ [root@controller /]#
5:迁移
就是移动到特定的主机上面
二:type类型的管理
类型管理的语句
type-create 类型的创建 type-default 类型默认 type-delete 类型删除 type-key type-list 类型列表的查看 type-show 类型详情的查看 type-update 类型的更新
1:查看类型和创建类型
查看类型 [root@controller /]# cinder type-list +--------------------------------------+-------------+---------------------+-----------+ | ID | Name | Description | Is_Public | +--------------------------------------+-------------+---------------------+-----------+ | 28550d3d-30cd-4c52-8d1a-c135ec2eee7f | __DEFAULT__ | Default Volume Type | True | | 46067585-3e65-4802-927b-b3cd80aaa6ce | none | - | True | | 6d590030-c967-4590-ac5f-9fc0cb72e7e4 | lvm | - | True | +--------------------------------------+-------------+---------------------+-----------+ [root@controller /]# 创建类型 [root@controller /]# cinder type-create qqq +--------------------------------------+------+-------------+-----------+ | ID | Name | Description | Is_Public | +--------------------------------------+------+-------------+-----------+ | 1c7ba5f4-764e-4295-9a99-09aa69fabcf5 | qqq | - | True | +--------------------------------------+------+-------------+-----------+ [root@controller /]#
2:删除类型,必须使用id来删除
[root@controller /]# cinder type-list +--------------------------------------+-------------+---------------------+-----------+ | ID | Name | Description | Is_Public | +--------------------------------------+-------------+---------------------+-----------+ | 28550d3d-30cd-4c52-8d1a-c135ec2eee7f | __DEFAULT__ | Default Volume Type | True | | 46067585-3e65-4802-927b-b3cd80aaa6ce | none | - | True | | 6d590030-c967-4590-ac5f-9fc0cb72e7e4 | lvm | - | True | +--------------------------------------+-------------+---------------------+-----------+ [root@controller /]# cinder type-delete 46067585-3e65-4802-927b-b3cd80aaa6ce Request to delete volume type 46067585-3e65-4802-927b-b3cd80aaa6ce has been accepted. [root@controller /]# cinder type-list +--------------------------------------+-------------+---------------------+-----------+ | ID | Name | Description | Is_Public | +--------------------------------------+-------------+---------------------+-----------+ | 28550d3d-30cd-4c52-8d1a-c135ec2eee7f | __DEFAULT__ | Default Volume Type | True | | 6d590030-c967-4590-ac5f-9fc0cb72e7e4 | lvm | - | True | +--------------------------------------+-------------+---------------------+-----------+ [root@controller /]#
3:修改类型
主要修改卷类型的名字,卷的描述,这个类型是否公共的
格式:
cinder type-update 类型 --name --description
将lvm这个类型名字改为none这个名字
[root@controller /]# cinder type-update 6d590030-c967-4590-ac5f-9fc0cb72e7e4 --name none +--------------------------------------+------+-------------+-----------+ | ID | Name | Description | Is_Public | +--------------------------------------+------+-------------+-----------+ | 6d590030-c967-4590-ac5f-9fc0cb72e7e4 | none | - | True | +--------------------------------------+------+-------------+-----------+ [root@controller /]# cinder list +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ | ID | Status | Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ | 656460cf-1d1d-4fbb-81e1-d34e065ab340 | available | test1 | 5 | none | false | | +--------------------------------------+-----------+-------+------+-------------+----------+-------------+ [root@controller /]#
标签:test1,+--------------------------------------+-----------+-------+------+------- From: https://www.cnblogs.com/qm77/p/17879278.html