mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-06-02 10:47:19 +08:00
feat: Add devcontainer (#939)
This commit is contained in:
parent
5fcd22b09f
commit
608563d029
6
.devcontainer.json
Normal file
6
.devcontainer.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "dsm",
|
||||
"service": "dsm",
|
||||
"forwardPorts": ["5000"],
|
||||
"dockerComposeFile": "compose.yml"
|
||||
}
|
@ -170,7 +170,7 @@ getHostPorts() {
|
||||
|
||||
configureUser() {
|
||||
|
||||
NET_OPTS="-netdev user,id=hostnet0,host=${VM_NET_IP%.*}.1,net=${VM_NET_IP%.*}.0/24,dhcpstart=$VM_NET_IP,hostname=$VM_NET_HOST"
|
||||
NET_OPTS="-netdev user,id=hostnet0,host=${VM_NET_IP%.*}.2,net=${VM_NET_IP%.*}.0/24,dhcpstart=$VM_NET_IP,hostname=$VM_NET_HOST"
|
||||
|
||||
local forward
|
||||
forward=$(getUserPorts "$USER_PORTS")
|
||||
@ -365,9 +365,15 @@ getInfo() {
|
||||
|
||||
if [ ! -d "/sys/class/net/$VM_NET_DEV" ]; then
|
||||
error "Network interface '$VM_NET_DEV' does not exist inside the container!"
|
||||
error "$ADD_ERR -e \"VM_NET_DEV=NAME\" to specify another interface name." && exit 27
|
||||
error "$ADD_ERR -e \"VM_NET_DEV=NAME\" to specify another interface name." && exit 26
|
||||
fi
|
||||
|
||||
BASE_IP="${VM_NET_IP%.*}."
|
||||
|
||||
if [ "${VM_NET_IP/$BASE_IP/}" -lt "3" ]; then
|
||||
error "Invalid VM_NET_IP, must end in a higher number than .3" && exit 27
|
||||
fi
|
||||
|
||||
if [ -z "$MTU" ]; then
|
||||
MTU=$(cat "/sys/class/net/$VM_NET_DEV/mtu")
|
||||
fi
|
||||
@ -436,7 +442,10 @@ if [[ "$DEBUG" == [Yy1]* ]]; then
|
||||
line="Host: $HOST IP: $IP Gateway: $GATEWAY Interface: $VM_NET_DEV MAC: $VM_NET_MAC MTU: $mtu"
|
||||
[[ "$MTU" != "0" ]] && [[ "$MTU" != "$mtu" ]] && line+=" ($MTU)"
|
||||
info "$line"
|
||||
[ -f /etc/resolv.conf ] && grep '^nameserver*' /etc/resolv.conf
|
||||
if [ -f /etc/resolv.conf ]; then
|
||||
nameservers=$(grep '^nameserver*' /etc/resolv.conf | head -c -1 | sed 's/nameserver //g;' | sed -z 's/\n/, /g')
|
||||
[ -n "$nameservers" ] && info "Nameservers: $nameservers"
|
||||
fi
|
||||
echo
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user