openstack 常用命令

I. Nova

I.1. Management

Services status:

1
$ sudo nova-manage service list

Enable/disable a service:

1
$ sudo nova-manage service enable|disable --host=host --service=nova-compute

Add a new network:

1
$ sudo nova-manage network create --label vlan1 --fixed_range_v4 10.0.1.0/24 --num_networks 1 --network_size 256 --vlan 1

Remove a network, first disassociate it to a project:

1
2
$ sudo nova-manage project scrub projectname
$ sudo nova-manage network delete [cidr]

List networks:

1
$ sudo nova-manage network list

Add a floating IPs address range:

1
$ sudo nova-manage floating create --pool [my-pool] --ip_range 172.17.1.32/27

Add a floating to your tenant (you will get a floating IP address, but unused):

1
$ nova floating-ip-create [my-pool]

Associate IP to an instance (specific tenant, according to your credentials)

1
$ nova add-floating-ip [my-instance] [ip]

Check the status of the floating IPs (tenant related):

1
$ nova floating-ip-list

List all instances running on every compute node:

1
$ sudo nova-manage vm list | column -t

I.2. Common

Add a new security group:

1
$ nova secgroup-create web-server "Web server running"

Add rule to this group:

1
$ nova secgroup-add-rule web-server tcp 80 80 0.0.0.0/0

Add a security rules, allow ping and ssh:

1
2
$ nova secgroup-add-rule web-server icmp -1 -1 0.0.0.0/0
$ nova secgroup-add-rule web-server tcp 22 22 0.0.0.0/0

Create credential:

1
2
$ nova keypair-add my_key > mey_key.pem
$ chmod 600 *.pem

List instances from the tenant in your credential

1
$ nova list

Boot a new instance:

1
$ nova boot --flavor [flavor-id] --image [image-id] --key_name [key1] --security_groups [default] [instance-name]

Delete an instance:

1
$ nova delete [INSTANCE_ID]

Take a snapshot from an instance but first commit the buffer cache to disk:

1
2
3
my-instance:~$ sync
my-instance:~$ sudo echo 3 | sudo tee /proc/sys/vm/drop_caches
$ nova image-create [instance-id] [snapshot-name]

Get precise information about a specific instance:

1
$ nova show [instance-name]

Perform a block_migration:

1
$ nova live-migration --block_migrate [INSTANCE_ID] [TARGET_SERVER]

II. Glance

Add an image to glance (public):

1
$ glance add name="my-image" is_public=True|False disk_format=qcow2 container_format=ovf architecture=x86_64 < my-image.img

Check the glance backend:

1
$ glance index

Same with nova-common:

1
$ nova image-list

Set an image to public:

1
$ glance update [image-id] is_public=true

III. Keystone

List all the tenants:

1
$ keystone tenant-list

List all users:

1
$ keystone user-list

Create a new user:

1
$ keystone user-create --name [username] --tenant_id [tenant-id] --pass [password] --email [email] --enabled true 

  

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值