start work on mkvlan support
This commit is contained in:
		
							
								
								
									
										74
									
								
								xCAT-client/pods/man1/mkvlan.1.pod
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								xCAT-client/pods/man1/mkvlan.1.pod
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,74 @@
 | 
			
		||||
=head1 Name
 | 
			
		||||
 | 
			
		||||
B<mkvlan> - Create vlan on switches
 | 
			
		||||
 | 
			
		||||
=head1 B<Synopsis>
 | 
			
		||||
 | 
			
		||||
B<mkvlan> [B<-h>|B<--help>|B<?>|B<-v>|B<--version>]
 | 
			
		||||
 | 
			
		||||
B<mkvlan> {Ivlanid} -n I<noderange> {B-i <interface>|B-m <netmask> |B-t <subnet>}
 | 
			
		||||
 | 
			
		||||
=head1 B<Description>
 | 
			
		||||
 | 
			
		||||
B<mkvlan> creates tagged vlan on the switches corresponding to the attributes defined in the B<switch> table
 | 
			
		||||
 | 
			
		||||
=head1 B<Options>
 | 
			
		||||
 | 
			
		||||
=over 7
 | 
			
		||||
 | 
			
		||||
=item B<vlanid>
 | 
			
		||||
 | 
			
		||||
The vlan to tag on the switch.
 | 
			
		||||
 | 
			
		||||
=item B<interface>
 | 
			
		||||
 | 
			
		||||
List all buses for each I/O slot.
 | 
			
		||||
 | 
			
		||||
=item B<netmask>
 | 
			
		||||
 | 
			
		||||
Retrieves number of processors, speed, total  memory,  and  DIMM
 | 
			
		||||
locations.
 | 
			
		||||
 | 
			
		||||
=item B<subnet>
 | 
			
		||||
 | 
			
		||||
Retrieves model number.
 | 
			
		||||
 | 
			
		||||
=item B<-h>|B<--help>|B<?>
 | 
			
		||||
 | 
			
		||||
Print help.
 | 
			
		||||
 | 
			
		||||
=item B<-v>|B<--version>
 | 
			
		||||
 | 
			
		||||
Print version.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 B<Examples>
 | 
			
		||||
 | 
			
		||||
=over 4
 | 
			
		||||
 | 
			
		||||
=item *
 | 
			
		||||
 | 
			
		||||
To make a private vlan for stand-alone nodes for the management network, enter:
 | 
			
		||||
 | 
			
		||||
 mkvlan -n node1,node2,node3
 | 
			
		||||
 | 
			
		||||
=item *
 | 
			
		||||
 | 
			
		||||
You can specify vlan id, subnet and netmask etc, enter:
 | 
			
		||||
 | 
			
		||||
 mkvlan 3 -n node1,node2,node3 -t 10.3.2.0 -m 255.255.255.0
 | 
			
		||||
 | 
			
		||||
=item *
 | 
			
		||||
 | 
			
		||||
To create a tagged vlan on an interface, enter:
 | 
			
		||||
 | 
			
		||||
 mkvlan -n node1,node2,node3 -i eth1
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 SEE ALSO
 | 
			
		||||
 | 
			
		||||
L<lsvlan(1)|lsvlan.1>
 | 
			
		||||
							
								
								
									
										102
									
								
								xCAT-server/lib/xcat/plugins/vlan.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										102
									
								
								xCAT-server/lib/xcat/plugins/vlan.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,102 @@
 | 
			
		||||
#!/usr/bin/perl
 | 
			
		||||
# OCF(c) 2014 EPL license http://www.eclipse.org/legal/epl-v10.html
 | 
			
		||||
 | 
			
		||||
package xCAT_plugin::vlan;
 | 
			
		||||
BEGIN
 | 
			
		||||
{
 | 
			
		||||
  $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
 | 
			
		||||
}
 | 
			
		||||
use lib "$::XCATROOT/lib/perl";
 | 
			
		||||
use strict;
 | 
			
		||||
use warnings "all";
 | 
			
		||||
use xCAT::GlobalDef;
 | 
			
		||||
use xCAT::SPD qw/decode_spd/;
 | 
			
		||||
 | 
			
		||||
use xCAT::Utils;
 | 
			
		||||
use xCAT::TableUtils;
 | 
			
		||||
use xCAT::SvrUtils;
 | 
			
		||||
use xCAT::Usage;
 | 
			
		||||
 | 
			
		||||
sub handled_commands {
 | 
			
		||||
  return {
 | 
			
		||||
    mkvlan => 'switch:vlan,port,switch', #done
 | 
			
		||||
    chvlan => 'switch:vlan,port,switch', #done
 | 
			
		||||
    lsvlan => 'switch:vlan,port,switch', #done
 | 
			
		||||
    rmvlan => 'switch:vlan,port,switch', #done
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
use POSIX "WNOHANG";
 | 
			
		||||
use IO::Handle;
 | 
			
		||||
use IO::Socket;
 | 
			
		||||
use IO::Select;
 | 
			
		||||
use Class::Struct;
 | 
			
		||||
use Digest::MD5 qw(md5);
 | 
			
		||||
use POSIX qw(WNOHANG mkfifo strftime);
 | 
			
		||||
use Fcntl qw(:flock);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#local to module
 | 
			
		||||
my $callback;
 | 
			
		||||
my $timeout;
 | 
			
		||||
my $port;
 | 
			
		||||
my $debug;
 | 
			
		||||
my $ndebug = 0;
 | 
			
		||||
my $sock;
 | 
			
		||||
my $noclose;
 | 
			
		||||
my %sessiondata; #hold per session variables, in preparation for single-process strategy
 | 
			
		||||
my %pendingtransactions; #list of peers with callbacks, callback arguments, and timer expiry data
 | 
			
		||||
my $enable_cache="yes";
 | 
			
		||||
my $cache_dir = "/var/cache/xcat";
 | 
			
		||||
 | 
			
		||||
sub process_request
 | 
			
		||||
{
 | 
			
		||||
    my $req      = shift;
 | 
			
		||||
    my $callback = shift;
 | 
			
		||||
    my $reqcmd   = shift;
 | 
			
		||||
    my $nodes    = $req->{node};
 | 
			
		||||
    my $command  = $req->{command}->[0];
 | 
			
		||||
    my $args     = $req->{arg};
 | 
			
		||||
    my @nodes    = $req
 | 
			
		||||
 | 
			
		||||
    if ($command eq 'mkvlan')
 | 
			
		||||
    {
 | 
			
		||||
        return mkvlan($req, $callback, $reqcmd);
 | 
			
		||||
    }
 | 
			
		||||
    elsif ($command eq 'chvlan')
 | 
			
		||||
    {
 | 
			
		||||
        return chvlan($req, $callback, $reqcmd);
 | 
			
		||||
    }
 | 
			
		||||
    elsif ($command eq 'lsvlan')
 | 
			
		||||
    {
 | 
			
		||||
        return lsvlan($req, $callback, $reqcmd);
 | 
			
		||||
    }
 | 
			
		||||
    elsif ($command eq 'rmvlan')
 | 
			
		||||
    {
 | 
			
		||||
        return rmvlan($req, $callback, $reqcmd);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sub mkvlan
 | 
			
		||||
{
 | 
			
		||||
    my $request  = shift;
 | 
			
		||||
    my $callback = shift;
 | 
			
		||||
    my $reqcmd   = shift;
 | 
			
		||||
 | 
			
		||||
    my $nodes = @{$req->{node}};
 | 
			
		||||
    my @args  = @{$req->{arg}} if(exists($req->{arg}));
 | 
			
		||||
    my @nodes = @{$req->{node}};
 | 
			
		||||
 | 
			
		||||
    @ARGV = @{$req->{arg}};
 | 
			
		||||
    GetOptions(
 | 
			
		||||
               't=s' => \$subnet,
 | 
			
		||||
               'm=s' => \$mask,
 | 
			
		||||
               'v=s' => \$vlan,
 | 
			
		||||
               'i=s' => \$interface,
 | 
			
		||||
               );
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
		Reference in New Issue
	
	Block a user