Openstack命令收集
查看rabbitmq 队列
rabbitmqctl list_queues
查看keystone的用户
keystone user-list
查看keystone endpoint
keystone endpoint-list
查看keystone的role
keystone role-list
查看keystone 服务
keystone service-list
查看keystone租户
keystone tenant-list
查看租户情况
keystone tenant-get ID
查看keystone进程
ps -ef | grep -i keystone-all
查看日志是否有错误
grep ERROR /var/log/keystone/keystone.log
上传image
glance add name="Ubuntu 12.04 cloudimg amd64" is_public=true container_format=ovf \
disk_format=qcow2 < /root/precise-server-cloudimg-amd64-disk1.img
查看image
glance index
nova 命令查看image
nova image-list
查看image具体信息(ID是通过 glance index 查看获得)
glance show ID
查看nova 服务
nova-manage service list
创建密钥
nova keypair-add oskey > oskey.priv
chmod 600 oskey.priv
申请floating IP
nova floating-ip-create
安全组相关命令
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
nova secgroup-list
nova secgroup-list-rules default
查看虚拟机配置种类
nova flavor-list
创建虚拟机(一个test的虚拟机)
nova boot --flavor 2 --key_name oskey --image ea3ffba1-065e-483f-bfe2-c84184ee76be test1
完整创建一个虚拟机的流程
nova keypair-add oskey > oskey.priv
chmod 600 oskey.priv
nova flavor-list
nova image-list
nova boot --flavor 2 --key_name oskey --image 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
查看申请flating IP 列表
nova floating-ip-list
查看虚拟机
nova list
添加floating IP给虚拟机(id是虚拟机的ID,通过nova list获得)
nova add-floating-ip 7eb1d4b3-13fa-4e39-be17-3a27eb0db218 10.1.199.33
查看虚拟机的floating IP (nova list,就可以查看,需要等待1分钟)
nova list
ssh到虚拟机上 (ubuntu的虚拟机,默认的用户名是ubuntu,只能用密钥登陆)
删除flating IP (ID就是虚拟机ID,通过 nova list 获得)
nova remove-floating-ip ID 10.1.199.33
删除虚拟机
nova delete ID
创建10G的volume
nova volume-create --display_name "test volume" 10
查看nova volume情况
nova volume-list
把volume添加到虚拟机上
( ID是虚拟机的id,后面的1,是volume的ID)添加完后可以通过 nova volume-list查看结果
nova volume-attach 7eb1d4b3-13fa-4e39-be17-3a27eb0db218 1 /dev/vdc
查看虚拟机里的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
格式化分区
sudo mkfs.ext4 /dev/vdc
sudo mkdir -p /mnt/volume
sudo mount /dev/vdc /mnt/volume
删除volume
nova volume-detach VM_ID Volume_ID
创建snapshot ( 完成后可以通过 nova image-list 查看)
nova image-create 7eb1d4b3-13fa-4e39-be17-3a27eb0db218 "snapshot 1"
虚拟机重启,停止
nova suspend ac9e6a9f-58c3-47c3-9b4c-485aa421b8a8
nova resume ac9e6a9f-58c3-47c3-9b4c-485aa421b8a8
nova reboot ac9e6a9f-58c3-47c3-9b4c-485aa421b8a8
vnc (详细可查看 https://www.ibm.com/developerworks/mydeveloperworks/blogs/e93514d3-c4f0-
4aa0-8844-497f370090f5/entry/openstack_vnc_console18?lang=en)
ova get-vnc-console myserver20 novnc