一、块存储(Cinder)

1.列出所有卷(ID、名称、状态、大小和挂载目录)

openstack volume list

2.新建卷(size的单位为GB)

openstack volume create --size <size> <name>

3.删除卷

openstack volume delete <id>

4.将卷连接到instance

openstack server add volume <instance_id> <volume_id>

二、认证(Keystone)

1.列出所有用户

openstack user list

2.列出认证服务目录

openstack catalog list

三、镜像(Glance)

1.列出可以访问的镜像

openstack image list

2.删除指定镜像

openstack image delete <image_id>

3.查看指定镜像的详细信息

openstack image show <image_id>

4.更新镜像

openstack image set <image_id>

四、计算(nova)

1列出实例

openstack server list

2.创建规格

openstack flavor create --ram <ram_size_MB> --disk <disk_size_GB> --vcpus <vcpu_num> <flavor_name>

3.列出所有规格

openstack flavor list

4.创建并启动云主机

openstack server create --image <image_id> --flavor <flavor_id> <server_name>

5.显示实例的详细信息

openstack server show <server_name>

6.查看云主机的控制台日志

openstack console log show <server_name>

7.设置云主机的元数据

nova meta <server_id> set <meta_key>=<meta_value>

8.创建云主机快照

openstack image create <server_id> <snapshot_name>

9.查看云主机快照

openstack image show <snapshot_name>

10.暂停云主机

openstack server pause <server_id>

11.取消暂停

openstack server unpause <server_id>

12.挂起云主机

openstack server suspend <server_id>

13.取消挂起

openstack server resume <server_id>

14.关闭云主机

openstack server stop <server_id>

15.开启云主机

openstack server start <server_id>

16.恢复云主机

openstack server rescue <server_id> --rescue_image_ref <rescue_image>

17.调整云主机大小

openstack server resize <server_id> <flavor_name>

18.重建云主机

openstack server rebuild <server_id> <image_id>

19.重启云主机

openstack server reboot <server_id>

20.将用户数据文件注入云主机

openstack server create --user-data <datafile_name> --image <iamge_id> --flavor <flavor_name> <server_name>

五、网络(Neutron)

1.创建网络

openstack network create <network_name>

2.创建子网

openstack network create --subnet-pool <subnet> --network <network_name> <subnet_name>