mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-02-24 13:30:02 +08:00
Formatting
This commit is contained in:
parent
30fc91f48d
commit
81fd26c2c1
@ -26,29 +26,34 @@ configureDHCP() {
|
|||||||
ip a flush eth0
|
ip a flush eth0
|
||||||
ip a flush ${VM_NET_TAP}
|
ip a flush ${VM_NET_TAP}
|
||||||
|
|
||||||
_DhcpIP=$( dhclient -v ${VM_NET_TAP} 2>&1 | grep ^bound | cut -d' ' -f3 )
|
DHCP_IP=$( dhclient -v ${VM_NET_TAP} 2>&1 | grep ^bound | cut -d' ' -f3 )
|
||||||
[[ "${_DhcpIP}" == [0-9.]* ]] \
|
|
||||||
&& echo "Info: Retrieved IP ${_DhcpIP} via DHCP" \
|
if [[ "${DHCP_IP}" == [0-9.]* ]]; then
|
||||||
|| ( echo "ERROR: Cannot retrieve IP from DHCP using MAC ${VM_NET_MAC}" && exit 16 )
|
echo "Info: Retrieved IP ${DHCP_IP} via DHCP"
|
||||||
|
else
|
||||||
|
echo "ERROR: Cannot retrieve IP from DHCP using MAC ${VM_NET_MAC}" && exit 16
|
||||||
|
fi
|
||||||
|
|
||||||
ip a flush ${VM_NET_TAP}
|
ip a flush ${VM_NET_TAP}
|
||||||
|
|
||||||
_tmpTapPath="/dev/tap$(</sys/class/net/${VM_NET_TAP}/ifindex)"
|
TAP_PATH="/dev/tap$(</sys/class/net/${VM_NET_TAP}/ifindex)"
|
||||||
|
|
||||||
# create dev file (there is no udev in container: need to be done manually)
|
# create dev file (there is no udev in container: need to be done manually)
|
||||||
IFS=: read MAJOR MINOR < <(cat /sys/class/net/${VM_NET_TAP}/macvtap/${_tmpTapPath##*/}/uevent)
|
IFS=: read MAJOR MINOR < <(cat /sys/class/net/${VM_NET_TAP}/macvtap/${TAP_PATH##*/}/uevent)
|
||||||
|
|
||||||
[[ "x${MAJOR}" != "x" ]] \
|
if [[ "x${MAJOR}" != "x" ]]; then
|
||||||
&& echo "Info: Please make sure that the following docker setting is used: --device-cgroup-rule='c ${MAJOR}:* rwm'" \
|
echo "Info: Please make sure that the following docker setting is used: --device-cgroup-rule='c ${MAJOR}:* rwm'"
|
||||||
|| ( echo "Info: Macvtap creation issue: Cannot find: /sys/class/net/${VM_NET_TAP}/" && exit 18 )
|
else
|
||||||
|
echo "Info: Macvtap creation issue: Cannot find: /sys/class/net/${VM_NET_TAP}/" && exit 18
|
||||||
[[ ! -e ${_tmpTapPath} ]] && [[ -e /dev0/${_tmpTapPath##*/} ]] && ln -s /dev0/${_tmpTapPath##*/} ${_tmpTapPath}
|
|
||||||
|
|
||||||
if [[ ! -e ${_tmpTapPath} ]]; then
|
|
||||||
mknod ${_tmpTapPath} c $MAJOR $MINOR && : || ("ERROR: Cannot mknod: ${_tmpTapPath}" && exit 20)
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec 30>>$_tmpTapPath
|
[[ ! -e ${TAP_PATH} ]] && [[ -e /dev0/${TAP_PATH##*/} ]] && ln -s /dev0/${TAP_PATH##*/} ${TAP_PATH}
|
||||||
|
|
||||||
|
if [[ ! -e ${TAP_PATH} ]]; then
|
||||||
|
mknod ${TAP_PATH} c $MAJOR $MINOR && : || ("ERROR: Cannot mknod: ${TAP_PATH}" && exit 20)
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec 30>>$TAP_PATH
|
||||||
exec 40>>/dev/vhost-net
|
exec 40>>/dev/vhost-net
|
||||||
|
|
||||||
NET_OPTS="-netdev tap,id=hostnet0,vhost=on,vhostfd=40,fd=30"
|
NET_OPTS="-netdev tap,id=hostnet0,vhost=on,vhostfd=40,fd=30"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user