mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-02-24 13:30:02 +08:00
Display exit codes
This commit is contained in:
parent
a441338be2
commit
1fae6801f2
@ -26,7 +26,7 @@ configureDHCP() {
|
|||||||
IP=$(ip address show dev "${VM_NET_DEV}" | grep inet | awk '/inet / { print $2 }' | cut -f1 -d/)
|
IP=$(ip address show dev "${VM_NET_DEV}" | grep inet | awk '/inet / { print $2 }' | cut -f1 -d/)
|
||||||
|
|
||||||
if ! ip link add link "${VM_NET_DEV}" "${VM_NET_VLAN}" type macvlan mode bridge > /dev/null 2>&1 ; then
|
if ! ip link add link "${VM_NET_DEV}" "${VM_NET_VLAN}" type macvlan mode bridge > /dev/null 2>&1 ; then
|
||||||
echo -n "ERROR: Capability NET_ADMIN has not been set. Please add the "
|
echo -n "ERROR: Capability NET_ADMIN has not been set ($?). Please add the "
|
||||||
echo "following docker setting to your container: --cap-add NET_ADMIN" && exit 15
|
echo "following docker setting to your container: --cap-add NET_ADMIN" && exit 15
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ configureDHCP() {
|
|||||||
echo "INFO: Acquiring an IP address via DHCP using MAC address ${VM_NET_MAC}..."
|
echo "INFO: Acquiring an IP address via DHCP using MAC address ${VM_NET_MAC}..."
|
||||||
|
|
||||||
if ! ip link add link "${VM_NET_DEV}" name "${VM_NET_TAP}" address "${VM_NET_MAC}" type macvtap mode bridge > /dev/null 2>&1 ; then
|
if ! ip link add link "${VM_NET_DEV}" name "${VM_NET_TAP}" address "${VM_NET_MAC}" type macvtap mode bridge > /dev/null 2>&1 ; then
|
||||||
echo -n "ERROR: Capability NET_ADMIN has not been set. Please add the "
|
echo -n "ERROR: Capability NET_ADMIN has not been set ($?). Please add the "
|
||||||
echo "following docker setting to your container: --cap-add NET_ADMIN" && exit 16
|
echo "following docker setting to your container: --cap-add NET_ADMIN" && exit 16
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -75,12 +75,12 @@ configureDHCP() {
|
|||||||
|
|
||||||
if [[ ! -e "${TAP_PATH}" ]]; then
|
if [[ ! -e "${TAP_PATH}" ]]; then
|
||||||
if ! mknod "${TAP_PATH}" c "$MAJOR" "$MINOR" ; then
|
if ! mknod "${TAP_PATH}" c "$MAJOR" "$MINOR" ; then
|
||||||
echo "ERROR: Cannot mknod: ${TAP_PATH}" && exit 20
|
echo "ERROR: Cannot mknod: ${TAP_PATH} ($?)" && exit 20
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! exec 30>>"$TAP_PATH"; then
|
if ! exec 30>>"$TAP_PATH"; then
|
||||||
echo -n "ERROR: Cannot create TAP interface. Please add the following docker settings to your "
|
echo -n "ERROR: Cannot create TAP interface ($?). Please add the following docker settings to your "
|
||||||
echo "container: --device-cgroup-rule='c ${MAJOR}:* rwm' --device=/dev/vhost-net" && exit 21
|
echo "container: --device-cgroup-rule='c ${MAJOR}:* rwm' --device=/dev/vhost-net" && exit 21
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ configureDHCP() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! exec 40>>/dev/vhost-net; then
|
if ! exec 40>>/dev/vhost-net; then
|
||||||
echo -n "ERROR: VHOST can not be found. Please add the following "
|
echo -n "ERROR: VHOST can not be found ($?). Please add the following "
|
||||||
echo "docker setting to your container: --device=/dev/vhost-net" && exit 22
|
echo "docker setting to your container: --device=/dev/vhost-net" && exit 22
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ configureNAT () {
|
|||||||
#Create bridge with static IP for the VM guest
|
#Create bridge with static IP for the VM guest
|
||||||
|
|
||||||
if ! ip link add dev dockerbridge type bridge > /dev/null 2>&1 ; then
|
if ! ip link add dev dockerbridge type bridge > /dev/null 2>&1 ; then
|
||||||
echo -n "ERROR: Capability NET_ADMIN has not been set. Please add the "
|
echo -n "ERROR: Capability NET_ADMIN has not been set ($?). Please add the "
|
||||||
echo "following docker setting to your container: --cap-add NET_ADMIN" && exit 23
|
echo "following docker setting to your container: --cap-add NET_ADMIN" && exit 23
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ configureNAT () {
|
|||||||
#Check port forwarding flag
|
#Check port forwarding flag
|
||||||
if [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
|
if [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
|
||||||
if ! sysctl -w net.ipv4.ip_forward=1 > /dev/null 2>&1; then
|
if ! sysctl -w net.ipv4.ip_forward=1 > /dev/null 2>&1; then
|
||||||
echo -n "ERROR: IP forwarding is disabled. Please add the following "
|
echo -n "ERROR: IP forwarding is disabled ($?). Please add the following "
|
||||||
echo "docker setting to your container: --sysctl net.ipv4.ip_forward=1" && exit 24
|
echo "docker setting to your container: --sysctl net.ipv4.ip_forward=1" && exit 24
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user