Network Storage

From LinuxMCE
Revision as of 05:18, 3 November 2007 by Rwilson131 (Talk | contribs)

Jump to: navigation, search

Summary: How Network Attached Storage (NAS) and Windows shares are made plug and play

First, the detected event is fired.

For a NAS this comes from dhcp monitor and has the ip/mac and plug and play plugin figures out what it is, like this:

 /usr/pluto/bin/MessageSend dcerouter 0 -1001 2 65 52 3 53 2 5 "00:0D:0B:99:10:43" 28 "192.168.80.7"

For the “scan the network for windows shares” utility that always runs in the background, it explicitly sends a device detected event with the device template Generic File Server 1837, like this:

 /usr/pluto/bin/MessageSend dcerouter 0 -1001 2 65 52 3 53 2 49 1837

Both the ‘generic file server’ and the nas devices like Maxtor & buffalo have a device data called “Pre Pnp Script”, which is set to: /usr/pluto/bin/CheckNASForPasswords.sh. This means that before actually creating the device, this script will be run and is expected to send a command CMD_Pre_Pnp_Script_Done which includes additional parameters. In the script the key thing is the: "182|1" change that 1 to a 0 if no password is required. Maybe we will need a different script for different NAS devices.

After that script runs, if 182|1 was specified, the user will be prompted for the usernname and password, as per: Pnp_PreCreateOptions::OkayToCreateDevice with the screen: SCREEN_Get_Username_Password_For_Devices.

Once the device is created, the configure script will be ran, for example: Configure_1794.sh for the Buffalo. This script should lookup the username and password for the device from the database and fire a 'device detected' for each network share, as follows:

 /usr/pluto/bin/MessageSend dcerouter X -1001 2 65 52 3 53 2 49 1768 55 "182|1"

That that the X must be the device created above, since the file share will be a child of that. 1768 is the template for a samba share, 1769 for nfs. If the share does not require a password, leave off the 55 "182|1". If the username and password already specified in the database are valid for the share, then instead of 55 "182|1" do 55 "127|username|128|password".

This will create the child device for each share and prompt the user if the username or password are needed.