Commit 7eec7e37 authored by Ryan Jackson's avatar Ryan Jackson

Fixes to libvnode_openvz for Fedora 15

Set the hostname for the vnode using vzctl to make sure it gets set
correctly.  Otherwise the vnode will inherit the physical host's
hostname, and since this is not "localhost" or "localhost.localdomain"
the networking scripts inside the container will not set reset it to
the value in /etc/sysconfig/network.

Use the "inside" MAC address rather than the "outside" one when
creating macvlan devices.

Only try to delete interfaces if they still exist when tearing down
the vnode.  The kernel itself automatically deletes "virtual"
interfaces, which includes imq and macvlan.
parent c4dfbae0
...@@ -1054,9 +1054,11 @@ sub vz_vnodeTearDown { ...@@ -1054,9 +1054,11 @@ sub vz_vnodeTearDown {
# Delete the ip links # Delete the ip links
if (exists($private->{'iplinks'})) { if (exists($private->{'iplinks'})) {
foreach my $iface (keys(%{ $private->{'iplinks'} })) { foreach my $iface (keys(%{ $private->{'iplinks'} })) {
mysystem2("$IP link del dev $iface"); if (-e "/sys/class/net/$iface") {
goto badbad mysystem2("$IP link del dev $iface");
if ($?); goto badbad
if ($?);
}
delete($private->{'iplinks'}->{$iface}); delete($private->{'iplinks'}->{$iface});
} }
} }
...@@ -1504,6 +1506,7 @@ sub vz_vnodePreConfigControlNetwork { ...@@ -1504,6 +1506,7 @@ sub vz_vnodePreConfigControlNetwork {
print FD "DOMAIN=$longdomain\n"; print FD "DOMAIN=$longdomain\n";
print FD "NOZEROCONF=yes\n"; print FD "NOZEROCONF=yes\n";
close(FD); close(FD);
mysystem("$VZCTL $VZDEBUGOPTS set $vnode_id --hostname $vname.$longdomain --save");
# #
# dhclient-exit-hooks normally writes this stuff on linux, so we'd better # dhclient-exit-hooks normally writes this stuff on linux, so we'd better
...@@ -1628,6 +1631,7 @@ sub vz_vnodePreConfigExpNetwork { ...@@ -1628,6 +1631,7 @@ sub vz_vnodePreConfigExpNetwork {
$ifc->{VMAC}); $ifc->{VMAC});
($ethmac,$vethmac) = (macAddSep($ethmac),macAddSep($vethmac)); ($ethmac,$vethmac) = (macAddSep($ethmac),macAddSep($vethmac));
print "DEBUG ethmac=$ethmac, vethmac=$vethmac\n";
if ($USE_MACVLAN) { if ($USE_MACVLAN) {
# #
...@@ -1637,7 +1641,7 @@ sub vz_vnodePreConfigExpNetwork { ...@@ -1637,7 +1641,7 @@ sub vz_vnodePreConfigExpNetwork {
my $vname = "mv$vmid.$ifc->{ID}"; my $vname = "mv$vmid.$ifc->{ID}";
if (! -d "/sys/class/net/$vname") { if (! -d "/sys/class/net/$vname") {
mysystem("$IP link add link $physdev name $vname ". mysystem("$IP link add link $physdev name $vname ".
" address $vethmac type macvlan mode bridge "); " address $ethmac type macvlan mode bridge ");
$private->{'iplinks'}->{$vname} = $physdev; $private->{'iplinks'}->{$vname} = $physdev;
} }
# #
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment