Enhanced Resource Names for CIFS

With the putback of SMB functionality in sharemgr, the concept of resources has been significantly enhanced. The first enhancement is that resource names are now full objects within sharemgr. This was necessary in order to fully map SMB functionality into the framework. Second, there can be multiple resources associated with a share.

For SMB, a sharemgr resource implements an SMB share name. SMB allows sharing the same path under multiple share names, each with potentially different properties associated with it. This is what lead to supporting multiple resources for each share. With NFS, the same resource names may be used but the protocol does not really support the concept so they are treated simply as alternate names for the share.

The names allowed for resources are stored internally in UTF-8 after conversion from the locale in effect when the name is created. There are some limitations in what characters may be in a resource name due to restrictions imposed by the SMB environment.  Basically, names may contain any characters except for:

    " / \\ [ ] : | < > + ; , ? \* = <tab>

Spaces are allowed but require careful quoting on the command line.

Using resource names follows the existing sharemgr syntax of: sharemgr set-share -s path -r resource group

When the SMB protocol is enabled on a group, resource names MUST be supplied. This is a requirement of the SMB protocol. Additional names are added using the same syntax as adding the original share and resource. Removing resource names uses the remove-share subcommand syntax: "sharemgr remove-share -s path -r resource group". If multiple resources exist, then just the specified resource is removed. If there is only one resource defined, then the resource and share will be removed.  If remove-share is used without the "-r resource" option, then all resources and the share will be removed.

To illustrate, the following example will create a group "homegroup" with default protocols of nfs and smb. Then a share will be added followed by adding a second resource to the share.

    $ sharemgr create homegroup
    $ sharemgr add-share -s /export/home -r home homegroup
    $ sharemgr show -vp homegroup
    homegroup   nfs=() smb=()
          home=/export/home

    $ sharemgr add-share -s /export/home -r maison homegroup
    $ sharemgr show -vp homegroup
    homegroup   nfs=() smb=()
          /export/home
                   home=/export/home
                   maison=/export/home

The above would result in /export/home being shared by NFS and "home" and "maison" being shared via SMB. If maison should be in a different Active Directory Container, this can be done by setting the "ad-container" property on the maison resource. 

    $ sharemgr set -P smb -p ad-container=cn=Other -r maison -s /export/home homegroup
    $ sharemgr show -vp homegroup
    homegroup   nfs=() smb=()
          /export/home
                   home=/export/home
                   maison=/export/home   smb=(ad-container=cn=Other)

Because resource names are full objects, it is possible to place SMB properties at any of the three levels: group, share and resource with resources inheriting as appropriate just as it does with group and share for NFS.

Renaming a resource is implemented with the set-share sub-command. To rename the resource "maison" to "chateau", use sharemgr set-share -r maison=chateau -s /export/home homegroup

Resource names are global to all groups and must be unique.

If you want to add the SMB protocol to an existing group, it can be done with "sharemgr create -P smb group" command. This assumes that a resource name has been added to each existing share.  If you want to enable SMB but not go through the process of adding a resource name to each share, sharemgr will do it for you if you use the "-f" option.  E.g. "sharemgr create -P smb -f group" will enable SMB after adding a constructed resource name to each share.  The constructed resource name will be based on the path of the share with all the disallowed characters (/) being replaced with underscore (_). This will get things running and allows you to rename the resources later.

 

 

 

Comments:

Post a Comment:
Comments are closed for this entry.
About

dougm

Search

Categories
Archives
« July 2015
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
       
Today