7.9 SCSI Lock
SCSI Lock uses SAN protocol which is called SCSI-3 PR(Persistent Reservation). It is essential to equip SCSI-3 PR(Persistent Reservation) storage that to use SCSI Lock resource. SCSI-3 PR supports disk access from a singe node and multiple nodes. And also it blocks access to the disk from other nodes.
When a disk volume is managed by this agent, only one node can access that. SCSI reservations are needed to prevent any data corruption in environment where disk volumes are shared between nodes.
* Note - If the storage does not support SCSI3-PR (Persistent Reservation), it cannot be used.
Table of Contents
How to work
Disk resource added through SCSI Lock has registration key for each node and it can be checked by it's attribute. Online node sets its Registered-key as Reserved-Key.
Only the node that has imported the disk with this key can access to the disk.
By setting SCSI Lock resource's dependency with shared disk resource, exclusive access to data is protected in split-brain situation.
When split-brain is occurred, standby node also attempt to bring online a shared disk during active node keep online state. But standby node cannot register the Reserved-Key if active node dose not release this and it gives up to bring online the resources.
Requirement
External storage must support SCSI-3 PR.
Volume should be configured by LUN(Logical Unit Number) unit. Partitioned volume in a LUN is not supported.
Types of Shared disk resource
To configure HA with shared storage environment, MCCS provides shared disk agent and SCSI Lock agent.
You can use only shared disk resource, or use with SCSI Lock resource. Shared disk resource depends on SCSI Lock resource and multiple shared disk resource can depends on a SCSI Lock resource.
An environment where only shared disk agent is used
- The disk volume is partitioned in a LUN.
- External storage does not support SCSI-3 PR.
Difference between shared disk agent and SCSI Lock agent
1. Shared disk agent manage disk access in local node, but SCSI Lock agent manage node access in storage.
Disk management function in software perspective (shared disk agent)
- Shared disk agent manage access control of shared disk through Mantech Volume Lock (MVL) kernel driver.
- Data will be corrupted if writing access is done from multiple nodes in shared disk. MVL locks access to the shared disk resource. You cannot access the volume of shared disk before it unlocks access. Only a node allow to access to the shared disk resource by this.
- MVL can be managed both in LUN unit and partition unit.
Disk management function in hardware perspective (SCSI Lock agent)
- SCSI Lock agent manage Write control and access control of LUN by using SAN protocol.
- Only the node that has imported the disk with this key can access to the disk.
2. Both the shared disk agent and the SCSI reservation agent can read and write data.
However, a SCSI reservation agent intends to protect the shared storage resource, so you are not recommended to use it alone to read and write data.
Configuration
MCCS uses the MVL driver to manage DATA-DISK(Share disk) and uses the SCSI3-PR function to manage LOCK-DISK(SCSI lock).
By setting the dependency between the SCSI lock resource and the shared disk resource, you can prevent damages to DATA-DISK caused by Split-Brains and so on.
[Figure] Shared disk and SCSI Lock resource configured in same LUN
DATA-DISK
- It is a shared disk resource and contains application datas.
LOCK-DISK
- It is SCSI lock resource and contains reservation key.
Configuration Sample
[Figure] Shared disk and SCSI Lock resource configured in same LUN
First, register shared disk agent according to the procedure and after check if it works normally, check disk of SCSI Lock agent.
Registration Procedures
- Install MCCS on both nodes
- Set group
- Add shared disk resource
- Enable shared disk resource and check offline on both nodes
- Add SCSI Lock resource (Select drive letter that created shared disk resource)
- Enable SCSI Lock resource and check key in resource attribute of MCCS console.
- Configure dependency of resources (SCSI Lock resource must go online first)
- Test failover from node 2 to 1
- Test failover from node 1 to 2
- Set application that customer uses
Adding
Add the SCSI lock resource to a group.
- When add a resource from a group name, select a group → right click → 'Add Resource'. Or select Edit(E) from the main menu bar → select 'Add Resource'. Or select 'Add Resource' icon from the tool bar.
- Select 'SCSILock' from Resource Type lists and click 'Next' button. When add a resource from the SCSILock resource type name, this step will be skipped.
- Enter the resource name. If you skip enter resource name, this will be given 'SLock_value' which value is selected driver letter.
- Select the driver letter.
[Figure] Adding SCSI lock resource - Click 'Finish' button to add the SCSI lock resource.
Deleting
Select resource type → right click → delete resource.
State
The following table explains the state of SCSI lock resource.
State | Agent command | Description | Note |
---|---|---|---|
Online Key is exclusively in reservation state in online node. Key cannot be registered in other node. | Offline | It changes to offline state while maintaining the reservation. | |
Monitoring | Check if there is a reservation made on the disk. | ||
Offline 1. Disk is reserved but the shared disk resource is offline. | Online | Register a key for a disk reservation and wait for a response from the other node. | |
Monitoring | Check if there is a reservation made on the disk. | ||
Fault It occurs when a reservation is taken away when it is online. | Online | Register a key for a disk reservation and wait for a response from the other node. | |
Offline | It changes to offline state while maintaining the reservation. |
Attribute
Display the specified attribute of SCSI lock resource.
Attribute | Description | Type | Default | Edit | Note |
DiskDUID | DUID(Device Unique ID, 16 byte as Hex value) of disk is used as identifier. Specify DUID of reserve disk. | STRING | X | ||
DriveLetter | Disk to be used for reservation is specified by drive letter. | STRING | X | ||
Key | MAC address is used as Reserved-Key. This key is automatically set by agent. | STRING | |||
PreemptWaitCount | Time waiting for permission of other node before reservation | INTEGER | 2 times | O | |
PrType | This attribute decides on how to give the permission of reserve disk access as Persist Type specified in SCSI3-PR spec. | INTEGER | Prtype=5 | O | |
Fault | SCSI 디스크가 정상인지 비정상인지 나타냅니다. | STRING | false | X |
scsicmd.cmd Command
Syntax
scsicmd [option] [diskID]
Option
This is the utility to use SCSI 3 PR command more easily. Following is the provided options
Option | Description |
-c diskId | It deletes Reserved-Key and Registered-Key of local node of disk. |
-cf diskId | It forcely deletes Reserved-Key and Registered-Key of local node of disk. |
-r diskId | Registers diskld-specified disk. |
-l diskId | If node is yet to reserve, close the specified disk and reserve. |
-lf diskId | It forcelu closes specified disk and reserve, even node has been reserved. |
-h | It shows help of scsicmd. |
no option | It shows the state information regarding disk reservation when there is no other option. |
Print Sample
The output of 'scsicmd' command from source node (C29043F13 is MAC Address of NIC from source node.)
Disk | DUID(DeviceUniqueID) | Letter | PR | Reserved-Key | Registered-Keys |
---|---|---|---|---|---|
0 | C | No | none | none | |
1 | D | No | none | none | |
2 | 00c0ffd796550000f38be34f01000000 | E | Yes | none | none |
3 | 00c0ffd796550000138ce34f01000000 | F | Yes | C29043F13* | C29043F13* |
4 | 00c0ffd7965500002e8ce34f01000000 | G | Yes | none | none |
The output of 'scsicmd' command from target node (C29043F13 is MAC Address of NIC from source node.)
Disk | DUID(DeviceUniqueID) | Letter | PR | Reserved-Key | Registered-Keys |
---|---|---|---|---|---|
0 | C | No | none | none | |
1 | D | No | none | none | |
2 | 00c0ffd796550000f38be34f01000000 | E | Yes | none | none |
3 | 00c0ffd796550000138ce34f01000000 | F | Yes | C29043F13 | C29043F13 |
4 | 00c0ffd7965500002e8ce34f01000000 | G | Yes | none | none |
Disk 0 (C:)'s PR is set to "No". So, you can see that the disk does not support SCSI3-PR. (In general, the "C" drive is the system booting disk and it does not support SCSI.)
Besides, Disk 1 (D:)'s PR is set to "No". You can see that the disk does not support SCSI3-PR.(Internal Disk does not support SCSI3-PR.)
Disk 2 (E:) and Disk 4 (G:)'s SCSI3-PR is set to "Yes". So, it means that the storage used supports SCSI3- PR. Their Reserved-Key and Registered-Keys are set to "none". It means that they are not yet to be registered.
Disk 3 (F:)'s Reserved-Key and Registered-Keys at the source node are set to C29043F13* and C29043F13* and at the target node to C29043F13 and C29043F13. This means that a SCSI reservation agent was used to create the resource.
The (*) marked node with the Reserved-Key and Registered-Keys indicates that a disk is reserved. In addition, only the * marked node with the Reserved-Key value (ex: C29043F13*) can access the disk.