This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 429033 - fence_scsi is broken with lvm stripes and mirrors
fence_scsi is broken with lvm stripes and mirrors
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: cman (Show other bugs)
5.2
All Linux
low Severity low
: rc
: ---
Assigned To: Ryan O'Hara
GFS Bugs
:
Depends On: 428726
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-16 17:00 EST by Corey Marthaler
Modified: 2009-04-16 19:00 EDT (History)
1 user (show)

See Also:
Fixed In Version: RHBA-2008-0347
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-05-21 11:58:38 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Corey Marthaler 2008-01-16 17:00:12 EST
+++ This bug was initially created as a clone of Bug #428726 +++

Description of problem:
When using mirrors, the query to grab the devices in lvm volumes doesn't work.

I have two volumes, a linear and a mirror:
  linear            taft       -wi-a- 10.00G                                   
   /dev/sdd(0)
  mirror            taft       Mwi-ao 10.00G                    mirror_mlog
100.00 mirror_mimage_0(0),mirror_mimage_1(0)
  [mirror_mimage_0] taft       iwi-ao 10.00G                                   
   /dev/sdb(0)
  [mirror_mimage_1] taft       iwi-ao 10.00G                                   
   /dev/sdc(0)
  [mirror_mlog]     taft       lwi-ao  4.00M                                   
   /dev/sdh(0)


here's is what the fence_scsi device query returns:
[root@taft-04 ~]# lvs -o vg_attr,devices --noheadings
  wz--nc /dev/sdd(0)
  wz--nc mirror_mimage_0(0),mirror_mimage_1(0)

It returns the proper device for the linear, but not the stripe. Therefore
fence_scsi will not work with mirrors.

Version-Release number of selected component (if applicable):
2.6.9-67.ELsmp
fence-1.32.50-2.fencescsi.test.patch

-- Additional comment from cmarthal@redhat.com on 2008-01-14 16:49 EST --
With the way lvm reports devices, fence_scsi current will only work for linear
volumes, not stripes or mirrors.

[root@taft-02 ~]# lvs -a -o +devices
  LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%  Devices
  LogVol00 VolGroup00 -wi-ao  66.16G                               /dev/sda2(0)
  LogVol01 VolGroup00 -wi-ao   1.94G                               /dev/sda2(2117)
  linear   taft       -wi-a- 200.00G                               /dev/sdb(0)
  linear   taft       -wi-a- 200.00G                               /dev/sdc(0)
  stripe   taft       -wi-a-  10.00G                              
/dev/sdd(0),/dev/sde(0)


[root@taft-01 ~]# service scsi_reserve start
Registering device: /dev/sdb                               [  OK  ]
Registering device: /dev/sdc                               [  OK  ]
Registering device: /dev/sdd,/dev/sde(0)                   [FAILED]


-- Additional comment from pm-rhel@redhat.com on 2008-01-14 16:56 EST --
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

-- Additional comment from cmarthal@redhat.com on 2008-01-15 16:18 EST --
I think an easier way to go about this, is just to grab the pvs that are in use
and give them reservations, instead of parsing lvs different ways based on if
it's a mirror, stripe, or linear. 

Something like the following should work:

#!/bin/bash

pvs=$(pvs | grep $vg | awk {'print $1'})

for pv in $pvs
do
        used=$(pvs $pv --noheadings -o pv_used | awk {'print $1'})
        if [[ $used != 0 ]]
        then
                echo "$pv *DOES* need a reservation because it's being used ($used)"
        else
                echo "$pv doesn *NOT* need a reservation because it's not being
used"
        fi
done

-- Additional comment from rohara@redhat.com on 2008-01-16 11:55 EST --
Talked with Corey this morning and tried out some commands on his cluster. Looks
like this is a good idea and should be implemented.

Basically, the script(s) will get volume groups with the cluster bit set. Then,
for every cluster vg we find we'll use pvs to get the devices. Note that this
will also give us devices that are in the volume group but not being used. This
seems like a good thing. The result is that all physical volumes found in the
volume groups -- even those that are not in use -- will get scsi reservations.

As Corey pointed out, this should allow the scripts to work with mirrors and
stripes. Will also make the code a little more sane.
Comment 1 Corey Marthaler 2008-01-16 17:02:32 EST
We have other fence_scsi fixes going in, so we might as well get this one in too
since the code is already done.
Comment 2 Ryan O'Hara 2008-01-18 18:34:58 EST
Fixed. Old SCSI reservation scripts (scsi_reserve, fence_scsi, fence_scsi_test)
would query clvm for devices that existed withing cluster volumes by executing
the command:

   lvs -o vg_attr,devices ...

This caused the scripts to not recognize devices that were in LVM stripes and
mirrors. This was due to parsing problems, since the scripts must parse the
output by looking at the vg_attr for the cluster bit to determine if the value
of device contains a device we need to register with. In the presences of LVM
stripes or mirrors, "devices" was not return scsi devices was we could register
with.

Fix is to use replace the command shown above with:

   vgs -o vg_attr,pv_name ...

This works quite nicely, since the pv_name will give us the name of the device
every time, even for LVM stripes and mirrors.

Comment 4 RHEL Product and Program Management 2008-01-24 17:56:10 EST
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 7 errata-xmlrpc 2008-05-21 11:58:38 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2008-0347.html

Note You need to log in before you can comment on or make changes to this bug.