Thursday, 18 May 2017

Translating CIFS Shares from 7-Mode to cDOT Tool - CS7C.ps1 - Part 1 of 2: Information

I wasn’t going to post this, but since someone asked, why not.

I previously blogged about a bespoke 7 to C migration tool that I wrote called 7CGT. The tool I present here - CS7C (for CIFS Shares 7 to C) - is essentially the original 7CGT just massively cut down with only the bit that translates 7-Mode CIFS shares to C-Mode Clustershell commands. CS7C enables scripted application of the to-be-transitioned shares.

It’s easiest to explain how it works with a very simple demo. It works offline and online - I demo the online method since it’s the easiest to demo. The online method is where you have access to 7-Mode and cDOT systems; offline is where you only have access to config files.

Demo - Walkthrough

7-Mode Controller =192.168.0.121
vFiler = vfiler0
Volume = vol1_NAS
Cluster = cluster1
Vserver = vserver1

1) Create a file called “CS7C.VolsToMigrate.txt”. This file contains lines of:

7-Mode Controller,vFiler,volume

In this example, the “CS7C.VolsToMigrate.txt” file contains:

192.168.0.121,vfiler0,vol1_NAS

2) Run CS7C in PowerShell>


.\CS7C.ps1


3) Answer the prompts.
4) View the output.

Demo - The Prompts

See the images below for screenshots taken from the PowerShell.

The prompts and answers in this demo are:


- Output File Prefix? fas01_vfiler0_vol1_NAS_cluster1_vserver1
- Are volume names changing going to CDOT (yes/no)? n
- Online acquisition of 7-Mode Config Files (yes/no)? y
- 7-Mode Username: root
- 7-Mode Password: ********
- Enter the Cluster: cluster1
- Enter the SVM: vserver1
- Online cDOT data acquisition (yes/no)? y
- Cluster Username: admin
- Cluster Password: ********
- Are volumes mounted with /vol in the CDOT Junction Path (yes/no)? y
- Is this workstation on the same Domain as the systems being transitioned (yes/no)? y


Image: CIFS Shares 7 to C: Demo Data Collection part I

Image: CIFS Shares 7 to C: Demo Data Collection part II

Image: CIFS Shares 7 to C: Presenting the 7-Mode CIFS shares (for verification since it parses the cifsconfig_share.cfg file(s))

Demo - The Output

And below is the output we get.
Note: It creates specific VOLNAME$ shares. This may not be something you want but I left it in anyway.


## CS7C: COMMANDS GENERATED 18May2017 ##
## ================================== ##

# CAVEAT UTILITOR! This tool comes with no support and no warranty, please REVIEW and SANITY CHECK!
# '++ WARNING ++' indicates detected conflicts - search the output for these and review.
# NB: Transition commands should be generated from the LATEST 7-Mode and CDOT information!

## >>>>> COMMANDS TO APPLY CIFS SHARES <<<<< ##
## ========================================= ##

## CIFS: SHARE CREATE COMMANDS FOR NEW VOLUME$ SHARES ##
## ================================================== ##

# (1) Create VOLUME$ shares with default properties
# (2) Removes the default Everyone access
# (3) Adds BUILTIN\Administrators with Full_Control
# (4) Adds NT AUTHORITY\Authenticated Users with Change

# cluster1::>

vserver cifs share create -vserver vserver1 -share-name vol1_NAS$ -path /vol/vol1_NAS -share-properties browsable,oplocks,changenotify -symlink-properties symlinks -offline-files manual -vscan-fileop-profile standard

# cluster1::>

vserver cifs share access-control create -vserver vserver1 -share vol1_NAS$ -user-or-group BUILTIN\Administrators -permission Full_Control

# cluster1::>

vserver cifs share access-control create -vserver vserver1 -share vol1_NAS$ -user-or-group "NT AUTHORITY\Authenticated Users" -permission Change

# cluster1::>

vserver cifs share access-control delete -vserver vserver1 -share vol1_NAS$ -user-or-group Everyone

## CIFS: SHARE CREATE AND ACCESS COMMANDS ##
## ====================================== ##

# NB1: We ignore the 7-Mode default shares ETC$,HOME,C$ and OLDVOLUMENAME$ shares
# NB2: A CIFS share create automatically gives Everyone Full_control, we do not recreate this!
# Before starting please run the below:

# cluster1::>

rows 0
cifs share access-control show -fields share -vserver vserver1
# RECORD THE NUMBER OF ACLS ABOVE FOR LATER USE!

## FOR 192.168.0.121 AND VFILER vfiler0 ##


# cluster1::>

vserver cifs share create -vserver vserver1 -share-name "cifstest" -path "/vol/vol1_NAS" -share-properties browsable,oplocks,changenotify -symlink-properties symlinks -offline-files manual -vscan-fileop-profile standard
vserver cifs share create -vserver vserver1 -share-name "cifstest2" -path "/vol/vol1_NAS" -share-properties browsable,oplocks,changenotify -symlink-properties symlinks -offline-files manual -vscan-fileop-profile standard
vserver cifs share create -vserver vserver1 -share-name "cifstest3" -path "/vol/vol1_NAS" -share-properties browsable,oplocks,changenotify -symlink-properties symlinks -offline-files manual -vscan-fileop-profile standard

# cluster1::>


# TO VERIFY THE CORRECT NUMBER OF SHARES HAVE BEEN CREATED:

# cluster1::>

cifs share show -path *vol1_NAS* -fields share-name -vserver vserver1
# EXPECTED SHARES = 4


# TO VERIFY THE CORRECT NUMBER OF ACLS EXIST:

# cluster1::>

cifs share access-control show -fields share -vserver vserver1
# EXPECTED ADDITIONAL ACLS = 3



No comments:

Post a Comment