Openstack commands
Nova:
- List of instances
openstack server list
nova list
- Details on a specific instance
openstack server show <server id>
nova show <server id>
- Rebuild an instance
openstack server rebuild --image <image-id> <server-id>
nova rebuild <server-id> <image-id>
- Rebuild an instance with metadata
openstack server set --property <meta> <server-id>
nova meta <server-id> set <meta>
nova rebuild --meta <meta> <server-id> <image-id>
- Attach a port to an instance
nova interface-attach --port-id <port id> <instance id>
- Create a instance from a availability zone
nova boot --availability-zone nova:metal01:<ironic-id> --flavor <flavor-id> --image <img-id> --nic net-id=<network id>,v4-fixed-ip=<ip-address> <name>
openstack server create --availability-zone nova:metal01:<ironic-id> --flavor <flavor-id> --image <img-id> --nic net-id=<network id>,v4-fixed-ip=<ip-address> <name>
- Create a instance with meta property, sec group, fixed ip, ssh-key
openstack server create --image <image id> --flavor <flavor id> --nic net-id=<network id>,v4-fixed-ip=<ip-address> --property <meta-data> --security-group <security group id> --key-name <keypair name> vmname
- Create a instance
openstack server create --image <image id> --flavor <flavor id> vmname
- Remove error state from instance
nova reset-state --active <server-id>
- Change the flavour (resize)
openstack server resize --flavor <flavor> <ID>
Neutron:
- List of subnets and network ID
openstack network list
neutron net-list
- List of subnets, their IDs and allocation pools:
openstack subnet list
neutron subnet-list
- List ports
openstack port list
neutron port-list
- Create port
openstack port create --network <network id> --fixed-ip subnet=<subnet id>,ip-address=<ip-address>
neutron port-create --fixed-ip subnet_id=<subnet id>,ip_address=<X.X.X.X> <network id> <name>
- Update or Set/Unset port
neutron port-update --fixed-ip subnet_id=<subnet id>,ip_address=<ip-address> --fixed-ip subnet_id=<subnet id>,ip_address=<X.X.X.X> <port id>
openstack port set --fixed-ip subnet=<subnet>,ip-address=<ip-address> <port id>
openstack port unset --fixed-ip subnet=<subnet>,ip-address=<ip-address> <port id>
- Get details on a port
openstack port show <port id>
neutron port-show <port id>
- Allowed address pairs - (Allows one port to add additional IP/MAC address pairs on that port to allow traffic that matches those specified values.)
neutron port-update <port-uuid> --allowed-address-pairs type=dict list=true ip_address='0.0.0.0/0'
Glance:
- List images
openstack image list
glance image-list
- Get details on an image
glance image-show <image id>
- Upload a image
openstack image create --disk-format qcow2 --container-format bare --public --file ./centos7.qcow2 centos7-image
- Delete
openstack image delete <ID>
- Download a image
glance image-download <img-id> --file img.qcow2
- Change state
cinder reset-state --state in-use <id>
Other:
- List flavors
openstack flavor list
- List keypairs
openstack keypair list
- List Security groups
openstack security group list
Cinder
openstack volume set --state error <id>
Stop a migraion
Remove the active volume from the migration state
cinder reset-state <id> --reset-migration-status
find the volume in the attaching state and remove it
openstack volume list
cinder reset-state <id> --state error
cinder reset-state <id> --reset-migration-status
openstack volume delete <id>