mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-02-24 13:30:02 +08:00
feat: Close network on shutdown
This commit is contained in:
parent
0cca2a7079
commit
160e5a07be
@ -140,7 +140,13 @@ configureNAT () {
|
||||
|
||||
# QEMU Works with taps, set tap to the bridge created
|
||||
ip tuntap add dev "${VM_NET_TAP}" mode tap
|
||||
ip link set "${VM_NET_TAP}" up promisc on
|
||||
|
||||
while [ ! ip link set "${VM_NET_TAP}" up promisc on ]
|
||||
do
|
||||
info "Waiting for tap to become available..."
|
||||
sleep 2
|
||||
done
|
||||
|
||||
ip link set dev "${VM_NET_TAP}" master dockerbridge
|
||||
|
||||
# Add internet connection to the VM
|
||||
@ -174,6 +180,19 @@ configureNAT () {
|
||||
return 0
|
||||
}
|
||||
|
||||
closeNetwork () {
|
||||
|
||||
ip link set "${VM_NET_TAP}" down
|
||||
ip link delete "${VM_NET_TAP}"
|
||||
|
||||
if [[ "${DHCP}" != [Yy1]* ]]; then
|
||||
|
||||
ip link set dockerbridge down
|
||||
ip link delete dockerbridge
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
# ######################################
|
||||
# Configure Network
|
||||
# ######################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user