1.down the latest build
2.switchdiscover --range 10.4.25.0/24,10.0.0.0/32 -r -w
<host><status state="up" reason="arp-response"></status></host>
<hostnames>
.....
address addr="10.4.25.255" addrtype="ipv4" />
<host><status state="down" reason="no-response"></status></host></hostnames>
<runstats><finished time="1434110642" timestr="Fri Jun 12 08:04:02 2015"><hosts up="1" down="256" total="257"></hosts></finished></runstats>
Writing the data into xCAT DB....
lsdef
c910f04x27v05:~ # lsdef
c910f04x27v06 (node)
c910f04x27v07 (node)
--------------> no switch info here
c910f04x27v05:~ # switchdiscover --range 10.4.25.0/24,10.0.0.0/32 -x -w
Discovering switches using nmap. It may take long time...
<switch>
<comments>Juniper</comments>
<groups>switch</groups>
<hostname>switch_10_4_25_1</hostname>
<ip>10.4.25.1</ip>
<mac>2C:6B:F5:37:45:7F</mac>
<mgt>switch</mgt>
<nodetype>switch</nodetype>
<objtype>switch</objtype>
<switchtype>Jun</switchtype>
</switch>
Writing the data into xCAT DB....
c910f04x27v05:~ # lsdef
c910f04x27v06 (node)
c910f04x27v07 (node)
c910f04x27v05:~ #
---------------> still could not work
according to the code:
if (!$display_done) {
#display header
$format = "%-12s\t%-18s\t%-20.20s\t%-12s";
$header = sprintf $format, "ip", "name","vendor", "mac";
send_msg(\%request, 0, $header);
my $sep = "------------";
send_msg(\%request, 0, sprintf($format, $sep, $sep, $sep, $sep ));
.......
if (exists($globalopt{w})) {
send_msg(\%request, 0, "Writing the data into xCAT DB....");
xCATdB($result, \%request, $sub_req);
}
------------->if switchdiscover does not include such attributes s as : -r,-x,-z,-r then this command could add the node info into xCATdb.So if switchdiscover use all these attributes ,switch info could not been wrote into DB.
I tested same command on the rhel6.6 system with Jun 9th core snap. I didn't recreate this issue. please verify this BUG again.
[root@c910f02c06p02 ~]# lsdef
c910f02c06p03 (node)
c910f02c06p04 (node)
c910f02c06p05 (node)
c910f02c06p06 (node)
c910f02c06p07 (node)
c910f02c06p08 (node)
c910f02fsp06 (node)
c910hmc01 (node)
switch_10_0_0_131 (node)
switch_9_114_38_241 (node)
test1 (node)
[root@c910f02c06p02 ~]# tabdump switches
switch,snmpversion,username,password,privacy,auth,linkports,sshusername,sshpassword,protocol,switchtype,comments,disable
"s1","SNMPv1","snmpadmin","abc","DES","SHA","1:s1","snmpssh","xyz","ssh","lindadummy",,
"111switch_10_0_0_131",,,,,,,"admin","admin",,"Mellanox","Mellanox Technologies",
"switch_10_0_0_131",,,,,,,,,,"Mellanox","Mellanox Technologies",
"switch_9_114_38_241",,,,,,,"admin","admin",,"Mellanox",,
[root@c910f02c06p02 ~]# switchdiscover --range 10.4.25.0/24,10.0.0.0/32 -r -w
Discovering switches using nmap. It may take long time...
<nmaprun scanner="nmap" args="/usr/bin/nmap -sP -oX - 10.4.25.0/24 10.0.0.0/32" start="1434466582" startstr="Tue Jun 16 10:56:22 2015" version="5.51" xmloutputversion="1.03">
<verbose level="0">
<debugging level="0">
<host><status state="up" reason="arp-response"></status></host></debugging></verbose></nmaprun>
<hostnames>
<hostname name="switch_10_4_25_1" type="PTR">
</hostname></hostnames>
<times srtt="410" rttvar="3789" to="100000">
<runstats><finished time="1434466584" timestr="Tue Jun 16 10:56:24 2015" elapsed="2.26" summary="Nmap done at Tue Jun 16 10:56:24 2015; 257 IP addresses (1 host up) scanned in 2.26 seconds" exit="success"><hosts up="1" down="256" total="257">
</hosts></finished></runstats>
</times>
Writing the data into xCAT DB....
[root@c910f02c06p02 ~]# lsdef
c910f02c06p03 (node)
c910f02c06p04 (node)
c910f02c06p05 (node)
c910f02c06p06 (node)
c910f02c06p07 (node)
c910f02c06p08 (node)
c910f02fsp06 (node)
c910hmc01 (node)
switch_10_0_0_131 (node)
switch_10_4_25_1 (node) <<<<<<--- NEW
switch_9_114_38_241 (node)
test1 (node)
[root@c910f02c06p02 ~]# tabdump switches
switch,snmpversion,username,password,privacy,auth,linkports,sshusername,sshpassword,protocol,switchtype,comments,disable
"s1","SNMPv1","snmpadmin","abc","DES","SHA","1:s1","snmpssh","xyz","ssh","lindadummy",,
"111switch_10_0_0_131",,,,,,,"admin","admin",,"Mellanox","Mellanox Technologies",
"switch_10_0_0_131",,,,,,,,,,"Mellanox","Mellanox Technologies",
"switch_9_114_38_241",,,,,,,"admin","admin",,"Mellanox",,
"switch_10_4_25_1",,,,,,,,,,"Jun","Juniper networks", <<<<<<<----NEW
The team discussed this bug in our meeting, the problem is that the switch object uses the table colums designed for nodes. We could not have two objects(node and switch) share the same table column. If the switches need the attributes "ip", "groups", "nodetype" and "mgt", we need to add these attributes to the switches table.
Sorry for my bug description,such as the details here:
1. switchdiscover --range 10.4.25.0/24,10.0.0.0/32 -r -w
2.tabdump switches
switch,snmpversion,username,password,privacy,auth,linkports,sshusername,sshpassword,protocol,switchtype,comments,disable
"switch_10_4_25_1",,,,,,,,,,"Jun","Juniper networks",
3. tabdump nodelist
node,groups,status,statustime,appstatus,appstatustime,primarysn,hidden,updatestatus,updatestatustime,zonename,comments,disable
"c910f04x27v09","all","booted","06-16-2015 09:51:28",,,,,,,,,
"switch_10_4_25_1","switch",,,,,,,,,,,
root@c910f04x27v08:~#
-----------> this switch has both node and switch attributes
4. rmdef switch_10_4_25_1
5. switchdiscover --range 10.4.25.0/24,10.0.0.0/32 -r -w
Writing the data into xCAT DB....
lsdef
c910f04x27v08:~ # lsdef
--------------> no switch info here
6.tabdump switches
switch,snmpversion,username,password,privacy,auth,linkports,sshusername,sshpassword,protocol,switchtype,comments,disable
"switch_10_4_25_1",,,,,,,,,,"Jun","Juniper networks",
Guang Cheng, it should be okay for node and switch to share the same attributes. This way we do not need to modify makehost, for example, to put the ip from hosts table to /etc/hosts
There are 2 side for this problem.
When removing a switch, we should use
On the other side, in switchdiscover code, when writing to the DB we have logic like this:
In the chdef, we did not put groups=switch, that is why the switch did not get to the nodelist table. We will added a second chdef call"
As Ling's suggestion, I modified the code
$ git diff xCAT-server/lib/xcat/plugins/switchdiscover.pm
diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.p
index 4a945e0..ff64d27 100644
--- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm
+++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm
@@ -898,6 +898,7 @@ sub xCATdB {
if ($::RUNCMD_RC == 0)
{
$ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','switch','-o',$host,"ip=$ip",
+ $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','switch','-o',$host,'-p','gro
} else {
$ret = xCAT::Utils->runxcmd( { command => ['mkdef'], arg => ['-t','switch','-o',$host,'groups=
}
Verify the command again. looks good.
Thanks Jun Xia, please verify again.
commit to 2.10
commit 13ced6d09a3764f14e8ba0b747d86dbec7851815
hi,
I have test the command again,some other problems:
My steps:
1.root@c910f02c01p13 xCAT]# switchdiscover --range 10.4.25.1 -w
Discovering switches using nmap for . It may take long time...
ip name vendor mac
------------ ------------ ------------ ------------
10.4.25.1 switch_10_4_25_1 Juniper networks 2C:6B:F5:37:45:7F
Writing the data into xCAT DB....
2.
[root@c910f02c01p13 xCAT]# lsdef
switch_10_4_25_1 (node)
3.
[root@c910f02c01p13 xCAT]# switchdiscover --range 10.4-5.20-25.1 -w
Discovering switches using nmap for . It may take long time...
ip name vendor mac
------------ ------------ ------------ ------------
10.4.25.1 switch_10_4_25_1 Juniper networks 2C:6B:F5:37:45:7F
10.5.23.1 switch_10_5_23_1 Cisco A8:97:DC:05:2E:00
10.5.25.1 switch_10_5_25_1 Cisco Systems 00:15:FA:05:0C:C5
10.5.24.1 switch_10_5_24_1 Juniper Networks 5C:5E:AB:64:CA:7F
Writing the data into xCAT DB....
The '-p' and '-m' options are not valid for the mkdef command.
The '-p' and '-m' options are not valid for the mkdef command.
The '-p' and '-m' options are not valid for the mkdef command.
4.
[root@c910f02c01p13 result]# tabdump switches
switch,snmpversion,username,password,privacy,auth,linkports,sshusername,sshpassword,protocol,switchtype,comments,disable
"switch_10_4_25_1",,,,,,,,,,"Jun","Juniper networks"
This issue actually caused by chdef/mkdef subroutines. In the DBobjectdefs.pm, all the global need to undefined if not defined in GetOpts.
In this case, "-p" options is left from chdef command.
I will open another Bug for track this issue.