drivers: do not consider overlay cleanup error fatal

For some reason that we have not yet determined, the overlay that we use
for the drivers code sometimes fails to unmount with EBUSY.

When it happens, the _list_drivers task would fail, making subsequent
GET calls to /drivers?wait=true fail as well and produce an error
report.

We now mark failures in the overlay unmount operation as non fatal.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
Olivier Gayot 2022-10-17 12:27:32 +02:00
parent aae52dd6ba
commit 6954b309e6
1 changed files with 14 additions and 10 deletions

View File

@ -21,6 +21,7 @@ from subiquitycore.context import with_context
from subiquity.common.apidef import API
from subiquity.common.types import DriversPayload, DriversResponse
from subiquity.server.apt import OverlayCleanupError
from subiquity.server.controller import SubiquityController
from subiquity.server.types import InstallerChannels
from subiquity.server.ubuntu_drivers import (
@ -83,16 +84,19 @@ class DriversController(SubiquityController):
await self.configured()
return
apt = self.app.controllers.Mirror.apt_configurer
async with apt.overlay() as d:
try:
# Make sure ubuntu-drivers is available.
await self.ubuntu_drivers.ensure_cmd_exists(d.mountpoint)
except CommandNotFoundError:
self.drivers = []
else:
self.drivers = await self.ubuntu_drivers.list_drivers(
root_dir=d.mountpoint,
context=context)
try:
async with apt.overlay() as d:
try:
# Make sure ubuntu-drivers is available.
await self.ubuntu_drivers.ensure_cmd_exists(d.mountpoint)
except CommandNotFoundError:
self.drivers = []
else:
self.drivers = await self.ubuntu_drivers.list_drivers(
root_dir=d.mountpoint,
context=context)
except OverlayCleanupError:
log.exception("Failed to cleanup overlay. Continuing anyway.")
log.debug("Available drivers to install: %s", self.drivers)
if not self.drivers:
await self.configured()