Comment 7 for bug 1777121

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :

To add more context to the feature request, I have the following use-case:

* an OVS bridge gets created during the snap initialization;
* on snap removal it needs to be removed;
* however, by the time the code in the remove hook starts getting executed, all of the services required to do that are stopped (namely, ovsdb and vswitchd).

To make it more clear: the bridge is registered in the kernel (openvswitch kernel module), however, the tools used to trigger the removal talk to the user-space services which do the actual work of talking to the kernel.

In essence, I currently have to start those services back up before trying to remove the bridge:

```
cat snap/hooks/remove
#!/bin/bash
set -ex

snapctl start microstack.ovsdb-server
snapctl start microstack.ovs-vswitchd

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/current/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu
$SNAP/usr/local/bin/ovs-vsctl --if-exists del-br br-ex

snapctl stop microstack.ovsdb-server
snapctl stop microstack.ovs-vswitchd
```

Having pre-remove would allow me to get rid of the manual startup of services in the remove hook.