openstack的常用命令
1、查看rabbitmq 队列:rabbitmqctl list_queues
2、查看keystone的用户:keystone user-list
3、查看keystone endpoint:keystone endpoint-list
4、查看keystone的role:keystone role-list
5、查看keystone 服务:keystone service-list
6、查看keystone租户:keystone tenant-list
7、查看租户情况:keystone tenant-get ID
8、查看keystone进程:ps -ef | grep -i keystone-all
9、查看日志是否有错误:grep ERROR /var/log/keystone/keystone.log
上传p_w_picpathglance:
add name="Ubuntu 12.04 cloudimg amd64" is_public=true container_format=ovf \
disk_format=qcow2 < /root/precise-server-cloudimg-amd64-disk1.img
10、查看p_w_picpath:glance index
11、nova 命令查看p_w_picpath:nova p_w_picpath-list
12、查看p_w_picpath具体信息(ID是通过 glance index 查看获得):glance show ID
13、查看nova 服务:nova-manage service list
14、创建密钥:nova keypair-add oskey > oskey.priv
chmod 600 oskey.priv
15、申请floating IP:nova floating-ip-create
16、安全组相关命令:
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0 ---设置虚拟机能ssh
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0 ---设置虚拟机能ping icmp包
nova secgroup-list
nova secgroup-list-rules default
17、查看虚拟机配置种类:nova flavor-list
18、创建虚拟机(一个test的虚拟机):
nova boot --flavor 2 --key_name oskey --p_w_picpath ea3ffba1-065e-483f-bfe2-c84184ee76be test1
19、完整创建一个虚拟机的流程:
nova keypair-add oskey > oskey.priv
chmod 600 oskey.priv
nova flavor-list
nova p_w_picpath-list
nova boot --flavor 2 --key_name oskey --p_w_picpath ea3ffba1-065e-483f-bfe2-c84184ee76be test1
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
20、查看申请flating IP 列表:nova floating-ip-list
21、查看虚拟机:nova list
22、添加floating IP给虚拟机(id是虚拟机的ID,通过nova list获得):
nova add-floating-ip 7eb1d4b3-13fa-4e39-be17-3a27eb0db218 10.1.199.33
23、查看虚拟机的floating IP (nova list,就可以查看,需要等待1分钟):nova list
24、ssh到虚拟机上 (ubuntu的虚拟机,默认的用户名是ubuntu,只能用密钥登陆):
ssh -i oskey.priv ubuntu@192.168.22.2
25、删除flating IP (ID就是虚拟机ID,通过 nova list 获得):
nova remove-floating-ip ID 10.1.199.33
26、删除虚拟机:nova delete ID
27、创建10G的volumenova:volume-create --display_name "test volume" 10
28、查看nova volume情况:nova volume-list
29、把volume添加到虚拟机上( ID是虚拟机的id,后面的1,是volume的ID)添加完后可以通过 nova volume-list查看结果:
nova volume-attach 7eb1d4b3-13fa-4e39-be17-3a27eb0db218 1 /dev/vdc
30、查看虚拟机里的volume情况(登陆虚拟机里):
ubuntu@test1:~$ cat /proc/partitions
major minor #blocks name
253 0 10485760 vda
253 1 10474380 vda1
253 16 20971520 vdb
253 32 10485760 vdc
31、删除volume:nova volume-detach VM_ID Volume_ID
32、创建snapshot ( 完成后可以通过 nova p_w_picpath-list 查看):
nova p_w_picpath-create 7eb1d4b3-13fa-4e39-be17-3a27eb0db218 "snapshot 1"
33、虚拟机重启,停止:
nova suspend ac9e6a9f-58c3-47c3-9b4c-485aa421b8a8
nova resume ac9e6a9f-58c3-47c3-9b4c-485aa421b8a8
nova reboot ac9e6a9f-58c3-47c3-9b4c-485aa421b8a8
34、迁移虚拟机:nova live-migration <server ID> <destination compute>
35、挂载快存储到虚拟机:nova volume-attach <server> <volume> <device>
转载于:https://blog.51cto.com/bristol/1615482