Read a resident file from acting primary after failover

This use case describes reading a resident file from acting primary after failover.

          Fileset: primary 
          State of the file in latest RPO at secondary: pre-migrated
          Action on the file from primary (synced to secondary): Update data
          TSM action on the file from secondary: none
          State of the file in the live filesystem of the secondary: resident
          Action: Unlink primary feigning disaster and failover to secondary
          State of the file in the live filesystem of the acting primary (after failover): resident
          Action on the file from acting primary: Read the file
          State of the in the live filesystem on the acting primary: resident

#create a new file from primary and flush it to home

hs22n21; Tue Sep 22 07:06:38; ~# dd if=/dev/urandom bs=1M count=10 of=/gpfs/fs2/drHSM-DRP-43/file

10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 1.32336 s, 7.9 MB/s

#migrate the file on the secondary

hs21n30; Tue Sep 22 07:07:37; ~# dsmmigrate /gpfs/fs1/drHSM-DRS-43/file

Tivoli Storage Manager
Command Line Space Management Client Interface
  Client Version 7, Release 1, Level 3.0
  Client date/time: 09/22/15   07:07:48
(c) Copyright by IBM Corporation and other(s) 1990, 2015. All Rights Reserved.

0 ;) hs21n30; Tue Sep 22 07:07:56; ~# dsmls /gpfs/fs1/drHSM-DRS-43/file

Tivoli Storage Manager
Command Line Space Management Client Interface
  Client Version 7, Release 1, Level 3.0
  Client date/time: 09/22/15   07:07:58
(c) Copyright by IBM Corporation and other(s) 1990, 2015. All Rights Reserved.

	ActS         ResS         ResB   FSt    FName
    10485760            0            0   m      file

#recall the file on secondary to make it pre-migrated

hs21n30; Tue Sep 22 07:08:01; ~# dsmrecall /gpfs/fs1/drHSM-DRS-43/file

Tivoli Storage Manager
Command Line Space Management Client Interface
  Client Version 7, Release 1, Level 3.0
  Client date/time: 09/22/15   07:08:18
(c) Copyright by IBM Corporation and other(s) 1990, 2015. All Rights Reserved.
0 ;) hs21n30; Tue Sep 22 07:08:18; ~# dsmls /gpfs/fs1/drHSM-DRS-43/file

Tivoli Storage Manager
Command Line Space Management Client Interface
  Client Version 7, Release 1, Level 3.0
  Client date/time: 09/22/15   07:08:20
(c) Copyright by IBM Corporation and other(s) 1990, 2015. All Rights Reserved.

	ActS         ResS         ResB   FSt    FName
    10485760     10485760        10240   p      file

#create a RPO snapshot

hs22n21; Tue Sep 22 07:06:43; ~# mmpsnap fs2 create -j drHSM-DRP-43 --rpo

Flushing dirty data for snapshot drHSM-DRP-43::psnap-rpo-C0A874465450C18C-260-15-09-22-07-08-31...
Quiescing all file system operations.
Snapshot drHSM-DRP-43::psnap-rpo-C0A874465450C18C-260-15-09-22-07-08-31 created with id 8993.
mmpsnap: The peer snapshot psnap-rpo-C0A874465450C18C-260-15-09-22-07-08-31 is created successfully.

#update the file from primary and flush it to secondary

hs22n21; Tue Sep 22 07:07:12; ~# dd if=/dev/urandom bs=1M seek=10 count=10 of=/gpfs/fs2/drHSM-DRP-43/file

10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 1.38068 s, 7.6 MB/s

#check state of file on secondary

0 ;) hs21n30; Tue Sep 22 07:10:29; ~# dsmls /gpfs/fs1/drHSM-DRS-43/file

Tivoli Storage Manager
Command Line Space Management Client Interface
  Client Version 7, Release 1, Level 3.0
  Client date/time: 09/22/15   07:10:32
(c) Copyright by IBM Corporation and other(s) 1990, 2015. All Rights Reserved.

	ActS         ResS         ResB   FSt    FName
    20971520     20971520        20480   r      file

#unlink primary feigning disaster

hs22n21; Tue Sep 22 07:08:40; ~# mmunlinkfileset fs2 drHSM-DRP-43

Fileset drHSM-DRP-43 unlinked.

#failover to secondary

hs21n30; Tue Sep 22 07:29:15; ~# mmafmctl fs1 failoverToSecondary -j drHSM-DRS-43 --restore

mmafmctl: failoverToSecondary restoring from psnap psnap-rpo-C0A874465450C18C-260-15-09-22-07-08-31
[2015-09-22 07:29:25] Restoring fileset "drHSM-DRS-43" from snapshot "psnap-rpo-C0A874465450C18C-260-15-09-22-07-08-31" of filesystem "/dev/fs1"

[2015-09-22 07:29:31] Scanning inodes, phase 1 ...
[2015-09-22 07:29:31] 32506880 inodes have been scanned, 50% of total.
[2015-09-22 07:29:32] 65013760 inodes have been scanned, 100% of total.
[2015-09-22 07:29:32] Constructing operation list, phase 2 ...
[2015-09-22 07:29:32] 0 operations have been added to list.
[2015-09-22 07:29:32] 2 operations have been added to list.
[2015-09-22 07:29:32] Deleting the newly created files, phase 3 ...
[2015-09-22 07:29:33] Deleting the newly created hard links, phase 4 ...
[2015-09-22 07:29:33] Splitting clone files, phase 5 ...
[2015-09-22 07:29:34] Deleting the newly created clone files, phase 6 ...
[2015-09-22 07:29:35] Moving files, phase 7 ...
[2015-09-22 07:29:35] Reconstructing directory tree, phase 8 ...
[2015-09-22 07:29:36] Moving files back to their correct positions, phase 9 ...
[2015-09-22 07:29:37] Re-creating the deleted files, phase 10 ...
[2015-09-22 07:29:37] Re-creating the deleted clone parent files, phase 11 ...
[2015-09-22 07:29:38] Re-creating the deleted clone child files, phase 12 ...
[2015-09-22 07:29:39] Re-creating the deleted hard links, phase 13 ...
[2015-09-22 07:29:39] Restoring the deltas of changed files, phase 14 ...
[2015-09-22 07:29:40] Restoring the attributes of files, phase 15 ...
[2015-09-22 07:29:41] Restore completed successfully.
[2015-09-22 07:29:41] Clean up.
Primary Id (afmPrimaryID) 12646758592946767367-C0A874195583B621-131
Fileset drHSM-DRS-43 changed.
Promoted fileset drHSM-DRS-43 to Primary

#read file from secondary

hs21n30; Tue Sep 22 07:29:56; ~# cat /gpfs/fs1/drHSM-DRS-43/file > /dev/null ; echo $?

0