mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-11-07 18:43:41 +08:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1e9936572 | ||
|
|
3675a50129 | ||
|
|
91229152bd | ||
|
|
a1993e590a | ||
|
|
52fe712b6f | ||
|
|
7f400b6b59 | ||
|
|
9cb88a99e6 |
@@ -37,11 +37,14 @@ RUN set -eu && extra="" && \
|
|||||||
net-tools \
|
net-tools \
|
||||||
e2fsprogs \
|
e2fsprogs \
|
||||||
qemu-utils \
|
qemu-utils \
|
||||||
|
iputils-ping \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
netcat-openbsd \
|
netcat-openbsd \
|
||||||
qemu-system-x86 \
|
qemu-system-x86 \
|
||||||
"$extra" && \
|
"$extra" && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
|
mkdir -p /etc/qemu && \
|
||||||
|
echo "allow br0" > /etc/qemu/bridge.conf && \
|
||||||
unlink /etc/nginx/sites-enabled/default && \
|
unlink /etc/nginx/sites-enabled/default && \
|
||||||
sed -i 's/^worker_processes.*/worker_processes 1;/' /etc/nginx/nginx.conf && \
|
sed -i 's/^worker_processes.*/worker_processes 1;/' /etc/nginx/nginx.conf && \
|
||||||
echo "$VERSION_ARG" > /run/version && \
|
echo "$VERSION_ARG" > /run/version && \
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ kubectl apply -f https://raw.githubusercontent.com/vdsm/virtual-dsm/refs/heads/m
|
|||||||
|
|
||||||
After configuring the container for [macvlan](#how-do-i-assign-an-individual-ip-address-to-the-container), it is possible for DSM to become part of your home network by requesting an IP from your router, just like your other devices.
|
After configuring the container for [macvlan](#how-do-i-assign-an-individual-ip-address-to-the-container), it is possible for DSM to become part of your home network by requesting an IP from your router, just like your other devices.
|
||||||
|
|
||||||
To enable this mode, add the following lines to your compose file:
|
To enable this mode, in which the container and DSM will have separate IP addresses, add the following lines to your compose file:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
environment:
|
environment:
|
||||||
@@ -234,9 +234,6 @@ kubectl apply -f https://raw.githubusercontent.com/vdsm/virtual-dsm/refs/heads/m
|
|||||||
- 'c *:* rwm'
|
- 'c *:* rwm'
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> In this mode, the container and DSM will each have their own separate IPs.
|
|
||||||
|
|
||||||
### How do I pass-through the GPU?
|
### How do I pass-through the GPU?
|
||||||
|
|
||||||
To pass-through your Intel GPU, add the following lines to your compose file:
|
To pass-through your Intel GPU, add the following lines to your compose file:
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ set -Eeuo pipefail
|
|||||||
# Docker environment variables
|
# Docker environment variables
|
||||||
|
|
||||||
: "${MAC:=""}"
|
: "${MAC:=""}"
|
||||||
|
: "${MTU:=""}"
|
||||||
: "${DHCP:="N"}"
|
: "${DHCP:="N"}"
|
||||||
: "${NETWORK:="Y"}"
|
: "${NETWORK:="Y"}"
|
||||||
: "${USER_PORTS:=""}"
|
: "${USER_PORTS:=""}"
|
||||||
@@ -58,6 +59,12 @@ configureDHCP() {
|
|||||||
fi ;;
|
fi ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [[ "$MTU" != "0" ]] && [[ "$MTU" != "1500" ]]; then
|
||||||
|
if ! ip link set dev "$VM_NET_TAP" mtu "$MTU"; then
|
||||||
|
warn "Failed to set MTU size.."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
while ! ip link set "$VM_NET_TAP" up; do
|
while ! ip link set "$VM_NET_TAP" up; do
|
||||||
info "Waiting for MAC address $VM_NET_MAC to become available..."
|
info "Waiting for MAC address $VM_NET_MAC to become available..."
|
||||||
sleep 2
|
sleep 2
|
||||||
@@ -213,8 +220,13 @@ configureNAT() {
|
|||||||
error "$tuntap" && return 1
|
error "$tuntap" && return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GATEWAY_MAC=$(echo "$VM_NET_MAC" | rev)
|
if [[ "$MTU" != "0" ]] && [[ "$MTU" != "1500" ]]; then
|
||||||
GATEWAY_MAC="02:${GATEWAY_MAC:0:14}"
|
if ! ip link set dev "$VM_NET_TAP" mtu "$MTU"; then
|
||||||
|
warn "Failed to set MTU size.."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
GATEWAY_MAC=$(echo "$VM_NET_MAC" | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/')
|
||||||
|
|
||||||
if ! ip link set dev "$VM_NET_TAP" address "$GATEWAY_MAC"; then
|
if ! ip link set dev "$VM_NET_TAP" address "$GATEWAY_MAC"; then
|
||||||
warn "Failed to set gateway MAC address.."
|
warn "Failed to set gateway MAC address.."
|
||||||
@@ -345,6 +357,20 @@ getInfo() {
|
|||||||
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 27
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$MTU" ]; then
|
||||||
|
MTU=$(cat "/sys/class/net/$VM_NET_DEV/mtu")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MTU" -gt "1500" ]; then
|
||||||
|
info "MTU size is too large: $MTU, ignoring..." && MTU="0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${ADAPTER,,}" != "virtio-net-pci" ]]; then
|
||||||
|
if [[ "$MTU" != "0" ]] && [[ "$MTU" != "1500" ]]; then
|
||||||
|
warn "MTU size is $MTU, but cannot be set for $ADAPTER adapters!" && MTU="0"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$VM_NET_MAC" ]; then
|
if [ -z "$VM_NET_MAC" ]; then
|
||||||
local file="$STORAGE/dsm.mac"
|
local file="$STORAGE/dsm.mac"
|
||||||
[ -s "$file" ] && VM_NET_MAC=$(<"$file")
|
[ -s "$file" ] && VM_NET_MAC=$(<"$file")
|
||||||
@@ -387,7 +413,10 @@ getInfo
|
|||||||
html "Initializing network..."
|
html "Initializing network..."
|
||||||
|
|
||||||
if [[ "$DEBUG" == [Yy1]* ]]; then
|
if [[ "$DEBUG" == [Yy1]* ]]; then
|
||||||
info "Host: $HOST IP: $IP Gateway: $GATEWAY Interface: $VM_NET_DEV MAC: $VM_NET_MAC"
|
mtu=$(cat "/sys/class/net/$VM_NET_DEV/mtu")
|
||||||
|
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
|
[ -f /etc/resolv.conf ] && grep '^nameserver*' /etc/resolv.conf
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
@@ -452,6 +481,7 @@ else
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NET_OPTS+=" -device $ADAPTER,romfile=,netdev=hostnet0,mac=$VM_NET_MAC,id=net0"
|
NET_OPTS+=" -device $ADAPTER,id=net0,netdev=hostnet0,romfile=,mac=$VM_NET_MAC"
|
||||||
|
[[ "$MTU" != "0" ]] && [[ "$MTU" != "1500" ]] && NET_OPTS+=",host_mtu=$MTU"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ CPU="${CPU// Processor/}"
|
|||||||
CPU="${CPU// Quad core/}"
|
CPU="${CPU// Quad core/}"
|
||||||
CPU="${CPU// Core TM/ Core}"
|
CPU="${CPU// Core TM/ Core}"
|
||||||
CPU="${CPU// with Radeon Graphics/}"
|
CPU="${CPU// with Radeon Graphics/}"
|
||||||
|
CPU="${CPU// with Radeon Vega Graphics/}"
|
||||||
|
|
||||||
[ -z "${CPU// /}" ] && CPU="Unknown"
|
[ -z "${CPU// /}" ] && CPU="Unknown"
|
||||||
|
|
||||||
# Check system
|
# Check system
|
||||||
|
|||||||
Reference in New Issue
Block a user