Comment 3 for bug 1864419

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

@vybava,

I just realized the bug description has the exact command sequence you need. But I'm putting again in this comment to make things easier. Please follow the order that was written bellow:

##
## NODE #1
##

# tell "fence_scsi" agent that node 1 is "on"

$ sudo fence_scsi --verbose -n 10.250.3.10 -d /dev/sda -k 123abc -o on

2020-02-24 18:37:01,701 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:37:01,705 DEBUG: 0
2020-02-24 18:37:01,706 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:37:01,709 DEBUG: 0
2020-02-24 18:37:01,709 INFO: Executing: /usr/bin/sg_persist -n -i -k -d /dev/sda
2020-02-24 18:37:01,712 DEBUG: 0 PR generation=0x2, there are NO registered reservation keys
2020-02-24 18:37:01,714 DEBUG: No registration for key 123abc on device /dev/sda
2020-02-24 18:37:01,714 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:37:01,718 DEBUG: 0
2020-02-24 18:37:01,718 INFO: Executing: /usr/bin/sg_persist -n -o -I -S 123abc -d /dev/sda
2020-02-24 18:37:01,723 DEBUG: 2 PR out (Register and ignore existing key): Device not ready
  sg_persist failed: Device not ready
2020-02-24 18:37:01,724 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:37:01,727 DEBUG: 0
2020-02-24 18:37:01,727 INFO: Executing: /usr/bin/sg_persist -n -i -k -d /dev/sda
2020-02-24 18:37:01,731 DEBUG: 0 PR generation=0x3, 1 registered reservation key follows: 0x123abc
2020-02-24 18:37:01,732 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:37:01,735 DEBUG: 0
2020-02-24 18:37:01,735 INFO: Executing: /usr/bin/sg_persist -n -i -r -d /dev/sda
2020-02-24 18:37:01,739 DEBUG: 0 PR generation=0x3, there is NO reservation held
2020-02-24 18:37:01,740 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:37:01,744 DEBUG: 0
2020-02-24 18:37:01,745 INFO: Executing: /usr/bin/sg_persist -n -o -R -T 5 -K 123abc -d /dev/sda
2020-02-24 18:37:01,749 DEBUG: 0
2020-02-24 18:37:01,750 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:37:01,753 DEBUG: 0
2020-02-24 18:37:01,754 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:37:01,757 DEBUG: 0
2020-02-24 18:37:01,757 INFO: Executing: /usr/bin/sg_persist -n -i -k -d /dev/sda
2020-02-24 18:37:01,761 DEBUG: 0 PR generation=0x3, 1 registered reservation key follows: 0x123abc
Success: Powered ON

# key 0x123abc is registered:

(k)rafaeldtinoco@clufocal01:~$ sudo sg_persist --in --read-keys --device=/dev/sda
  LIO-ORG cluster.focal.t 4.0
  Peripheral device type: disk
  PR generation=0x3, 1 registered reservation key follows:
    0x123abc

# key 0x123abc holds the reservation:

(k)rafaeldtinoco@clufocal01:~$ sudo sg_persist -r /dev/sda
  LIO-ORG cluster.focal.t 4.0
  Peripheral device type: disk
  PR generation=0x3, Reservation follows:
    Key=0x123abc
    scope: LU_SCOPE, type: Write Exclusive, registrants only

##
## NODE 02
##

# tell "fence_scsi" agent that node 2 is "on"

(k)rafaeldtinoco@clufocal02:~$ sudo fence_scsi --verbose -n 10.250.3.11 -d /dev/sda -k 321abc -o on
2020-02-24 18:37:37,888 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:37:37,892 DEBUG: 0
2020-02-24 18:37:37,892 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:37:37,895 DEBUG: 0
2020-02-24 18:37:37,895 INFO: Executing: /usr/bin/sg_persist -n -i -k -d /dev/sda
2020-02-24 18:37:37,901 DEBUG: 0 PR generation=0x3, 1 registered reservation key follows: 0x123abc
2020-02-24 18:37:37,902 DEBUG: No registration for key 321abc on device /dev/sda
2020-02-24 18:37:37,902 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:37:37,905 DEBUG: 0
2020-02-24 18:37:37,905 INFO: Executing: /usr/bin/sg_persist -n -o -I -S 321abc -d /dev/sda
2020-02-24 18:37:37,910 DEBUG: 2 PR out (Register and ignore existing key): Device not ready
    sg_persist failed: Device not ready
2020-02-24 18:37:37,910 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:37:37,913 DEBUG: 0
2020-02-24 18:37:37,913 INFO: Executing: /usr/bin/sg_persist -n -i -k -d /dev/sda
2020-02-24 18:37:37,916 DEBUG: 0 PR generation=0x4, 2 registered reservation keys follow:
    0x123abc
    0x321abc
2020-02-24 18:37:37,917 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:37:37,920 DEBUG: 0
2020-02-24 18:37:37,920 INFO: Executing: /usr/bin/sg_persist -n -i -r -d /dev/sda
2020-02-24 18:37:37,923 DEBUG: 0 PR generation=0x4, Reservation follows:
    Key=0x123abc
    scope: LU_SCOPE, type: Write Exclusive, registrants only
2020-02-24 18:37:37,924 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:37:37,927 DEBUG: 0
2020-02-24 18:37:37,928 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:37:37,931 DEBUG: 0
2020-02-24 18:37:37,931 INFO: Executing: /usr/bin/sg_persist -n -i -k -d /dev/sda
2020-02-24 18:37:37,935 DEBUG: 0 PR generation=0x4, 2 registered reservation keys follow:
    0x123abc
    0x321abc
Success: Powered ON

# both keys: 0x123abc and 0x321abc are registered to the shared disk

(k)rafaeldtinoco@clufocal02:~$ sudo sg_persist --in --read-keys --device=/dev/sda
  LIO-ORG cluster.focal.t 4.0
  Peripheral device type: disk
  PR generation=0x4, 2 registered reservation keys follow:
    0x123abc
    0x321abc

# key 0x123abc holds the reservation

(k)rafaeldtinoco@clufocal02:~$ sudo sg_persist -r /dev/sda
  LIO-ORG cluster.focal.t 4.0
  Peripheral device type: disk
  PR generation=0x4, Reservation follows:
    Key=0x123abc
    scope: LU_SCOPE, type: Write Exclusive, registrants only

# from node 2, tell "fence_scsi" agent that node 1 is "off"

(k)rafaeldtinoco@clufocal02:~$ sudo fence_scsi --verbose -n 10.250.3.10 -d /dev/sda -k 123abc -o off
2020-02-24 18:38:45,700 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:38:45,704 DEBUG: 0
2020-02-24 18:38:45,705 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:38:45,708 DEBUG: 0
2020-02-24 18:38:45,708 INFO: Executing: /usr/bin/sg_persist -n -i -k -d /dev/sda
2020-02-24 18:38:45,715 DEBUG: 0 PR generation=0x4, 2 registered reservation keys follow:
    0x123abc
    0x321abc
2020-02-24 18:38:45,716 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:38:45,720 DEBUG: 0
2020-02-24 18:38:45,721 INFO: Executing: /usr/bin/sg_persist -n -i -k -d /dev/sda
2020-02-24 18:38:45,724 DEBUG: 0 PR generation=0x4, 2 registered reservation keys follow:
    0x123abc
    0x321abc
2020-02-24 18:38:45,725 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:38:45,728 DEBUG: 0
2020-02-24 18:38:45,728 INFO: Executing: /usr/bin/sg_persist -n -o -A -T 5 -K 321abc -S 123abc -d /dev/sda
2020-02-24 18:38:45,732 DEBUG: 0
2020-02-24 18:38:45,732 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:38:45,736 DEBUG: 0
2020-02-24 18:38:45,736 INFO: Executing: /usr/bin/sg_persist -n -i -k -d /dev/sda
2020-02-24 18:38:45,740 DEBUG: 0 PR generation=0x5, 1 registered reservation key follows:
    0x321abc
2020-02-24 18:38:45,740 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:38:45,745 DEBUG: 0
2020-02-24 18:38:45,746 INFO: Executing: /usr/bin/sg_persist -n -i -r -d /dev/sda
2020-02-24 18:38:45,751 DEBUG: 0 PR generation=0x5, Reservation follows:
    Key=0x321abc
    scope: LU_SCOPE, type: Write Exclusive, registrants only
2020-02-24 18:38:45,754 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:38:45,758 DEBUG: 0
2020-02-24 18:38:45,758 INFO: Executing: /usr/bin/sg_turs /dev/sda
2020-02-24 18:38:45,762 DEBUG: 0
2020-02-24 18:38:45,763 INFO: Executing: /usr/bin/sg_persist -n -i -k -d /dev/sda
2020-02-24 18:38:45,768 DEBUG: 0 PR generation=0x5, 1 registered reservation key follows:
    0x321abc
2020-02-24 18:38:45,770 DEBUG: No registration for key 123abc on device /dev/sda
Success: Powered OFF

# only key 0x321abc (node 2) is registered in the shared disk

(k)rafaeldtinoco@clufocal02:~$ sudo sg_persist --in --read-keys --device=/dev/sda
  LIO-ORG cluster.focal.t 4.0
  Peripheral device type: disk
  PR generation=0x5, 1 registered reservation key follows:
    0x321abc

# and the key holding the reservation now is 0x321abc (node 2)

(k)rafaeldtinoco@clufocal02:~$ sudo sg_persist -r /dev/sda
  LIO-ORG cluster.focal.t 4.0
  Peripheral device type: disk
  PR generation=0x5, Reservation follows:
    Key=0x321abc
    scope: LU_SCOPE, type: Write Exclusive, registrants only