dan_gill

NAS Configuration replication

Discussion created by dan_gill on Dec 17, 2012
Latest reply on Dec 18, 2012 by RobPol

In the NSAT course we go over the NRE.txt script which is supposed to permit copying a configuration from one NAS to a slave NAS. The problem is the script does not seem to work. It always returns error code 2 (communication error).

 

Below is the example code:

master_nas = "/Your/Master/Hub/nas"  nas_slaves = { "/Your/Slave/Hub1/nas", "Your/Slave/Hub2/nas" }  master_getpds = pds.create() pds.putString(master_getpds, "name", "nas") ret, rc = nimbus.request( master_nas .. "/controller", "probe_config_get", master_getpds) pds.delete (master_getpds)  cfg = pds.create() for index,value in pairs(ret) do      if (string.match(index, "^/filters")) then           if (type(value) == "table") then                for key,value in pairs (value) do                     print (index .. "/" .. key, " = ", value)                     pds.putString(cfg, index .. "/" .. key, value)                end           end      end end  -- clearcfg pds to clear the existing /filters section clearcfg = pds.create() pds.putString(clearcfg, "name", "nas") pds.putString(clearcfg, "section", "/filters")  -- populatecfg pds to populate a new /filters section populatecfg = pds.create() pds.putString (populatecfg, "name", "nas") pds.putPDS (populatecfg, "as_pds", cfg)   -- restart pds to restart the nas probe after applying changes restart = pds.create()  for index, nas_slave in pairs (nas_slaves) do  print( "** " .. nas_slave .. " **" )  ret2, rc2 = nimbus.request (nas_slave .. "/controller", "probe_config_set", clearcfg) if (rc2 ~= 0) then print ("There was an error clearing the /filter section for the nas on " .. nas_slave) end  ret2, rc2 = nimbus.request (nas_slave .. "/controller", "probe_config_set", populatecfg) if (rc2 ~= 0) then print ("There was an error populating the /filter section for the nas on " .. nas_slave) end  ret2, rc2 = nimbus.request (nas_slave .. "/nas", "_restart", restart) if (rc2 ~= 0) then print ("There was an error restarting the nas on " .. nas_slave) end end  pds.delete (restart) pds.delete (populatecfg) pds.delete (clearcfg) pds.delete (cfg)

 Any ideas on the problem? It fails starting on the clearing, populating and restarting sections. Getting the config from the master NAS is the only successful part of the script.

Outcomes