FileNotFound when offlining a core due to a privsep context missing

Bug #2022955 reported by Sylvain Bauza
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Sylvain Bauza

Bug Description

When we created the CPU power interface, we forgot to add a specific privsep decorator for the set_offline() method :
https://review.opendev.org/c/openstack/nova/+/868236/5/nova/virt/libvirt/cpu/core.py#63

As a result, we have a FileNotFound due to a permission error when restarting the nova-compute service :

Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service Traceback (most recent call last):
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service File "/opt/stack/nova/nova/filesystem.py", line 56, in write_sys
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service with open(os.path.join(SYS, path), mode='w') as fd:
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service PermissionError: [Errno 13] Permission denied: '/sys/devices/system/cpu/cpu1/online'
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service The above exception was the direct cause of the following exception:
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service Traceback (most recent call last):
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service File "/usr/local/lib/python3.10/dist-packages/oslo_service/service.py", line 806, in run_service
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service service.start()
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service File "/opt/stack/nova/nova/service.py", line 162, in start
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service self.manager.init_host(self.service_ref)
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service File "/opt/stack/nova/nova/compute/manager.py", line 1608, in init_host
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service self.driver.init_host(host=self.host)
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 831, in init_host
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service libvirt_cpu.power_down_all_dedicated_cpus()
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service File "/opt/stack/nova/nova/virt/libvirt/cpu/api.py", line 128, in power_down_all_dedicated_cpus
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service pcpu.online = False
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service File "/opt/stack/nova/nova/virt/libvirt/cpu/api.py", line 50, in online
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service core.set_offline(self.ident)
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service File "/opt/stack/nova/nova/virt/libvirt/cpu/core.py", line 64, in set_offline
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service filesystem.write_sys(os.path.join(gen_cpu_path(core), 'online'), data='0')
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service File "/opt/stack/nova/nova/filesystem.py", line 59, in write_sys
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service raise exception.FileNotFound(file_path=path) from exc
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service nova.exception.FileNotFound: File /sys/devices/system/cpu/cpu1/online could not be found.
Jun 05 16:18:49 sbauza-dev2 nova-compute[76374]: ERROR oslo_service.service

Tags: libvirt cpu
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/nova/+/885293

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.opendev.org/c/openstack/nova/+/885293
Committed: https://opendev.org/openstack/nova/commit/3fab43786bbdc01087004b973bb0912505150864
Submitter: "Zuul (22348)"
Branch: master

commit 3fab43786bbdc01087004b973bb0912505150864
Author: Sylvain Bauza <email address hidden>
Date: Mon Jun 5 18:22:09 2023 +0200

    cpu: fix the privsep issue when offlining the cpu

    In Icb913ed9be8d508de35e755a9c650ba25e45aca2 we forgot to add a privsep
    decorator for the set_offline() method.

    Change-Id: I769d35907ab9466fe65b942295fd7567a757087a
    Closes-Bug: #2022955

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 28.0.0.0rc1

This issue was fixed in the openstack/nova 28.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/2023.1)

Fix proposed to branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/nova/+/905675

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 27.3.0

This issue was fixed in the openstack/nova 27.3.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.