KVM utilised under CloudStack uses the standard libvirt hook script behaviour: * https://libvirt.org/hooks.html
During install of the KVM CloudStack agent the script "/etc/libvirt/hooks/qemu" is populated based on the CloudStack provided file "libvirtqemuhook.in": * https://github.com/apache/cloudstack/blob/87ef8137534fa798101f65c6691fcf71513ac978/agent/bindir/libvirtqemuhook.in
This is a python script which carries out network management every time a VM is started, stopped or migrated (as per the qemu script specification). Please note that CloudStack does not provide any scripts for other libvirt actions – and the scope of this feature request is limited to the "qemu" script itself.