openstack命令整理


nova-manage service list |sort mysql

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
相關文章
相關標籤/搜索