基于本地存储LVM新建虚机方案

Posted 抛物线.

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于本地存储LVM新建虚机方案相关的知识,希望对你有一定的参考价值。

文章目录

基于本地存储LVM新建虚机方案

date: 2021/12/22
auth: mmwei3

一、环境信息如下:

IP角色VGS
192.168.162.123控制+计算+存储cinder-volumes、cinder-volumes-ssd
192.168.162.124控制+计算+存储cinder-volumes、cinder-volumes-ssd
192.168.162.125控制+计算+存储cinder-volumes、cinder-volumes-ssd

二、需求方案:

1、虚机(卷启动)+系统盘+数据盘 三者在同一计算节点。
2、虚机可以挂本计算节点的数据盘也可以挂载其他计算节点的数据盘。
3、虚机可以使用本节点上的HDD做系统盘及云盘,也可以使用本节点上的SSD做系统盘及云盘
4、虚机(本地)+数据盘 三者在同一计算节点。
5、虚机冷迁移方案

三、环境部署部分说明

 参考官方文档:
 https://docs.openstack.org/mitaka/config-reference/block-storage/drivers/lvm-volume-driver.html
 https://docs.openstack.org/cinder/latest/admin/blockstorage-lio-iscsi-support.html
1、每个节点新建两个vg:cinder-volumes、cinder-volumes-ssd

# 001节点
[root@rg2-test-control001 ~]# vgs
  VG                 #PV #LV #SN Attr   VSize   VFree
  cinder-volumes       1   4   0 wz--n-  <3.64t  <3.30t
  cinder-volumes-ssd   2   0   0 wz--n- 278.24g 278.24g

# 002节点
[root@rg2-test-control002 ~]# vgs
  VG                 #PV #LV #SN Attr   VSize   VFree
  cinder-volumes       1   1   0 wz--n-  <3.64t  <3.59t
  cinder-volumes-ssd   2   0   0 wz--n- 278.24g 278.24g

# 003节点
[root@rg2-test-control003 ~]# vgs
  VG                 #PV #LV #SN Attr   VSize   VFree
  cinder-volumes       1   1   0 wz--n-  <3.64t  <3.59t
  cinder-volumes-ssd   2   2   0 wz--n- 278.24g 258.24g

2、修改相关配置文件 (解决方案一)
参考官方文档:
https://docs.openstack.org/kilo/config-reference/content/section_cinder.conf.html
https://docs.openstack.org/mitaka/config-reference/compute/iscsi-offload.html
https://docs.openstack.org/cinder/latest/admin/ts-cinder-config.html
https://docs.openstack.org/cinder/latest/admin/blockstorage-multi-backend.html
① 修改cinder-volume、cinder-api、cinder-scheduler配置
# 三个节点均需修改(或者说cinder-volume节点所在节点都修改)
# 为了保持统一cinder-api、cinder-scheduler、cinder-volume三者均修改

# iSCSI target user-land tool to use. tgtadm is default, use
# lioadm for LIO iSCSI support, scstadmin for SCST target
# support, iseradm for the ISER protocol, ietadm for iSCSI
# Enterprise Target, iscsictl for Chelsio iSCSI Target or fake
# for testing. (string value)
#iscsi_helper=tgtadm

# Method used to wipe old volumes (string value)
#volume_clear=zero
 
# Size in MiB to wipe at start of old volumes. 0 => all
# (integer value)
#volume_clear_size=0



[root@rg2-test-control003 ~]# cat /etc/kolla/cinder-volume/cinder.conf|egrep -w 'enabled_backends|default_volume_type'
enabled_backends = lvm,lvm-ssd
default_volume_type = lvm

[root@rg2-test-control003 ~]# cat /etc/kolla/cinder-volume/cinder.conf  | grep 'storage_availability_zone'
storage_availability_zone = rg2-test-control003.ostack.hfb3.iflytek.net (cinder-volume节点的主机名, 即myhostname)

[root@rg2-test-control003 ~]# cat /etc/kolla/cinder-volume/cinder.conf  | egrep  -w '\\[lvm\\]' -A 30
[lvm]
volume_backend_name = lvm
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes1
iscsi_protocol = iscsi
#iscsi_helper = lioadm   #这里不适用lioadm,使用默认的配置 #iscsi_helper=tgtadm,可以不写
volume_clear = zero

[lvm-ssd]
volume_backend_name = lvm-ssd
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes-ssd
iscsi_protocol = iscsi
#iscsi_helper = lioadm
volume_clear = zero

[root@rg2-test-control003 ~]#


② 修改glance-api配置
参考官方文档:https://docs.openstack.org/glance/pike/install/install-rdo.html
# 三个节点均需修改(或者说glance-api节点所在节点都修改)
[root@rg2-test-control003 ~]# cat /etc/kolla/glance-api/glance-api.conf| grep '\\[glance_store\\]' -A 10
[glance_store]
#default_store = rbd
#filesystem_store_datadir = /var/lib/glance/images/
#stores = rbd
#rbd_store_user = glance
#rbd_store_pool = images
#rbd_store_ceph_conf = /etc/ceph/ceph.conf
#rbd_volume_pool = sata_pool
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
stores = file

② 修改nova-compute配置
[root@rg2-test-control003 ~]# cat /etc/kolla/nova-compute/nova.conf  | grep '\\[libvirt\\]' -A 10
[libvirt]
connection_uri = qemu+tcp://192.168.162.125/system
#images_rbd_pool = vms
#images_type = rbd
#images_rbd_ceph_conf = /etc/ceph/ceph.conf
#rbd_user = nova
#rbd_secret_uuid = df5fbfad-02c7-43b2-9938-900c80d6bc99
images_type = lvm
images_volume_group=cinder-volumes1

3、修改相关配置文件 (解决方案二)
参考官方文档:
https://docs.openstack.org/cinder/pike/scheduler-filters.html
https://github.com/openstack/cinder/blob/master/cinder/scheduler/filters/instance_locality_filter.py
https://opendev.org/openstack/cinder/src/commit/40a6fff6d408f2ef0317c08fb165cc75a92c380a/setup.cfg
https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/14/html/
openstack_data_processing/instancelocality
https://specs.openstack.org/openstack/sahara-specs/specs/kilo/volume-instance-locality.html
# 在方案一的基础上新增如下配置
# 该配置可以尝试使我们的虚机实例和系统盘在同一个节点上创建
[root@rg2-test-control003 ~]# cat /etc/kolla/cinder-scheduler/cinder.conf  | grep scheduler_default_filters -A 3
scheduler_default_filters=AvailabilityZoneFilter,CapacityFilter,CapabilitiesFilter,InstanceLocalityFilter
volume_local_to_instance = True # value for true or false 


四、运行相关容器
# iscsi-initiator-utils  scsi-target-utils.x86_64 
# cinder-volume容器挂载一下-v iscsi_info:/etc/iscsi  nova-compute也挂在一下

cat /etc/kolla/iscsid/config.json 

    "command": "iscsid -d 8 -f --pid=/run/iscsid.pid",
    "config_files": []

cat /etc/kolla/tgtd/config.json 


    "command": "tgtd -d 1 -f --iscsi portal=192.168.162.123:3260",
    "config_files": []


# nova_compute
docker run \\
-d --tty=true --net=host --restart=always \\
--privileged \\
--name=nova_compute \\
-e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS \\
-e KOLLA_SERVICE_NAME=nova-compute \\
-v /etc/kolla/nova-compute/:/var/lib/kolla/config_files/:ro \\
-v /etc/localtime:/etc/localtime:ro \\
-v /lib/modules:/lib/modules:ro \\
-v /run:/run:shared \\
-v /dev:/dev \\
-v kolla_logs:/var/log/kolla/ \\
-v libvirtd:/var/lib/libvirt \\
-v nova_compute:/var/lib/nova/ \\
-v iscsi_info:/etc/iscsi \\
mmwei.com/lokolla/centos-source-nova-compute:15.0.6-ccr-1.1.3-priv.7-2

#cinder_volume
docker run \\
-d --tty=true --net=host --restart=always \\
--privileged \\
--ipc=host \\
--name=cinder_volume \\
-e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS  \\
-v /etc/localtime:/etc/localtime:ro \\
-v kolla_logs:/var/log/kolla/:rw \\
-v /dev/:/dev/ \\
-v /lib/modules:/lib/modules:ro \\
-v /run/:/run/:shared \\
-v cinder:/var/lib/cinder \\
-v iscsi_info:/etc/iscsi \\
-v /etc/kolla/cinder-volume/:/var/lib/kolla/config_files/:ro \\
mmwei.com/lokolla/centos-source-cinder-volume:10.0.3-ccr-1.0.6


docker run \\
-d --tty=true --net=host --restart=always \\
--name=cinder_api \\
-e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS  \\
-v /etc/localtime:/etc/localtime:ro \\
-v kolla_logs:/var/log/kolla/:rw \\
-v /etc/kolla/cinder-api/:/var/lib/kolla/config_files/:ro \\
mmwei.com/lokolla/centos-source-cinder-api:10.0.3-ccr-1.0.6



docker run \\
-d --tty=true --net=host --restart=always \\
--name=cinder_scheduler \\
-e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS  \\
-v /etc/localtime:/etc/localtime:ro \\
-v kolla_logs:/var/log/kolla/:rw \\
-v /etc/kolla/cinder-scheduler/:/var/lib/kolla/config_files/:ro \\
mmwei.com/lokolla/centos-source-cinder-scheduler:10.0.3-ccr-1.0.6


mmwei.com/lokolla/centos-source-cinder-volume:10.0.3-ccr-1.0.8


# iscsi-tgtd
docker run -d --tty=true --net=host --restart=always \\
--privileged \\
--ipc=host \\
--name=tgtd \\
-e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS \\
-e KOLLA_SERVICE_NAME=tgtd \\
-v /etc/kolla/tgtd/:/var/lib/kolla/config_files/:ro \\
-v kolla_logs:/var/log/kolla/ 
-v /etc/localtime:/etc/localtime:ro \\
-v /dev:/dev \\
-v /run:/run:shared \\
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \\
 -v /lib/modules:/lib/modules:ro \\
 -v /sys/kernel/config:/configfs \\
 -v iscsi_info:/etc/iscsi \\
 mmwei.com/lokolla/centos-source-tgtd:train-1


# iscsid
docker run -d --tty=true --net=host --restart=always \\
--privileged \\
--ipc=host \\
--name=iscsid \\
-e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS \\
-e KOLLA_SERVICE_NAME=iscsid \\
-v /etc/kolla/iscsid/:/var/lib/kolla/config_files/:ro \\
-v kolla_logs:/var/log/kolla/ \\
-v /etc/localtime:/etc/localtime:ro \\
-v /dev:/dev \\
-v /run:/run:shared \\
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \\
-v /lib/modules:/lib/modules:ro \\
-v /sys/kernel/config:/configfs \\
-v iscsi_info:/etc/iscsi \\
mmwei.com/lokolla/centos-source-iscsid:train-v1


五、验证方案
1、虚机(卷启动)+系统盘+数据盘 三者在同一计算节点。
① 上传镜像
[root@rg2-test-control001 ~]# glance image-create    
--disk-format raw \\
--container-format bare \\
--file /root/mmwei3/Centos-7.4.raw  \\
--property  hw_qemu_guest_agent=yes \\
--name Centos-7.4-lvm \\
--visibility public \\
--progress

② 新建主机聚合
# 先查看服务状态 是否正常,zone是否生效
[root@rg2-test-control001 ~]# openstack volume service list  -c Binary -c  Host -c Zone
+-----------------+----------------------------------------------------+---------------------------------------------+
| Binary          | Host                                               | Zone                                        |
+-----------------+----------------------------------------------------+---------------------------------------------+
| cinder-scheduler| rg2-test-control002.ostack.hfb3.iflytek.net        | nova                                        |
| cinder-scheduler| rg2-test-control003.ostack.hfb3.iflytek.net        | nova                                        |
| cinder-scheduler| rg2-test-control001.ostack.hfb3.iflytek.net        | nova                                        |
| cinder-volume   | rg2-test-control001.ostack.hfb3.iflytek.net@lvm    | nova                                        |
| cinder-volume   | rg2-test-control003.ostack.hfb3.iflytek.net@lvm    | rg2-test-control003.ostack.hfb3.iflytek.net |
| cinder-volume   | rg2-test-control002.ostack.hfb3.iflytek.net@lvm    | rg2-test-control002.ostack.hfb3.iflytek.net |
| cinder-volume   | rbd:sata@rbd-sata                                  | nova                                        |
| cinder-volume   | rg2-test-control003.ostack.hfb3.iflytek.net@lvm-ssd| rg2-test-control003.ostack.hfb3.iflytek.net |
+-----------------+----------------------------------------------------+---------------------------------------------+

[root@rg2-test-control001 ~]# nova  aggregate-create
usage: nova aggregate-create <name> [<availability-zone>]

[root@rg2-test-control001 ~]# nova  aggregate-create normal
[root@rg2-test-control001 ~]# nova  aggregate-create lvm
[root@rg2-test-control001 ~]# nova  aggregate-create lvm2

# 加入聚合
[root@rg2-test-control001 ~]# nova   aggregate-add-host
usage: nova aggregate-add-host <aggregate> <host>
[root@rg2-test-control001 ~]# nova   aggregate-add-host normal rg2-test-control001.ostack.hfb3.iflytek.net
[root@rg2-test-control001 ~]# nova   aggregate-add-host lvm rg2-test-control002.ostack.hfb3.iflytek.net
[root@rg2-test-control001 ~]# nova   aggregate-add-host lvm2 rg2-test-control003.ostack.hfb3.iflytek.net

[root@rg2-test-control001 ~]# nova  aggregate-list
+----+--------+---------------------------------------------+--------------------------------------+
| Id | Name   | Availability Zone                           | UUID                                 |
+----+--------+---------------------------------------------+--------------------------------------+
| 1  | normal | nova                                        | e1b4ddac-957f-49a8-ac08-0054a33edc3d |
| 9  | lvm    | rg2-test-control002.ostack.hfb3.iflytek.net | 1beb7c26-a49e-4bdc-8469-c844c8dac756 |
| 11 | lvm2   | rg2-test-control003.ostack.hfb3.iflytek.net | 1ba48e46-6443-4557-9098-1bff0e0edb0f |
+----+--------+---------------------------------------------+--------------------------------------+
③ 新建卷类型
[root@rg2-test-control001 ~]# openstack volume type create --public --property volume_backend_name='lvm-ssd' lvm-ssd
[root@rg2-test-control001 ~]# openstack volume type create --public --property volume_backend_name='lvm' lvm
[root@rg2-test-control001 ~]# openstack volume type list
+--------------------------------------+---------+-----------+
| ID                                   | Name    | Is Public |
+--------------------------------------+---------+-----------+
| a2a42521-ab9c-42aa-b15a-2af147ce03d2 | lvm-ssd | True      |
| 96a28f6a-c3b6-43fc-bd99-887daa579663 | lvm     | True      |
+--------------------------------------+---------+-----------+
[root@rg2-test-control001 ~]# openstack volume type show  a2a42521-ab9c-42aa-b15a-2af147ce03d2
+--------------------+--------------------------------------+
| Field              | Value                                |
+--------------------+--------------------------------------+
| access_project_ids | None                                 |
| description        | None                                 |
| id                 | a2a42521-ab9c-42aa-b15a-2af147ce03d2 |
| is_public          | True                                 |
| name               | lvm-ssd                              |
| properties         | volume_backend_name='lvm-ssd'        |
| qos_specs_id       | None                                 |
+--------------------+--------------------------------------+

[root@rg2-test-control001 ~]# openstack volume type show   96a28f6a-c3b6-43fc-bd99-887daa579663
+--------------------+--------------------------------------+
| Field              | Value                                |
+--------------------+--------------------------------------+
| access_project_ids | None                                 |
| description        | None                                 |
| id                 | 96a28f6a-c3b6-43fc-bd99-887daa579663 |
| is_public          | True                                 |
| name               | lvm                                  |
| properties         | volume_backend_name='lvm'            |
| qos_specs_id       | None                                 |
+--------------------+--------------------------------------+
④ 新建卷及云盘
# 1、从镜像创建卷(作为系统盘),指定availability-zone
[root@rg2-test-control001 ~]# openstack volume create    \\ 
--image 2e3c5301-e2ed-4357-884e-f28ad0428690 --size 100   \\
--type lvm --availability-zone rg2-test-control002.ostack.hfb3.iflytek.net \\
    vol-zone2-os1

+---------------------+---------------------------------------------+
| Field               | Value                                       |
+---------------------+---------------------------------------------+
| attachments         | []                                          |
| availability_zone   | rg2-test-control002.ostack.hfb3.iflytek.net |
| bootable            | false                                       |
| consistencygroup_id | None                                        |
| created_at          | 2021-12-23T03:49:10.027995                  |
| description         | None                                        |
| encrypted           | False                                       |
| id                  | 76a5ef99-2888-4fb9-99f0-8b3a23e4854b        |
| migration_status    | None                                        |
| multiattach         | False                                       |
| name                | vol-zone2-os1                               |
| properties          |                                             |
| replication_status  | None                                        |
| size                | 100                                         |
| snapshot_id         | None                                        |
| source_volid        | None                                        |
| status              | creating                                    |
| type                | lvm                                         |
| updated_at          | None                                        |
| user_id             | 96f12fa88f0e4bb29123dd33021307ad            |
+---------------------+---------------------------------------------+

### 时间问题 耗时约1分钟
相关日志
[root@rg2-test-control00 ~]# tail -f /var/lib/docker/volumes/kolla_logs/_data/cinder/cinder-volume.log

2021-12-23 10:25:29.012 31 INFO cinder.volume.flows.manager.create_volume\\
 [req-5b949e95-bf05-4065-8423-b9e5496d9e09 96f12fa88f0e4bb29123dd33021307ad \\
 dd94c9e5d29048b68b56131a0d6ea2ba - default default] \\
 Volume 1661215d-1302-4065-8e80-7f3e29591742: being created as image with specification:\\
 'status': u'creating', 'image_location': (u'file:///var/lib/glance/images/2e3c5301-e2ed-4357-884e-f28ad0428690',\\
 [u'url': u'file:///var/lib/glance/images/2e3c5301-e2ed-4357-884e-f28ad0428690', u'metadata': ]),\\
 'volume_size': 100, 'volume_name': 'volume-1661215d-1302-4065-8e80-7f3e29591742', \\
 'image_id': '2e3c5301-e2ed-4357-884e-f28ad0428690', 'image_service': \\
 <cinder.image.glance.GlanceImageService object at 0x7fb5f0d09a50>, \\
 'image_meta': u'status': u'active', u'file': u'/v2/images/2e3c5301-e2ed-4357-884e-f28ad0428690/file',\\
 u'virtual_size': None, u'name': u'Centos-7.4-lvm', u'tags': [], \\
 u'container_format': u'bare', u'created_at': datetime.datetime(2021, 12, 20, 14, 21, 13, tzinfo=<iso8601.Utc>),\\
 u'disk_format': u'raw',\\
 u'locations': [u'url': u'file:///var/lib/glance/images/2e3c5301-e2ed-4357-884e-f28ad0428690', u'metadata': ], \\
 u'visibility': u'public', u'updated_at': datetime.datetime(2021, 12, 20, 14, 21, 37, tzinfo=<iso8601.Utc>), \\
 u'owner': u'dd94c9e5d29048b68b56131a0d6ea2ba', u'protected': False, u'id': u'2e3c5301-e2ed-4357-884e-f28ad0428690', \\
 u'min_ram': 0, u'checksum': u'afcb6cdfb41dd41343c122915c741026',\\
 u'min_disk': 0, u'direct_url': u'file:///var/lib/glance/images/2e3c5301-e2ed-4357-884e-f28ad0428690',\\
'properties': u'hw_qemu_guest_agent': u'yes', u'size': 5368709120
2021-12-23 10:25:52.487 31 INFO cinder.image.image_utils \\
[req-5b949e95-bf05-4065-8423-b9e5496d9e09 96f12fa88f0e4bb29123dd33021307ad\\
 dd94c9e5d29048b68b56131a0d6ea2ba - default default] Image download 5120.00 MB at 218.14 MB/s

2021-12-23 10:26:31.357 31 INFO cinder.image.image_utils\\
 [req-5b949e95-bf05-4065-8423-b9e5496d9e09 96f12fa88f0e4bb29123dd33021307ad \\
 dd94c9e5d29048b68b56131a0d6ea2ba - default default] Converted 5120.00 MB image at 172.83 MB/s \\
2021-12-23 10:26:33.556 31 INFO cinder.volume.flows.manager.create_volume \\
 [req-5b949e95-bf05-4065-8423-b9e5496d9e09 96f12fa88f0e4bb29123dd33021307ad \\ 
 dd94c9e5d29048b68b56131a0d6ea2ba - default default]  \\
 Volume volume-1661215d-1302-4065-8e80-7f3e29591742 (1661215d-1302-4065-8e80-7f3e29591742): \\
  created successfully \\
2021-12-23 10:26:33.561 31 INFO cinder.volume.manager  \\
[req-5b949e95-bf05-4065-8423-b9e5496d9e09 96f12fa88f0e4bb29123dd33021307ad  \\
dd94c9e5d29048b68b56131a0d6ea2ba - default default] Created volume successfully. 



# 2、 新建空白卷 耗时秒级 5s以内
[root@rg2-test-control001 ~]#  openstack volume create \\
--size 8  --availability-zone rg2-test-control002.ostack.hfb3.iflytek.net \\
  test-volume-vdb
+---------------------+---------------------------------------------+
| Field               | Value                                       |
+---------------------+---------------------------------------------+
| attachments         | []                                          |
| availability_zone   | rg2-test-control002.ostack.hfb3.iflytek.net |
| bootable            | false                                       |
| consistencygroup_id | None                                        |
| created_at          | 2021-12-23T03:50:53.717870                  |
| description         | None                                        |
| encrypted           | False                                       |
| id                  | e56a2896-5f59-4789-8ff6-f272683ffbfa        |
| migration_status    | None                                        |
| multiattach         | False                                       |
| name                | test-volume-vdb                             |
| properties          |                                             |
| replication_status  | None                                        |
| size                | 8                                           |
| snapshot_id         | None                                        |
| source_volid        | None                                        |
| status              | creating                                    |
| type                | lvm                                         |
| updated_at          | None                                        |
| user_id             | 96f12fa88f0e4bb29123dd33021307ad            |
+---------------------+---------------------------------------------+

# 3、 新建虚机
[root@rg2-test-control001 ~]# openstack flavor list
+--------------------------------------+------------+------+------+-----------+-------+-----------+
| ID                                   | Name       |  RAM | Disk | Ephemeral | VCPUs | Is Public |
+--------------------------------------+------------+------+------+-----------+-------+-----------+
| 4bea2583-f630-430a-95cf-4665414f8a78 | t4.4medium | 4096 |   50 |         0 |     4 | True      |
+--------------------------------------+------------+------+------+-----------+-------+-----------+
[root@rg2-test-control001 ~]# openstack network list
+--------------------------------------+-----------------------+--------------------------------------+
| ID                                   | Name                  | Subnets                              |
+--------------------------------------+-----------------------+--------------------------------------+
| bd23d0fd-e513-4f4e-a901-ef01b0476f43 | Classical_Network_163 | 1a5aefa9-aa0d-40e7-af4e-78d34f146346 |
+--------------------------------------+-----------------------+--------------------------------------+

# 这种启动方式 可以保证虚机qemu进程及系统盘、数据盘三者都在同一台机器上
[root@rg2-test-control001 ~]# nova boot --flavor 4bea2583-f630-430a-95cf-4665414f8a78 \\
--boot-volume 76a5ef99-2888-4fb9-99f0-8b3a23e4854b \\
--block-device source=volume,id=e56a2896-5f59-4789-8ff6-f272683ffbfa,dest=volume,shutdown=preserve \\
--nic net-id=bd23d0fd-e513-4f4e-a901-ef01b0476f43   \\
--availability-zone rg2-test-control002.ostack.hfb3.iflytek.net \\
 test-zone2-1

# 如果不需要数据盘则:
[root@rg2-test-control001 ~]# nova boot --flavor 4bea2583-f630-430a-95cf-4665414f8a78 \\
--boot-volume 76a5ef99-2888-4fb9-99f0-8b3a23e4854b \\
--nic net-id=bd23d0fd-e513-4f4e-a901-ef01b0476f43   \\
--availability-zone rg2-test-control002.ostack.hfb3.iflytek.net \\
 test-zone2-1


#######------------------------------如果采用方案二 加入 InstanceLocalityFilter 过滤器--------------
# 此方案适用于新建虚机不建数据盘或者数据盘在其他节点或者其他存储池
# 且volume_local_to_instance = True 则新建虚机时不需要指定zone,新建系统盘时 也不需要指定zone
# 但是新建数据盘需要指定zone 
# 如果新建虚机不加数据盘则直接新建便可
[root@rg2-test-control001 ~]# openstack volume create    \\ 
--image 2e3c5301-e2ed-4357-884e-f28ad0428690 --size 100   \\
--type lvm  vol-zone2-os1   

[root@rg2-test-control001 ~]# nova boot --flavor 4bea2583-f630-430a-95cf-4665414f8a78 \\
--boot-volume 76a5ef99-2888-4fb9-99f0-8b3a23e4854b \\
--nic net-id=bd23d0fd-e513-4f4e-a901

以上是关于基于本地存储LVM新建虚机方案的主要内容,如果未能解决你的问题,请参考以下文章

基于本地存储LVM新建虚机方案

云主机磁盘存储动态扩容(LVM)方案

rac ORA-001157 数据文件误创 本地盘 共享存储 ASM cannot identify/lock data file

我应该如何构建一个无限大小的本地存储?

AIX小机lvm信息丢失数据恢复方案

基于阿里云的块存储介绍