From b487dcd0c7878f736467fed41e970f1620acaa95 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 7 May 2008 13:49:33 +0000 Subject: [PATCH] -Implement host-relative site.dhcpinterfaces syntax git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1303 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/lib/xcat/plugins/dhcp.pm | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm b/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm index 58f30b4a2..81257e1a0 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm @@ -305,12 +305,25 @@ sub process_request ($href) = $sitetab->getAttribs({key => 'dhcpinterface'}, 'value'); } if ($href and $href->{value}) + #syntax should be like host|ifname1,ifname2;host2|ifname3,ifname2 etc or simply ifname,ifname2 + #depending on complexity of network wished to be described { - foreach (split /[,\s]+/, $href->{value}) - { - $activenics{$_} = 1; - $querynics = 0; - } + my $dhcpinterfaces = $href->{value}; + my $dhcpif; + foreach $dhcpif (split /;/,$dhcpinterfaces) { + if ($dhcpif =~ /\|/) { + (my $host,$dhcpif) = split /\|/,$dhcpif; + if (xCAT::Utils->thishostisnot($host)) { + next; + } + } + foreach (split /[,\s]+/, $dhcpif) + { + $activenics{$_} = 1; + $querynics = 0; + } + } + print Dumper(\%activenics); } ($href) = $sitetab->getAttribs({key => 'domain'}, 'value'); unless ($href and $href->{value})