Opened 9 years ago

Closed 9 years ago

#414 closed defect (fixed)

If you exclude an LVM disk in mondoarchive it still shows up in mountlist.txt

Reported by: mikeshap Owned by: bruno
Priority: normal Milestone: 2.2.9.3
Component: mindi Version: 2.2.9.2
Severity: major Keywords:
Cc:

Description

mindi-2.0.7.3-0.20100407121858.rhel5

In this example, /dev/sdb is a PV in the VG vgtest:

# pvs
  PV         VG         Fmt  Attr PSize  PFree 
  /dev/sda2  VolGroup00 lvm2 a-   14.88G     0 
  /dev/sdb1  vgtest     lvm2 a-   96.00M 44.00M

I ran mondoarchive:

mondoarchive -N -O -9 -p mondo-mrou43 -n mrou10:/nwinstall -d mondo/mrou43 -s 650m -E "/dev/sdb"

The mountlist.txt file still contains an entry for vgtest:

/dev/sda2 lvm lvm 15623212 
/dev/VolGroup00/LogVol00 / ext3 lvm 
/dev/sda1 /boot ext3 104391 /boot
/dev/VolGroup00/LogVol01 swap swap lvm 
/dev/vgtest/lvol1 /lvmmnt ext3 lvm 
/dev/sdc1 /wholemnt ext3 122864

The problem is that, if you exclude a PV from a VG, mindi doesn't add that PV to the list_of_devices in MakeMountlist(). I was able to fix the problem in mindi by adding the function GetPVsForLV() and adding its result to the list_of_devices in MakeMountlist(). Basically, it looks at the current_partition and, if it's a VG, adds all of the VG's PV's to the list_of_devices.

# Get PV's for an LV
GetPVsForLV() {
  if [ -n "$1" ]; then
    lvol="$1"
    vg=`lvdisplay $lvol 2>/dev/null |awk '/VG Name/{print $NF;exit}'`
    if [ -z "$vg" ]; then
      return
    fi
    vgdisplay -v $vg 2>/dev/null | awk '/PV Name/{print$NF}'
  fi
}

In the MakeMountlist() function:

if [ "$MINDI_EXCLUDE_DEVS" ] ; then
	l=""
	list_of_devices="`ReadAllLink $current_partition`"
	for d in $list_of_devices; do
		l="$l `GiveMapperOfdm $d`"
	done
	list_of_devices="`echo $l | sort -u`"

        ##### ADDED THESE TWO LINES #####
	PVVG=`GetPVsForLV $current_partition`
        list_of_devices="$list_of_devices $PVVG"

	for d in $MINDI_EXCLUDE_DEVS ; do
		if  [ "`echo " $list_of_devices " | grep " $d"`" != "" ]; then
   			echo "Excluding $current_partition from mountlist (due to excluded device $d)" >> $LOGFILE
			skip=1
			continue
		fi
	done
fi

With the modifications, running mondoarchive produces a correct mountlist.txt (i.e. with no VG vgtest in it):

/dev/sda2 lvm lvm 15623212 
/dev/VolGroup00/LogVol00 / ext3 lvm 
/dev/sda1 /boot ext3 104391 /boot
/dev/VolGroup00/LogVol01 swap swap lvm 
/dev/sdc1 /wholemnt ext3 122864 

The attached mindi has been modified with the fixes described above. Look for the lines:

#### START ADD BY MIKE SHAPIRO ####


and

#### END ADD BY MIKE SHAPIRO ####

Attachments (1)

mindi.modified.040710 (108.2 KB) - added by mikeshap 9 years ago.
mindi modified with fixes

Download all attachments as: .zip

Change History (2)

Changed 9 years ago by mikeshap

mindi modified with fixes

comment:1 Changed 9 years ago by bruno

  • Resolution set to fixed
  • Status changed from new to closed

One more time, thanks a lot Mike for this patch. I know you sent it to me privately, but I didn't get it correctly and thought it was potentialy fixed in 2.2.9.3 beta already.

I've made slight modification to your original patch for a smoother integration in the code.

Will be in 2.2.9.3. I'm rebuilding packages with your patches for rhel5 right now for you to check.

Note: See TracTickets for help on using tickets.