Skip to main content

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>
  • Attach a port to an instance
nova interface-attach --port-id <port id> <instance id>
  • Create a baremetal instance
nova boot --availability-zone nova:metal01:SERVERID --flavor OAS2.2xE5-2650v4.64GB.2x480GB.SSD.10GbE --image IMG-ID --nic port-id=PORT-ID name-of-mechine
  • Create a new VM
openstack server create --image <image id> --flavor <flavor id> --nic net-id=<network id>,v4-fixed-ip=<ip-address> --security-group <security group id> --key-name <keypair name> vmname
  • Remove error state from instance 
nova reset-state --active <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>
  • Update port
openstack port set --fixed-ip subnet=<subnet id>,ip-address=<ip-address> --fixed-ip subnet=<subnet id>,ip-address=<ip-address> <port id>
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>
  • Unset Port
openstack port unset --fixed-ip subnet=<subnet id>,ip-address=<ip-address>
  • Get details on a port
openstack port <port id>
neutron port-show <port id>
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>
Other:
  • List flavors
openstack flavor list
  • List keypairs
openstack keypair list
  • List Security groups
openstack security group list