Thanks to you, 
I managed to do what I wanted to do (apply a patch). Well, not as I expected, but all your messages were a great help.
Still, all this is complicated for me, as I simply want to set up an OpenStack environment (for students) without mastering Git/Ansible and all the possibilities these tools offer.
And thanks to all.

Franck 

Le 15 avr. 2025 à 18:06, Sean Mooney <smooney@redhat.com> a écrit :

that is one way to do it but the other is to use the fact that kolla

can build directly from git

https://github.com/openstack/kolla/blob/master/kolla/common/config.py#L302-L327

so instead of using type=local  you can use type=git as shown here

https://github.com/openstack/kolla/blob/master/doc/source/admin/image-building.rst?plain=1#L138-L141

and you can set the refence to the commit you want to apply.

if the change is still under review in gerrit you can also use the gerrit review

repo and reference instead.

On 15/04/2025 15:05, Nguyễn Hữu Khôi wrote:
Hello.
First you need git clone horizon and patch it first then
nano /etc/kolla/kolla-build.conf
[DEFAULT]
cache = false
[horizon]
type = local
location = /home/ubuntu/horizon

and
kolla-build -b ubuntu horizon

u must push image to your repo to use it,

yep that is an important step otherwise it will only be viable on the host you built it on.

that also means if you are currently pulling form a public source

you need to override the container url for the containers you built

and point them to where you pushed your image.

be that a public or private registry.

i would suggest using quay.io if you don't want to run your own as the rate limits are higher then docker but docker

hub also works.

in general its good practice to run a local registry however, if for no other reason then to know exactly

what content you are deploying and minimize your dependency on the public internet.


for horizon you can set the image to use via horizon_image, horizon_tag and horizon_image_full

https://github.com/openstack/kolla-ansible/blob/master/ansible/roles/horizon/defaults/main.yml#L106-L108

normally these default to sensible value based on the version of kolla you checkout.

my general recommendation would be to build all the iamge you need not just horizon and push them all to a local or remote registry with

a consistent tag.


while you can override conatiner one at a time, its quite hard to keep track of what your deploying if you take that approch

so instead you shoudl tag them with the major openstack verion and a monotomicly increasing build number.

kolla tries to provide a declaritive way of deploying your cloud so you can treat configuration as code

and verion it in git. you shoudl treat your container image building the same and when ever you make a change ot any image build

the full set and bump the version for all of them


there is a nod to this guidance in the multi node guide as the first step is prepareing a share registry

https://github.com/openstack/kolla-ansible/blob/master/doc/source/user/multinode.rst#deploy-a-registry

and

https://github.com/openstack/kolla-ansible/blob/master/doc/source/user/operating-kolla.rst#version-of-deployed-images

in much older release before we published image to dockerhub/quay.io

the kolla anisbel deployment started with https://github.com/openstack/kolla/blob/master/doc/source/admin/image-building.rst

to build all the required images and that is still the best practice for production.




Nguyen Huu Khoi


On Tue, Apr 15, 2025 at 8:46 PM Franck VEDEL (UGA) <franck.vedel@univ-grenoble-alpes.fr> wrote:

   Hello, and first sorry for coming back with my problem.

   After 3 days of trying to resolve it  (applying a patch to fix a
   known bug in Horizon), it's still not working. No changes have
   been made to the problematic file (workflows.py).


   First question:
   This link discusses the topic (« Patching Customization")
   https://docs.openstack.org/kolla/latest/admin/image-building.html
   But not in the one for version 2024.2:
   https://docs.openstack.org/kolla/2024.2/admin/image-building.html

   So maybe the method doesn't apply to Dalmatian.

   Second question: what is wrong with what I’m doing:
   aperçu.png
   <https://review.opendev.org/changes/openstack%2Fhorizon~938238/revisions/1/patch?zip&path=openstack_dashboard%2Fdashboards%2Fproject%2Fnetworks%2Fports%2Fworkflows.py>
   
   patch
   <https://review.opendev.org/changes/openstack%2Fhorizon~938238/revisions/1/patch?zip&path=openstack_dashboard%2Fdashboards%2Fproject%2Fnetworks%2Fports%2Fworkflows.py>
   Archive ZIP · 409 octets
   <https://review.opendev.org/changes/openstack%2Fhorizon~938238/revisions/1/patch?zip&path=openstack_dashboard%2Fdashboards%2Fproject%2Fnetworks%2Fports%2Fworkflows.py>

   <https://review.opendev.org/changes/openstack%2Fhorizon~938238/revisions/1/patch?zip&path=openstack_dashboard%2Fdashboards%2Fproject%2Fnetworks%2Fports%2Fworkflows.py>

   The patch is a zip file
   We can download it: c2cce40.diff.zip

   I create the directory :  /home/user/PATCH/horizon

   My /etc/kolla/kolla-build.conf file is these 2 lines

   [DEFAULT]

   patches_path = /home/user/PATCH

   In this directory, we can list files: (I tried with the zip and
   the unzip file, the diff file)

   (venv) *user1@pc1*:*~*$ ll /home/user/PATCH/horizon/

   total 24

   drwxrwxr-x 2 user1 user1 4096 avril 14 09:14 *.*/

   drwxrwxr-x 3 user1 user1 4096 avril 11 08:24 *..*/

   -rw-rw-r-- 1 user1 user1 1093 déc.  25 03:01 c2cce40.diff

   -rw-rw-r-- 1 user1 user1  716 avril 14 09:12 *c2cce40.diff.zip*

   -rw-rw-r-- 1 user1 user1  716 avril 14 09:12 *c2cce40.zip*

   -rw-rw-r-- 1 user1 user1 13 avril 14 09:14 series

   The series file (the try with the zip file):

   (venv) *user1@pc1*:*~*$ more /home/user1/PATCH/horizon/series

   c2cce40.zip



   I also tried Without the zip extension

   I modify the file:
   /home/user/venv/share/kolla-ansible/ansible/roles/horizon/defaults/main.yml

   ####################

   # Docker

   ####################

   #horizon_image: "{{ docker_registry ~ '/' if docker_registry else
   '' }}{{ docker_namespace }}/{{ docker_image_name_prefix }}horizon"

   #horizon_tag: "{{ openstack_tag }}"

   #

   #horizon_image_full: "{{ horizon_image }}:{{ horizon_tag }}"

   horizon_image_full: "kolla/horizon:19.4.0 »



   The next  command create a new docker image (horizon:19.4.0)

   Kolla-build -b ubuntu horizon

   No problem… I have a new image named horizon:19.4.0. I copy the
   image on my second computer (2 nodes in my test cluster)

   Next: kolla-ansible reconfigure -I multinode

   Everything works , the new image is used to build horizon
   containers. But no modification in the file

   (venv) *user1@pc1*:*~*$ docker exec -it horizon bash

   *(horizon)*[root@pc1 /]# more
   ./var/lib/kolla/venv/lib/python3.12/site-packages/openstack_dashboard/dashboards/project/networks/ports/workflows.py


   class UpdatePortSecurityGroupAction(sg_base.BaseSecurityGroupsAction):

     def _get_initial_security_groups(self, context):

         port_id = context.get('port_id', '')

         port = api.neutron.port_get(self.request, port_id)

           return port.security_groups


   No modification on the container, in the workflows.py file.


   What is wrong ?

   There's something I'm not doing right, but what? Do you have any
   ideas? I'm definitely not managing it.

   Thank you, really, if you have any ideas.


   Franck