创建规格
flavor create --ram 256 --vcpus 1 --disk 5 s1.qh
查看规格
flavor list
创建镜像
image create --container-format bare --disk-format qcow2 --min-disk 1 --min-ram 256 --file /root/cirros-0.6.2-x86_64-disk.img mycirros-0.6.2-x86_64
查看NOVA
compute service list
+----+----------------+-----------+----------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+----------------+-----------+----------+---------+-------+----------------------------+
| 4 | nova-scheduler | control01 | internal | enabled | up | 2024-11-26T11:02:02.000000 |
| 1 | nova-conductor | control01 | internal | enabled | up | 2024-11-26T11:01:58.000000 |
| 3 | nova-compute | node02 | nova | enabled | up | 2024-11-26T11:01:53.000000 |
| 4 | nova-compute | node01 | nova | enabled | up | 2024-11-26T11:01:57.000000 |
创建网络
network create new_net
创建子网
subnet create --subnet-range 10.173.0.0/24 --gateway 10.173.0.1 --network new_net new_subnet01
创建实例
server create --flavor s1.qh --image mycirros-0.6.2-x86_64 --nic net-id=c861c1c9-6b91-4e42-842b-07f56e21941b mynew_vm
注意net-id指的是网络的ID,不是子网的ID
列出所有主机,主要是找计算节点的名称
host list
+-----------+-----------+----------+
| Host Name | Service | Zone |
+-----------+-----------+----------+
| control01 | scheduler | internal |
| control01 | conductor | internal |
| node02 | compute | nova |
| node01 | compute | nova |
+-----------+-----------+----------+
或者:compute service list
列出指定主机上的实例
server list --host node01
+--------------------------------------+----------+---------+------------------------+-----------------------+--------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+----------+---------+------------------------+-----------------------+--------+
| 10bf701f-8c17-4853-8a33-758ddd35973f | mynew_vm | ACTIVE | new_net=10.173.0.241 | mycirros-0.6.2-x86_64 | s1.qh |
| 62f8e677-b0a4-4c36-b50f-62716c6b9752 | test4 | SHUTOFF | test2=172.16.1.43 | | 1C256M |
| c6abea24-bd1e-4d43-96bd-e606acc034cb | test2 | SHUTOFF | test_net=192.168.7.160 | | 1C256M |
+--------------------------------------+----------+---------+------------------------+-----------------------+--------+
实例热迁移
server migrate 10bf701f-8c17-4853-8a33-758ddd35973f --live-migration --host node02
router create router2
router add subnet router2 new_subnet01
router set router2 --external-gateway out
1317

被折叠的 条评论
为什么被折叠?



