diff --git a/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst b/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst index 395ef33ee..c77901a03 100644 --- a/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst @@ -471,7 +471,7 @@ OPTIONS \ **vlan**\ - Get or set vlan ID. For get vlan ID, if vlan is not enabled, 'BMC VLAN disabled' will be displayed. For set vlan ID, the valid value are [1-4096]. + Get or set VLAN ID. Valid VLAN IDs are 1-4094. On IPMI managed nodes, use \ **vlan=off**\ or \ **vlan=disable**\ to disable VLAN tagging. diff --git a/xCAT-client/pods/man1/rspconfig.1.pod b/xCAT-client/pods/man1/rspconfig.1.pod index c349e87d2..412d1daeb 100644 --- a/xCAT-client/pods/man1/rspconfig.1.pod +++ b/xCAT-client/pods/man1/rspconfig.1.pod @@ -372,7 +372,7 @@ Get or set hostname on the service processor. =item B -Get or set vlan ID. For get vlan ID, if vlan is not enabled, 'BMC VLAN disabled' will be displayed. For set vlan ID, the valid value are [1-4096]. +Get or set VLAN ID. Valid VLAN IDs are 1-4094. On IPMI managed nodes, use B or B to disable VLAN tagging. =item B diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 0553acdc7..09c19aed8 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -895,10 +895,10 @@ sub setnetinfo { if ($subcommand eq "thermprofile") { return idpxthermprofile($argument); } - if ($subcommand eq "alert" and $argument eq "on" or $argument =~ /^en/ or $argument =~ /^enable/) { + if ($subcommand eq "alert" and ($argument =~ /^(on|en|enable|enabled)$/i)) { $netfun = 0x4; @cmd = (0x12, 0x9, 0x1, 0x18, 0x11, 0x00); - } elsif ($subcommand eq "alert" and $argument eq "off" or $argument =~ /^dis/ or $argument =~ /^disable/) { + } elsif ($subcommand eq "alert" and ($argument =~ /^(off|dis|disable|disabled)$/i)) { $netfun = 0x4; @cmd = (0x12, 0x9, 0x1, 0x10, 0x11, 0x00); } @@ -946,18 +946,22 @@ sub setnetinfo { } @cmd = (0x01, $channel_number, 12, @mask); } elsif ($subcommand =~ m/vlan/) { - unless ( int($argument) == $argument ) { - $callback->({ errorcode => [1], error => ["The input $argument is invalid, please input an integer"] }); - return; + if ($argument =~ /^(off|disable|disabled)$/i) { + @cmd = (0x01, $channel_number, 0x14, 0x00, 0x00); + } else { + unless ( $argument =~ /^\d+$/ ) { + $callback->({ errorcode => [1], error => ["The input $argument is invalid, please input an integer or 'off'"] }); + return; + } + unless (($argument>=1) && ($argument<=4094)) { + $callback->({ errorcode => [1], error => ["The input $argument is invalid, valid value [1-4094] or 'off'"] }); + return; + } + my @vlanparam = (); + $vlanparam[0] = ($argument & 0xff); + $vlanparam[1] = 0x80 | (($argument & 0xf00) >> 8); + @cmd = (0x01, $channel_number, 0x14, @vlanparam); } - unless (($argument>=1) && ($argument<=4096)) { - $callback->({ errorcode => [1], error => ["The input $argument is invalid, valid value [1-4096]"] }); - return; - } - my @vlanparam = (); - $vlanparam[0] = ($argument & 0xff); - $vlanparam[1] = 0x80 | (($argument & 0xf00) >> 8); - @cmd = (0x01, $channel_number, 0x14, @vlanparam); } elsif ($subcommand =~ m/ip/ and $argument =~ m/dhcp/) { @cmd = (0x01, $channel_number, 0x4, 0x2); } elsif ($subcommand =~ m/ip/) {