{"id":6971,"date":"2017-09-06T12:30:38","date_gmt":"2017-09-06T04:30:38","guid":{"rendered":"http:\/\/rmohan.com\/?p=6971"},"modified":"2017-09-06T12:30:38","modified_gmt":"2017-09-06T04:30:38","slug":"openstack-cheat-sheet-2017","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6971","title":{"rendered":"OpenStack Cheat Sheet 2017"},"content":{"rendered":"<p>OpenStack different services have very powerful command line interfaces, with lots of different options.  <\/p>\n<p>Here is quick reference of the most used command-line commands:<\/p>\n<p>General:<\/p>\n<p>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 &#038; Juno.<br \/>\nWhich OpenStack version is installed? <\/p>\n<p>$ openstack &#8211;version<br \/>\nOnce you have the version, check here for the name.<br \/>\nSame way for other specific services  too, for example:<\/p>\n<p>$ nova-manage &#8211;version<br \/>\n$ cinder-manage &#8211;version<br \/>\n$ glance-manage &#8211;version<br \/>\nIdentity Service (aka Keystone):<\/p>\n<p>List all users<\/p>\n<p>$ openstack user list<br \/>\nList Identity service catalog<\/p>\n<p>$ openstack catalog<br \/>\nList all services in service catalog<\/p>\n<p>$ openstack service list<br \/>\nCompute (aka Nova)<\/p>\n<p>List instances, notice status of instance<\/p>\n<p>$ openstack server list<br \/>\nList images<\/p>\n<p>$ openstack image list<br \/>\nList flavors<\/p>\n<p>$ openstack flavor list<br \/>\nBoot an instance using flavor and image names<\/p>\n<p>$ openstack server create &#8211;image IMAGE &#8211;flavor FLAVOR INSTANCE_NAME<br \/>\n$ openstack server create &#8211;image cirros-0.4.8-x86_64-uec &#8211;flavor m1.large\\<br \/>\n  NewInstance<br \/>\nLogin to a Linux instance<\/p>\n<p># ip netns<\/p>\n<p># ip netns exec NETNS_NAME ssh USER@SERVER<\/p>\n<p># ip netns exec qdhcp-34343ds43-2323-4f9c-5432-0432885dgtf2 \\<\/p>\n<p>ssh cirros@10.0.0.2<br \/>\n*Note, in CirrOS the password for user cirros is &#8220;cubswin:)&#8221;.<\/p>\n<p>Show details of instance<\/p>\n<p>$ openstack server show NAME<br \/>\n$ openstack server show NewInstance<br \/>\nView console log of instance<\/p>\n<p>$ openstack console-log NewInstance<br \/>\nSet metadata on an instance<\/p>\n<p>$ nova meta volumeTwoImage set newmeta=&#8217;my new meta data&#8217;<br \/>\nCreate an instance snapshot<\/p>\n<p>$ openstack image-create volumeImage snapshot1OfVolumeImage<br \/>\n$ openstack image-show snapshot1OfVolumeImage<\/p>\n<p>Stop, Pause, resize, rebuild and offcourse reboot an instance<\/p>\n<p>Pause<\/p>\n<p>$ openstack server pause NAME<br \/>\n$ openstack server pause myinstance<br \/>\nUnpause<\/p>\n<p>$ openstack server unpause NAME<br \/>\nStop<\/p>\n<p>$ openstack server stop NAME<br \/>\nStart<\/p>\n<p>$ openstack server start NAME<br \/>\nResize<\/p>\n<p>$ openstack server resize NAME FLAVOR<br \/>\n$ openstack server resize myinstance  m2.large<br \/>\n$ openstack server resize &#8211;confirm myinstance<br \/>\nRebuild<\/p>\n<p>$ openstack server rebuild NAME IMAGE<br \/>\n$ openstack server rebuild myinstance cirros-121<br \/>\nReboot<\/p>\n<p>$ openstack server reboot NAME<br \/>\n$ openstack server reboot myinstance<br \/>\nImage Service (aka Glance)<\/p>\n<p>List images you can access<\/p>\n<p>$ openstack image list<br \/>\nDelete specified image<\/p>\n<p>$ openstack image delete IMAGE<br \/>\nDescribe a specific image<\/p>\n<p>$ openstack image show IMAGE<br \/>\nUpdate image<\/p>\n<p>$ openstack set imageIMAGE<br \/>\nNetworking Service (aka Neutron)<\/p>\n<p>Create network<\/p>\n<p>$ openstack network create NAME<br \/>\nCreate a subnet<\/p>\n<p>$ openstack subnet create &#8211;subnet-pool SUBNET &#8211;network NETWORK SUBNET_NAME<br \/>\n$ openstack subnet create &#8211;subnet-pool 10.0.0.2\/30 &#8211;network network1 subnetwork1<br \/>\nList network and subnet<\/p>\n<p>$ neutron net-list<br \/>\n$ neutron subnet-list<br \/>\nExamine details of network and subnet<\/p>\n<p>$ neutron net-show ID_OR_NAME_OF_NETWORK<br \/>\n$ neutron subnet-show ID_OR_NAME_OF_NETWORK<br \/>\nBlock Storage Service (aka Cinder)<\/p>\n<p>Create a new volume<\/p>\n<p>$ openstack volume create &#8211;size SIZE_IN_GB  NAME<br \/>\n$ openstack volume create &#8211;size 10 MyVolume<br \/>\nBoot an instance and attach to volume<\/p>\n<p>$ openstack server create &#8211;image cirros-qcow2 &#8211;flavor m2.large MyVolume<br \/>\nList volumes<\/p>\n<p>$ openstack volume list<br \/>\nAttach volume to instance after instance is active, and volume is available<\/p>\n<p>$ openstack server add volume INSTANCE_ID VOLUME_ID<br \/>\nManage volumes after login into the instance<\/p>\n<p>List storage devices<\/p>\n<p># fdisk -l<br \/>\nMake filesystem on volume<\/p>\n<p># mkfs.ext3 \/dev\/vdb<br \/>\nCreate a mountpoint<\/p>\n<p># mkdir \/myspace<br \/>\nMount the volume at the mountpoint<\/p>\n<p># mount \/dev\/vdb \/myspace<br \/>\nCreate a file on the volume<\/p>\n<p># touch \/myspace\/helloworld.txt<br \/>\n# ls \/myspace<br \/>\nUnmount the volume<\/p>\n<p># umount \/myspace<br \/>\nTroubleshooting<\/p>\n<p>(1) In case you tried run one of the above commands and received the following error &#8220;Missing value auth-url required for auth plugin password&#8221;, simply follow this article and you are good to go.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OpenStack different services have very powerful command line interfaces, with lots of different options. <\/p>\n<p>Here is quick reference of the most used command-line commands:<\/p>\n<p>General:<\/p>\n<p>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 &#038; Juno. Which OpenStack [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6971"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6971"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6971\/revisions"}],"predecessor-version":[{"id":6972,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6971\/revisions\/6972"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}