mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-16 01:52:34 +00:00
Honor network type and link from lxc-create -f
Make the oracle template honor the lxc.network.type and lxc.network.link configuration items if a "base" configuration file is passed to lxc-create. If no configuration file is passed and the host system is Oracle or Fedora, the template assumes a type of veth and the default name created by libvirt. Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
This commit is contained in:
parent
7060353a08
commit
b1dc05fde9
@ -250,7 +250,6 @@ container_config_create()
|
|||||||
head -1 |awk '{print $2}' | cut -c1-10 |\
|
head -1 |awk '{print $2}' | cut -c1-10 |\
|
||||||
sed 's/\(..\)/\1:/g; s/.$//'`"
|
sed 's/\(..\)/\1:/g; s/.$//'`"
|
||||||
mkdir -p $cfg_dir || die "unable to create config dir $cfg_dir"
|
mkdir -p $cfg_dir || die "unable to create config dir $cfg_dir"
|
||||||
rm -f $cfg_dir/config
|
|
||||||
cat <<EOF >> $cfg_dir/config || die "unable to create $cfg_dir/config"
|
cat <<EOF >> $cfg_dir/config || die "unable to create $cfg_dir/config"
|
||||||
# Container configuration for Oracle Linux $release_major.$release_minor
|
# Container configuration for Oracle Linux $release_major.$release_minor
|
||||||
lxc.arch = $arch
|
lxc.arch = $arch
|
||||||
@ -261,9 +260,19 @@ lxc.pts = 1024
|
|||||||
lxc.rootfs = $container_rootfs
|
lxc.rootfs = $container_rootfs
|
||||||
lxc.mount = $cfg_dir/fstab
|
lxc.mount = $cfg_dir/fstab
|
||||||
# Networking
|
# Networking
|
||||||
lxc.network.type = $lxc_network_type
|
EOF
|
||||||
lxc.network.flags = up
|
|
||||||
lxc.network.link = $lxc_network_link
|
# see if the network settings were already specified
|
||||||
|
lxc_network_type=`grep '^lxc.network.type' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
|
||||||
|
if [ -z "$lxc_network_type" -a \
|
||||||
|
$host_distribution = "OracleServer" -o \
|
||||||
|
$host_distribution = "Fedora" ]; then
|
||||||
|
echo "lxc.network.type = veth" >>$cfg_dir/config
|
||||||
|
echo "lxc.network.flags = up" >>$cfg_dir/config
|
||||||
|
echo "lxc.network.link = virbr0" >>$cfg_dir/config
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<EOF >> $cfg_dir/config || die "unable to create $cfg_dir/config"
|
||||||
lxc.network.name = eth0
|
lxc.network.name = eth0
|
||||||
lxc.network.mtu = 1500
|
lxc.network.mtu = 1500
|
||||||
lxc.network.hwaddr = $hwaddr
|
lxc.network.hwaddr = $hwaddr
|
||||||
|
Loading…
Reference in New Issue
Block a user