openstack命令整理


nova-manage service list |sort

cinder-manage host list|sort
keystone service-list
keystone endpoint-list

network:
nova-manage network list
nova-manage floating list

users&projects:
keystone tenant-list
keystone user-list

running instances:
nova list --all-tenants
nova show <uuid>

Managing Projects:

keystone tenant-create --name=XX [--description <tenant-description>]
nova-manage project quota xxx (xxx <-- keystone tenant-list | grep <tenant-name>) [--key [floating_ips] --value ]

policy.json

User-facing Operations:
image:
glance help image-create
glance details
glance image-delete <image uuid>
glance help
mysql> select glance.images.id, glance.images.name, keystone.tenant.name,is_public from glance.images inner join keystone.tenant on glance.images.owner=keystone.tenant.id;
mysql> select name, value from image_properties where id = <image_id>

flavors:
nova flavor-list
nova flavor-create
nova help| grep flavor
nova.conf -- allow_same_net_traffic
nova secgroup-list
nova secgroup-list-rules open
nova secgroup-add-rule <secgroup> <ip-proto> <from-port> <to-port><cidr>
nova secgroup-add-rule global_http tcp 80 80 0.0.0.0/0
nova secgroup-add-rule global_http tcp 443 443 0.0.0.0/0
nova secgroup-list-rules global_http
nova secgroup-add-group-rule cluster global-http tcp 22 22


Block Storage:
cinder create --display-name test-volume 10
cinder list
cinder snapshot-create

Instances:
nova boot --flavor <flavor> --image <image> <name>
nova delete <instance-uuid>
nova show xxx
<若nova show信息不足,可查看相关计算节点的nova-compute.log或调度宿主机的nova-scheduler.log>

<inject custom data including authorized_keys key injection,user-data, metadata service, and file injection>
产生和注册ssh keys: nova keypair-add mykey > mykey.pem
注册公共key: nova keypair-add --pub-key mykey.pub mykey
启动时关联key和instance: nova boot --image ubuntu-cloudimage --flavor 1 --key_name mykey
使用-meta添加元数据: nova boot --image=xx --flavor=1 smallimage --meta description="xxx"
查看: nova show smallimage
使用文件添加用户数据: nova boot --image xx --flavor 1 --user-data mydata.file
创建instance时添加到FS: nova boot --image xx --flavor 1 --file /root/xx/xx
运行时添加/删除安全组: nova add-secgroup <server> <securitygroup>
nova remove-secgroup <server> <securitygroup>

nova floating-ip-create
nova add-floating-ip <server> <address>
nova remove-floating-ip <server> <address>

nova vloume-attach <server> <volume>
nova boot --flavor 2 --key-name mykey --block-device-mapping vda=13:::0 boot-from-vol-test

你可能感兴趣的:(openstack命令整理)