Skip to content

apply: Fix crash when OVS is stopped (LP#1995598)#307

Merged
slyon merged 3 commits into
canonical:mainfrom
daniloegea:lp1995598
Jan 19, 2023
Merged

apply: Fix crash when OVS is stopped (LP#1995598)#307
slyon merged 3 commits into
canonical:mainfrom
daniloegea:lp1995598

Conversation

@daniloegea

@daniloegea daniloegea commented Jan 4, 2023

Copy link
Copy Markdown
Contributor

If openvswitch is installed but not running, netplan apply will try to call the service anyway and will crash. In this case we probably should ignore the error and log a warning message to the user.

Add an integration test that will be executed by autopkgtest.

Description

It addresses https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/1995598

The problem can be reproduced with:

lxc launch ubuntu:22.04 jammy --vm
lxc exec jammy bash
apt install openvswitch-switch
systemctl stop ovsdb-server
netplan apply

Checklist

  • Runs make check successfully.
  • Retains 100% code coverage (make check-coverage).
  • New/changed keys in YAML format are documented.
  • (Optional) Adds example YAML for new feature.
  • (Optional) Closes an open bug in Launchpad.

If openvswitch is installed but not running, netplan apply will try to
call the service anyway and will crash. In this case we probably should
ignore the error and log a warning message to the user.

Add an integration test that will be executed by autopkgtest.
@daniloegea daniloegea requested a review from slyon January 11, 2023 16:28
Comment thread netplan/cli/ovs.py Outdated
from netplan.cli.utils import systemctl_is_active

OPENVSWITCH_OVS_VSCTL = '/usr/bin/ovs-vsctl'
OPENVSWITCH_OVSDB_SERVER_UNIT = 'ovsdb-server'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it ovsdb-server.service explicitly

@slyon slyon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, lgtm!
I added some small bit to call ovsdb-server.service by its explicit name (including the .service suffix). Let's merge it once it passes the tests.

@slyon slyon merged commit 45b25f6 into canonical:main Jan 19, 2023
@ali-basafa

Copy link
Copy Markdown

This error is because ovsdb-server.service is not running, and if it is not running, you can install it with
apt-get install openvswitch-switch
systemctl restart ovsdb-server
, and if it is installed, remove it and install it again with the following command.
apt-get remove openvswitch-switch
apt-get install openvswitch-switch
systemctl restart ovsdb-server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants