3. Matters needing attention
3.1. Mounting the directory is something that needs to be paid attention to
Be careful when mounting a partition to a directory
Do not mount the directory that stores important files of the system, and backup the directory with important files in the directory, because the directory will be emptied during the mounting process
Fourth, the command summary
4.1. Summary of openstack commands
View the service status on the openstack node
[root@YUN-14 ~]# openstack-status
When the instance fails to start, you can try the command ( test is the name of the virtual machine)
Reset the state of the virtual machine
[root@YUN-11 ~(keystone_admin)]# nova reset-state test
Shut down the virtual machine
[root@YUN-11 ~(keystone_admin)]# nova stop test
Start the virtual machine
[root@YUN-11 ~(keystone_admin)]# nova start test
View a list of virtual machine resource quotas
[root@YUN-11 ~(keystone_admin)]# nova flavor-list
View the list of mirrors
[root@YUN-11 ~(keystone_admin)]# nova image-list
View a list of networks
[root@YUN-11 ~(keystone_admin)]# nova network-list
View cloud host information
[root@YUN-19 ~(keystone_admin)]# nova list
General commands for creating virtual machines
# nova boot --image imageID --flavor flavorID --nic net-id=nicID name
(The last name refers to the name given to the cloud host)
下面是一个示例,只是这个示例比上边的多了些参数,指定了要创建到那个openstack计算节点上。
[root@YUN-11 ~(keystone_admin)]# nova boot --image test-mini --flavor 1 test-1 --availability-zone nova:YUN-15 --nic net-id=e49ae481-4
(--image后边是指定的镜像名,--flavor后边是指定的虚机配给资源的id,后边的test-1是为虚机起的名字,-availability-zone后边的nova是域、YUN-15是openstack计算节点的主机名,--nic net-id是要把虚机所在网络的id)
添加镜像
[root@YUN-11 ~(keystone_admin)]# glance add name=test-26 is_public=true container_format=bare disk_format=raw < /root/disk4
(disk_format后面跟镜像格式,< 后面是镜像的目录)
删除云主机
# nova delete <instance-uuid>
查看云主机的详细信息
# nova show <instance-name>
当计算节点无法创建虚机,而且在dashboard中查看“管理员”---“主机集合”,可以看到节点名为YUN-15的服务为停止状态,就需要在这个节点上重启openstack计算节点的主服务
# service openstack-nova-compute restart
4.2、硬件相关命令
查看CPU信息
[root@YUN-19 ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
192 Intel(R) Xeon(R) CPU E7-8850 v2 @ 2.30GHz
4.3、虚拟化相关的命令
查看镜像的信息
# qemu-img info disk
转换镜像的格式
# qemu-img convert -O raw disk disk3
更改镜像的大小(增加)
# qemu-img resize disk3 +100M
更改镜像的大小(减少)
# qemu-img resize disk3 -- -100M