OpenStack different services have very powerful command line interfaces, with lots of different options.
Here is quick reference of the most used command-line commands:
General:
You will probably want to know what is the name of your openstack deployment? Aka Queens, Pines, Ocata, Newton but also to Mitaka, Liberty, Kilo & Juno.
Which OpenStack version is installed?
$ openstack –version
Once you have the version, check here for the name.
Same way for other specific services too, for example:
$ nova-manage –version
$ cinder-manage –version
$ glance-manage –version
Identity Service (aka Keystone):
List all users
$ openstack user list
List Identity service catalog
$ openstack catalog
List all services in service catalog
$ openstack service list
Compute (aka Nova)
List instances, notice status of instance
$ openstack server list
List images
$ openstack image list
List flavors
$ openstack flavor list
Boot an instance using flavor and image names
$ openstack server create –image IMAGE –flavor FLAVOR INSTANCE_NAME
$ openstack server create –image cirros-0.4.8-x86_64-uec –flavor m1.large\
NewInstance
Login to a Linux instance
# ip netns
# ip netns exec NETNS_NAME ssh USER@SERVER
# ip netns exec qdhcp-34343ds43-2323-4f9c-5432-0432885dgtf2 \
ssh cirros@10.0.0.2
*Note, in CirrOS the password for user cirros is “cubswin:)”.
Show details of instance
$ openstack server show NAME
$ openstack server show NewInstance
View console log of instance
$ openstack console-log NewInstance
Set metadata on an instance
$ nova meta volumeTwoImage set newmeta=’my new meta data’
Create an instance snapshot
$ openstack image-create volumeImage snapshot1OfVolumeImage
$ openstack image-show snapshot1OfVolumeImage
Stop, Pause, resize, rebuild and offcourse reboot an instance
Pause
$ openstack server pause NAME
$ openstack server pause myinstance
Unpause
$ openstack server unpause NAME
Stop
$ openstack server stop NAME
Start
$ openstack server start NAME
Resize
$ openstack server resize NAME FLAVOR
$ openstack server resize myinstance m2.large
$ openstack server resize –confirm myinstance
Rebuild
$ openstack server rebuild NAME IMAGE
$ openstack server rebuild myinstance cirros-121
Reboot
$ openstack server reboot NAME
$ openstack server reboot myinstance
Image Service (aka Glance)
List images you can access
$ openstack image list
Delete specified image
$ openstack image delete IMAGE
Describe a specific image
$ openstack image show IMAGE
Update image
$ openstack set imageIMAGE
Networking Service (aka Neutron)
Create network
$ openstack network create NAME
Create a subnet
$ openstack subnet create –subnet-pool SUBNET –network NETWORK SUBNET_NAME
$ openstack subnet create –subnet-pool 10.0.0.2/30 –network network1 subnetwork1
List network and subnet
$ neutron net-list
$ neutron subnet-list
Examine details of network and subnet
$ neutron net-show ID_OR_NAME_OF_NETWORK
$ neutron subnet-show ID_OR_NAME_OF_NETWORK
Block Storage Service (aka Cinder)
Create a new volume
$ openstack volume create –size SIZE_IN_GB NAME
$ openstack volume create –size 10 MyVolume
Boot an instance and attach to volume
$ openstack server create –image cirros-qcow2 –flavor m2.large MyVolume
List volumes
$ openstack volume list
Attach volume to instance after instance is active, and volume is available
$ openstack server add volume INSTANCE_ID VOLUME_ID
Manage volumes after login into the instance
List storage devices
# fdisk -l
Make filesystem on volume
# mkfs.ext3 /dev/vdb
Create a mountpoint
# mkdir /myspace
Mount the volume at the mountpoint
# mount /dev/vdb /myspace
Create a file on the volume
# touch /myspace/helloworld.txt
# ls /myspace
Unmount the volume
# umount /myspace
Troubleshooting
(1) In case you tried run one of the above commands and received the following error “Missing value auth-url required for auth plugin password”, simply follow this article and you are good to go.
Recent Comments