Description

To run OpenStack commands in Contrail Networking containerized versions, you will first need to source the  admin-openrc.sh file.

Symptoms

When logged into containers and running OpenStack commands, I see the following error:

[root@hp3 ~]# openstack server list
-bash: openstack: command not found
[root@hp3 ~]# 


OR
 If I go into a container and try to run OpenStack commands, the following error is displayed.

[root@hp3 ~]# docker exec -it 761228a4a5ce bash
(kolla-toolbox)[ansible@hp3 /]$ openstack server list
Missing value auth-url required for auth plugin password
(kolla-toolbox)[ansible@hp3 /]$ exit
exit

 

Solution

You need to login to the kolla-toolbox container and run ​" admin-openrc.sh "

Note, the location of ​" admin-openrc.sh " may change between versions. If the file is not in  ' /var/lib/kolla/config_files/admin-openrc.sh'  issue the command  ' find / -name admin-openrc.sh'   to locate the file.

 

Login to kola-toolbox container and source the  admin-openrc.sh   file; then all the OpenStack commands will work.

[root@hp3 crashes]# docker ps | grep tool
761228a4a5ce  kolla/centos-binary-kolla-toolbox:queens   "dumb-init --single-…" 2 weeks ago  Up 21 hours  kolla_toolbox
[root@hp3 crashes]#
 
[root@hp3 crashes]# docker exec -it 761228a4a5ce bash

 
 Now, run the source commands.
  

(kolla-toolbox)[ansible@hp3 /]$ source /var/lib/kolla/config_files/ admin-openrc.sh
  
(kolla-toolbox)[ansible@hp3 /]$ nova flavor-list
+--------------------------------------+----------+------------+------+-----------+------+-------+-------------+-----------+-------------+
| ID                                   | Name     | Memory_MiB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | Description |
+--------------------------------------+----------+------------+------+-----------+------+-------+-------------+-----------+-------------+
| 73ea4ff1-3c5a-4965-8608-07aaf2450075 | m1.large | 8000       | 80   | 0         |      | 4     | 1.0         | True      | -           |
| c9f822a3-a1af-486d-9a77-13e81af4827a | m1.tiny  | 512        | 1    | 0         |      | 1     | 1.0         | True      | -           |
+--------------------------------------+----------+------------+------+-----------+------+-------+-------------+-----------+-------------+

 
 
(kolla-toolbox)[ansible@hp3 /]$ openstack server list
+--------------------------------------+--------------------+--------+------------------------------------------------+----------+----------+
| ID                                   | Name               | Status | Networks                                       | Image    | Flavor   |
+--------------------------------------+--------------------+--------+------------------------------------------------+----------+----------+
| ca6e730c-6367-4f23-bcf8-326c5393bc2c | analyzer left      | ACTIVE | left=1.1.1.7                                   | analyzer | m1.large |
| 587a3dcf-357a-4c82-bb6c-158e6b29c832 | vsrxzoom2          | ACTIVE | left=1.1.1.6; mgt1=10.85.226.28; right=2.2.2.6 | vsrx3    | m1.large |
| 20833940-9fcd-456d-97e0-97c474030c8f | right_two_cirros-3 | ACTIVE | right=2.2.2.5                                  | cirros   | m1.tiny  |
| 3b7e69c8-3479-4155-96c7-acc5765150c3 | right_two_cirros-1 | ACTIVE | right=2.2.2.4                                  | cirros   | m1.tiny  |
| 9e11eab6-fc5a-4b4d-8923-39ad1b94d494 | right_two_cirros-2 | ACTIVE | right=2.2.2.3                                  | cirros   | m1.tiny  |
| 255faca0-bc48-4119-b818-b6067aa31167 | left_one_cirros-2  | ACTIVE | left=1.1.1.4                                   | cirros   | m1.tiny  |
| d2b4e398-2187-4102-89db-6c8ed43d52ff | left_one_cirros-3  | ACTIVE | left=1.1.1.5                                   | cirros   | m1.tiny  |
| ea328a81-1269-42e1-a23c-de0277b164a5 | left_one_cirros-1  | ACTIVE | left=1.1.1.3                                   | cirros   | m1.tiny  |
+--------------------------------------+--------------------+--------+------------------------------------------------+----------+----------+