2017-07-11 11:26:51 +05:30
|
|
|
.. _quickstart:
|
2016-05-22 10:08:49 -05:00
|
|
|
|
|
|
|
=====================
|
|
|
|
Developer Quick-Start
|
|
|
|
=====================
|
|
|
|
|
2016-06-07 13:12:22 +05:30
|
|
|
This is a quick walkthrough to get you started developing code for Zun.
|
2016-05-22 10:08:49 -05:00
|
|
|
This assumes you are already familiar with submitting code reviews to
|
|
|
|
an OpenStack project.
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
2017-04-26 15:55:51 +08:00
|
|
|
https://docs.openstack.org/infra/manual/developers.html
|
2016-05-22 10:08:49 -05:00
|
|
|
|
2016-05-22 10:42:40 -05:00
|
|
|
Exercising the Services Using Devstack
|
|
|
|
======================================
|
|
|
|
|
2017-04-03 18:07:56 -04:00
|
|
|
This session has been tested on Ubuntu 16.04 (Xenial) only.
|
2016-05-22 10:42:40 -05:00
|
|
|
|
|
|
|
Clone devstack::
|
|
|
|
|
|
|
|
# Create a root directory for devstack if needed
|
2017-10-10 16:11:21 +08:00
|
|
|
$ sudo mkdir -p /opt/stack
|
|
|
|
$ sudo chown $USER /opt/stack
|
|
|
|
$ git clone https://git.openstack.org/openstack-dev/devstack /opt/stack/devstack
|
2016-05-22 10:42:40 -05:00
|
|
|
|
|
|
|
We will run devstack with minimal local.conf settings required to enable
|
|
|
|
required OpenStack services::
|
|
|
|
|
2017-11-18 19:18:41 +00:00
|
|
|
$ HOST_IP=<your ip>
|
|
|
|
$ git clone https://git.openstack.org/openstack/zun /opt/stack/zun
|
|
|
|
$ cat /opt/stack/zun/devstack/local.conf.sample \
|
|
|
|
| sed "s/HOST_IP=.*/HOST_IP=$HOST_IP/" \
|
|
|
|
> /opt/stack/devstack/local.conf
|
2016-11-20 16:12:36 -06:00
|
|
|
|
2017-12-04 10:33:17 +07:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
By default, *KURYR_CAPABILITY_SCOPE=global*. It will work in both
|
|
|
|
all-in-one and multi-node scenario. You still can change it to *local*
|
|
|
|
(in **all-in-one scenario only**)::
|
|
|
|
|
|
|
|
$ sed -i "s/KURYR_CAPABILITY_SCOPE=.*/KURYR_CAPABILITY_SCOPE=local/" /opt/stack/devstack/local.conf
|
|
|
|
|
2017-10-10 16:11:21 +08:00
|
|
|
More devstack configuration information can be found at `Devstack Configuration
|
|
|
|
<https://docs.openstack.org/devstack/latest/configuration.html>`_
|
2016-05-22 10:42:40 -05:00
|
|
|
|
2017-10-10 16:11:21 +08:00
|
|
|
More neutron configuration information can be found at `Devstack Neutron
|
|
|
|
Configuration <https://docs.openstack.org/devstack/latest/guides/neutron.html>`_
|
2016-05-22 10:42:40 -05:00
|
|
|
|
|
|
|
Run devstack::
|
|
|
|
|
2017-10-10 16:11:21 +08:00
|
|
|
$ cd /opt/stack/devstack
|
|
|
|
$ ./stack.sh
|
2016-05-22 10:42:40 -05:00
|
|
|
|
|
|
|
Prepare your session to be able to use the various openstack clients including
|
|
|
|
nova, neutron, and glance. Create a new shell, and source the devstack openrc
|
|
|
|
script::
|
|
|
|
|
2017-10-10 16:11:21 +08:00
|
|
|
$ source /opt/stack/devstack/openrc admin admin
|
2016-05-22 10:42:40 -05:00
|
|
|
|
2016-08-23 22:29:32 -05:00
|
|
|
Using the service
|
|
|
|
=================
|
|
|
|
|
2017-04-07 17:12:49 +05:30
|
|
|
We will create and run a container that pings the address 8.8.8.8 four times::
|
2016-08-23 22:29:32 -05:00
|
|
|
|
2017-04-07 17:12:49 +05:30
|
|
|
$ zun run --name test cirros ping -c 4 8.8.8.8
|
2016-08-23 22:29:32 -05:00
|
|
|
|
2017-11-30 16:13:10 +00:00
|
|
|
Above command will use the Docker image ``cirros`` from DockerHub which is a
|
|
|
|
public image repository. Alternatively, you can use Docker image from Glance
|
|
|
|
which serves as a private image repository::
|
|
|
|
|
|
|
|
$ docker pull cirros
|
|
|
|
$ docker save cirros | openstack image create cirros --public --container-format docker --disk-format raw
|
|
|
|
$ zun run --image-driver glance cirros ping -c 4 8.8.8.8
|
|
|
|
|
2016-08-23 22:29:32 -05:00
|
|
|
You should see a similar output to::
|
|
|
|
|
2017-03-08 12:33:02 +05:30
|
|
|
$ zun list
|
2017-04-07 17:12:49 +05:30
|
|
|
+--------------------------------------+------+--------+---------+------------+------------+-------+
|
|
|
|
| uuid | name | image | status | task_state | addresses | ports |
|
|
|
|
+--------------------------------------+------+--------+---------+------------+------------+-------+
|
|
|
|
| 46dd001b-7474-412c-a0f4-7adc047aaedf | test | cirros | Stopped | None | 172.17.0.2 | [] |
|
|
|
|
+--------------------------------------+------+--------+---------+------------+------------+-------+
|
2016-08-23 22:29:32 -05:00
|
|
|
|
2017-03-08 12:33:02 +05:30
|
|
|
$ zun logs test
|
|
|
|
PING 8.8.8.8 (8.8.8.8): 56 data bytes
|
|
|
|
64 bytes from 8.8.8.8: seq=0 ttl=40 time=25.513 ms
|
|
|
|
64 bytes from 8.8.8.8: seq=1 ttl=40 time=25.348 ms
|
|
|
|
64 bytes from 8.8.8.8: seq=2 ttl=40 time=25.226 ms
|
|
|
|
64 bytes from 8.8.8.8: seq=3 ttl=40 time=25.275 ms
|
2016-08-23 22:29:32 -05:00
|
|
|
|
2017-03-08 12:33:02 +05:30
|
|
|
--- 8.8.8.8 ping statistics ---
|
|
|
|
4 packets transmitted, 4 packets received, 0% packet loss
|
|
|
|
round-trip min/avg/max = 25.226/25.340/25.513 ms
|
2016-08-23 22:29:32 -05:00
|
|
|
|
|
|
|
Delete the container::
|
|
|
|
|
2017-03-08 12:33:02 +05:30
|
|
|
$ zun delete test
|