Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-137802

There are a variety of places where it may be implied that shared VGs could use either pr_key or host_id

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • rhel-10.2
    • lvm2
    • None
    • None
    • None
    • rhel-storage-lvm
    • None
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • x86_64
    • None

      The comments in the lvmlocal.conf imply that there's a scenario where shared VGs can be started with user defined PR keys, which goes against what the man page and practice show. Reality is, shared VGs will be hex versions of what the host_id is, regardless of whether or not a pr_key is also set.

      kernel-6.12.0-165.el10    BUILT: Fri Nov 28 09:08:39 AM CET 2025
      lvm2-2.03.36-1.el10    BUILT: Sat Oct 25 04:42:32 AM CEST 2025
      lvm2-libs-2.03.36-1.el10    BUILT: Sat Oct 25 04:42:32 AM CEST 2025
       
       
      lvmpersist(8)
       
             local/pr_key
       
             The value set in pr_key will be used directly.  It is a hex string up to 16 characters long.  pr_key will not be used for sanlock shared VGs.
       
             local/host_id
       
             For a sanlock shared VG, or if no pr_key is set, a key will be created using the host_id.  This is a decimal integer between 1 and 2000.
      # I don't really like the "or if no pr_key is set," above. That only applies to local VGs, and we're talking about shared in this paragraph. What it states is true, but is confusing in this paragraph, I had to read that a couple times. 
       
      /etc/lvm/lvmlocal.conf
              # Configuration option local/host_id.
              # The sanlock host_id used by lvmlockd. This must be unique among all the hosts
              # using shared VGs with sanlock. Accepted values are 1-2000, except when sanlock_align_size
              # is configured to 1, 2 or 4, which correspond to max host_id values of 250, 500, or 1000.
              # When using persistent reservations, lvm will generate a PR key from the host_id
              # if pr_key is not defined. All hosts using a sanlock shared VG with PR must use
      
      "When using persistent reservations, lvm will generate a PR key from the host_id if pr_key is not defined"  - That implication isn't true to my knowledge. Regardless of whether or not a pr_key is defined, LVM will ignore it wrt shared VGs
      
       
      [root@virt-498 ~]# grep QA /etc/lvm/lvmlocal.conf 
              pr_key = "0xa63b3fe44bb87092"   # edited by QA Sun Dec 28 15:00:26 2025
              host_id = 1239   # edited by QA Sun Dec 28 15:00:34 2025
       
      [root@virt-499 ~]#  grep QA /etc/lvm/lvmlocal.conf 
              pr_key = "0x46bf48dc8ddef1eb"   # edited by QA Sun Dec 28 15:00:28 2025
              host_id = 368   # edited by QA Sun Dec 28 15:00:35 2025
       
      # These keys are hex versions of the host_id, so it didn't appear to matter that we had also set a pr_key.
      [root@virt-498 ~]# vgchange --persist check persist_VG
        key for local host is registered: 0x10000000000104d7
        keys for all registered hosts: 0x100000000001009a 0x1000000000010170 0x10000000000104d7 
        reservation WEAR for registered hosts
        PR is started.
       
       
      # If you remove the host_id, which none of the documents state you can, it'll fail
      vgcreate --shared   persist_VG /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde
        Enabling sanlock global lock
        Invalid host_id 0, use 1-2000.
        Failed to initialize lock args for lock type sanlock
        Volume group "persist_VG" successfully removed
      

              lvm-team lvm-team
              cmarthal@redhat.com Corey Marthaler
              lvm-team lvm-team
              Cluster QE Cluster QE
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: