前置条件
- HBlock服务已经正确配置,且可以正常启动。
- 正确安装OpenStack,支持的OpenStack版本详见环境要求。
- 正确安装OpenStack的接入插件,且功能正常。
使用方法
以镜像为源创建的HBlock卷test为例。
-
卷查询。
[root@server devstack]# cinder list +--------------------------------------+-----------+------+------+-------------+----------+-------------+ | ID | Status | Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+-----------+------+------+-------------+----------+-------------+ | 0be87b9f-f1aa-429f-af81-75795dae2de8 | available | 1 | 1 | iscsi | false | | | c4e8af38-2b4f-48a2-9f54-6cf4c8f26806 | available | test | 1 | stor1 | true | | | efb3b49a-c06f-44d5-937e-9fa1370a2785 | available | 6 | 1 | stor1 | false | | +--------------------------------------+-----------+------+------+-------------+----------+-------------+
-
flavor查询。
[root@server devstack]# nova flavor-list +----+-----------+------------+------+-----------+------+-------+-------------+-----------+-------------+ | ID | Name | Memory_MiB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | Description | +----+-----------+------------+------+-----------+------+-------+-------------+-----------+-------------+ | 1 | m1.tiny | 512 | 1 | 0 | 0 | 1 | 1.0 | True | - | | 2 | m1.small | 2048 | 20 | 0 | 0 | 1 | 1.0 | True | - | | 3 | m1.medium | 4096 | 40 | 0 | 0 | 2 | 1.0 | True | - | | 4 | m1.large | 8192 | 80 | 0 | 0 | 4 | 1.0 | True | - | | 5 | m1.xlarge | 16384 | 160 | 0 | 0 | 8 | 1.0 | True | - | +----+-----------+------------+------+-----------+------+-------+-------------+-----------+-------------+
-
image查询。
[root@server devstack]# glance image-list +--------------------------------------+------------+ | ID | Name | +--------------------------------------+------------+ | 7a1586ec-f9a3-4be5-921c-565136d9573b | cmdUbuntu1 | +--------------------------------------+------------+
-
net-id查询。
[root@server devstack]# openstack network list +--------------------------------------+------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+------+--------------------------------------+ | 53dced88-bc11-462d-878c-50373d45e7d4 | net1 | 216fe08b-973e-4779-971c-e81a7dbba0f5 | +--------------------------------------+------+--------------------------------------+
-
使用命令行创建虚拟机实例。
[root@server devstack]# openstack server create --flavor m1.small --nic net-id=net1 --volume test test-instance8 +-------------------------------------+--------------------------------------+ | Field | Value | +-------------------------------------+--------------------------------------+ | OS-DCF:diskConfig | MANUAL | | OS-EXT-AZ:availability_zone | | | OS-EXT-SRV-ATTR:host | None | | OS-EXT-SRV-ATTR:hypervisor_hostname | None | | OS-EXT-SRV-ATTR:instance_name | | | OS-EXT-STS:power_state | NOSTATE | | OS-EXT-STS:task_state | scheduling | | OS-EXT-STS:vm_state | building | | OS-SRV-USG:launched_at | None | | OS-SRV-USG:terminated_at | None | | accessIPv4 | | | accessIPv6 | | | addresses | | | adminPass | jAW7hUEvhbnd | | config_drive | | | created | 2024-08-27T07:34:49Z | | flavor | m1.small (2) | | hostId | | | id | 2c37fb17-abe3-4f7e-857a-0c162440f57e | | image | | | key_name | None | | name | test-instance8 | | progress | 0 | | project_id | 7984fa99a42b4da28c2e8efb1c0fda98 | | properties | | | security_groups | name='default' | | status | BUILD | | updated | 2024-08-27T07:34:49Z | | user_id | 9fc8c542deae487d898575abd7a43be5 | | volumes_attached | | +-------------------------------------+--------------------------------------+
-
检查创建好的虚拟机。
[root@server devstack]# nova list +--------------------------------------+----------------+--------+----------------------+-------------+------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+----------------+--------+----------------------+-------------+------------------+ | 10c71001-9db2-4232-8a50-031d04f386c3 | test-instance | ACTIVE | - | Running | net1=172.24.4.88 | | 2c37fb17-abe3-4f7e-857a-0c162440f57e | test-instance8 | BUILD | block_device_mapping | NOSTATE | | +--------------------------------------+----------------+--------+----------------------+-------------+------------------+