pct: hookscript post-start executed before networking is up

hvisage

Renowned Member
May 21, 2013
251
20
83
Good day,

I have the need to execute things like `ethtool -K veth{vmid}i0 tx off` after the interface is up.
I got even more exited when I noticed hook-scripts, but less so when I found out that the veth is only configured/brought up *AFTER* the hookscript's `post-start` call was made.

Is there a wway to execute something *AFTER* the networking had been brought up?

I'm running into a similar with a WAF to mirror data to a single port, it's a simple script, but it needs to be run after the networking (at least the Layer2 and "physical" for the container/VM) had been connected in the hypervisor for that instance.

Bash:
#!/bin/bash

echo $*
vmid=$1
state=$2
case $state in
 post-start)
  set -x
  ip l | grep veth
 ethtool -K veth${vmid}i0 tx off
 exit 0
  ;;
esac

Code:
19999 pre-stop
19999 pre-start
19999 post-start
+ ip l
+ grep veth
15: veth981i0@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master ovs-system state UP mode DEFAULT group default qlen 1000
27: veth980i0@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master ovs-system state UP mode DEFAULT group default qlen 1000
32: veth10143i0@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master ovs-system state UP mode DEFAULT group default qlen 1000
48: veth500i0@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master ovs-system state UP mode DEFAULT group default qlen 1000
+ ethtool -K veth19999i0 tx off
Cannot get device feature names: No such device
+ exit 0
TASK OK
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!