1、image镜像操作
#上传镜像
openstack image create --file centos7.8.qcow2 --disk-format qcow2 --public centos
2、cinder卷操作
#创建卷
openstack volume create --image 53473099-1f32-4297-abe5-7526e9ae9dd9 --size 10 centos #从镜像创建启动卷
#删除卷
openstack volume set --detached 20616215-f924-4e3a-af3e-1041fd86b5bb #将卷的关联的实例取消,才能删除
openstack volume delete 20616215-f924-4e3a-af3e-1041fd86b5bb
#存储节点手动删除卷
lvremove /dev/cinder-volumes/volume-a9ff162e-dc9f-422f-8577-f2ca922c4fef #提示在使用
systemctl stop openstack-cinder-volume.service target.service #需要关闭存储节点的服务
lvremove /dev/cinder-volumes/volume-a9ff162e-dc9f-422f-8577-f2ca922c4fef #成功了
#删除卷服务(https://blog.csdn.net/wylfengyujiancheng/article/details/80011212)
openstack volume service set --disable compute-node-01@compute-node-01-sas cinder-volume
cinder-manage service remove cinder-volume compute-node-01@compute-node-01-sas
#修改状态
cinder reset-state 257ba654-a83e-4523-8ebc-97fa307abe31 --state available
#查看状态
cinder service-list --withreplication
#故障恢复
cinder failover-host --backend_id block-node-1@lvm2 block-node-1@lvm
3、nova实例操作
#从启动卷创建实例
openstack server create --flavor flavor_id --volume VOLUME_ID myInstanceFromVolume
#启动实例
openstack server start centos
#获取vnc连接
openstack console url show centos
#给实例绑定端口
openstack server add port yum port-10.0.0.221
4、flavor实例类型操作
#创建实例类型
openstack flavor create --id 0 --vcpus 1 --ram 64 --disk 1 m1.nano
openstack flavor create --vcpus 1 --ram 2048 --disk 20 1C/2G/20G
5、删除计算服务
#先停止nova-compute服务,然后根据id删除服务
openstack compute service set --disable compute-block-node-03 nova-compute
#删除
openstack compute service delete 15
6、网络相关操作
1、基本操作
#浮动ip创建
openstack floating ip create --floating-ip-address 192.100.3.100 provider
#移除实例上的浮动ip
openstack server remove floating ip <server> <ip-address>
openstack server remove floating ip 5c84e5f2-bdd5-4201-826e-d1c6e03a6ff5 192.100.3.189
#绑定浮动ip到指定实例
openstack server add floating ip [--fixed-ip-address <ip-address>] <server> <ip-address>
#创建端口
openstack port create --network provider --fixed-ip subnet=provider,ip-address=192.100.3.200 test
#创建子网
openstack subnet create --network provider --subnet-range 192.0.2.0/24 subnet1
#列出端口
openstack port list
#列出浮动ip
openstack floating ip list
#给实例绑定端口
openstack server add port yum port-10.0.0.221
#删除网络服务
openstack network agent delete 3e4be26d-e4fb-4c52-8c22-9d64d1e23d2a
2、删除路由
#删除路由
#先删路由上的网关
neutron router-gateway-clear <router>
openstack router unset --external-gateway <router>
#再删路由上的接口(子网)
neutron router-interface-delete <router> <subnet>
openstack router remove subnet <router> <subnet>
#port是关联路由和子网的。所以清掉路由上的接口,那port就没有了。
#在删除路由
openstack router delete <router>
7、用户操作
#修改当前用户的密码为admin
openstack user password set --password admin