mirror of
https://github.com/retspen/webvirtcloud
synced 2026-07-01 17:15:42 +00:00
Added V2 from scratch
This commit is contained in:
parent
5c2232f4e8
commit
6c2925a35d
478 changed files with 21437 additions and 134206 deletions
39
devenv/vagrant/etc/libvirt/hooks/qemu
Normal file
39
devenv/vagrant/etc/libvirt/hooks/qemu
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# HubGridCloud libvirt qemu hook
|
||||
#
|
||||
|
||||
domain_name="$1"
|
||||
domain_task="$2"
|
||||
network="169.254.0.0/16"
|
||||
|
||||
|
||||
zeroconf_add() {
|
||||
# Get VNET interface
|
||||
target=$(xmlstarlet select -t -m "//devices/interface[@type='bridge']" -v "concat(target/@dev, ' ')" -n | head -1)
|
||||
iface=$(echo ${target} | cut -d- -f2)
|
||||
|
||||
# Add rule for 169.254.0.0/16
|
||||
ebtables -t nat -I "I-${iface}-ipv4-ip" 2 -p IPv4 --ip-src "${network}" -j RETURN
|
||||
ebtables -t nat -I "I-${iface}-arp-ip" -p ARP --arp-ip-src "${network}" -j RETURN
|
||||
}
|
||||
|
||||
|
||||
case "${domain_task}" in
|
||||
prepare)
|
||||
;;
|
||||
started)
|
||||
zeroconf_add
|
||||
;;
|
||||
stopped)
|
||||
;;
|
||||
reconnect)
|
||||
zeroconf_add
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
echo "qemu hook called with unexpected options $*" >&2
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue