1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636
|
#!/usr/bin/env bash
# Copyright (C) 2020-23 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
test_description='device id tests'
SKIP_WITH_LVMPOLLD=1
. lib/inittest
test -d /sys/block/ram0 && skip "Ramdisk already loaded"
test "$DM_DEV_DIR" = "/dev" || skip "Only works with /dev access -> make check LVM_TEST_DEVDIR=/dev"
RUNDIR="/run"
test -d "$RUNDIR" || RUNDIR="/var/run"
HINTS="$RUNDIR/lvm/hints"
PVS_ONLINE_DIR="$RUNDIR/lvm/pvs_online"
VGS_ONLINE_DIR="$RUNDIR/lvm/vgs_online"
PVS_LOOKUP_DIR="$RUNDIR/lvm/pvs_lookup"
_clear_online_files() {
# wait till udev is finished
aux udev_wait
rm -f "$PVS_ONLINE_DIR"/*
rm -f "$VGS_ONLINE_DIR"/*
rm -f "$PVS_LOOKUP_DIR"/*
}
# requires trailing / to match dm
SYS_DIR="$PWD/test/sys"
aux lvmconf "devices/use_devicesfile = 1" \
"devices/device_id_sysfs_dir = \"$SYS_DIR/\"" \
'devices/global_filter = [ "a|.*|" ]' \
'devices/filter = [ "a|.*|" ]' \
"global/event_activation = 1"
WWID1="naa.123456"
WWID2="nvme.123-456"
create_base() {
mkdir -p "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device"
mkdir -p "$SYS_DIR/dev/block/$MAJOR2:$MINOR2/device"
mkdir -p "$SYS_DIR/dev/block/$MAJOR3:$MINOR3/device"
mkdir -p "$SYS_DIR/dev/block/$MAJOR4:$MINOR4/device"
echo "$WWID1" > "$SYS_DIR/dev/block/$MAJOR1:$MINOR1/device/wwid"
echo "$WWID2" > "$SYS_DIR/dev/block/$MAJOR2:$MINOR2/device/wwid"
}
remove_base() {
rm -rf "$SYS_DIR"
}
cleanup_and_teardown()
{
vgremove -ff $vg1 || true
remove_base
rmmod brd
aux teardown
}
trap 'cleanup_and_teardown' EXIT
modprobe brd rd_nr=4 || skip
sleep 1
remove_base
dev1="/dev/ram0"
dev2="/dev/ram1"
dev3="/dev/ram2"
dev4="/dev/ram3"
DFDIR="$LVM_SYSTEM_DIR/devices"
mkdir -p "$DFDIR" || true
DF="$DFDIR/system.devices"
touch $DF
vgcreate $vg1 "$dev1"
eval "$(pvs --noheading --nameprefixes -o major,minor,uuid "$dev1")"
MAJOR1=$LVM2_PV_MAJOR
MINOR1=$LVM2_PV_MINOR
OPVID1=$LVM2_PV_UUID
PVID1=${OPVID1//-/}
vgcreate $vg2 "$dev2"
eval "$(pvs --noheading --nameprefixes -o major,minor,uuid "$dev2")"
MAJOR2=$LVM2_PV_MAJOR
MINOR2=$LVM2_PV_MINOR
OPVID2=$LVM2_PV_UUID
PVID2=${OPVID2//-/}
vgcreate $vg3 "$dev3"
eval "$(pvs --noheading --nameprefixes -o major,minor,uuid "$dev3")"
MAJOR3=$LVM2_PV_MAJOR
MINOR3=$LVM2_PV_MINOR
OPVID3=$LVM2_PV_UUID
PVID3=${OPVID3//-/}
vgcreate $vg4 "$dev4"
eval "$(pvs --noheading --nameprefixes -o major,minor,uuid "$dev4")"
MAJOR4=$LVM2_PV_MAJOR
MINOR4=$LVM2_PV_MINOR
OPVID4=$LVM2_PV_UUID
PVID4=${OPVID4//-/}
create_base
# dev3 (without wwid) is listed before dev1 (with wwid), and they swap names
# pvs handles it
rm $DF
lvmdevices --adddev "$dev3"
lvmdevices --adddev "$dev2"
lvmdevices --adddev "$dev1"
cat $DF
cp "$DF" orig
sed -e "s|DEVNAME=$dev1|DEVNAME=tmpnm|" orig > tmp1
sed -e "s|DEVNAME=$dev3|DEVNAME=$dev1|" tmp1 > tmp2
sed -e "s|IDNAME=$dev3|IDNAME=$dev1|" tmp2 > tmp3
sed -e "s|DEVNAME=tmpnm|DEVNAME=$dev3|" tmp3 > $DF
cat "$DF"
pvs -o+uuid |tee out
grep "$dev1" out |tee out1
grep "$dev2" out |tee out2
grep "$dev3" out |tee out3
grep "$OPVID1" out1
grep "$OPVID2" out2
grep "$OPVID3" out3
grep "$PVID1" "$DF" |tee out
grep "$WWID1" out
grep "DEVNAME=$dev1" out
grep "$PVID3" "$DF" |tee out
not grep "$WWID1" out
grep "IDNAME=$dev3" out
grep "DEVNAME=$dev3" out
# dev3 (without wwid) is listed before dev1 (with wwid), and they swap names
# pvscan --cache dev handles it
rm "$DF"
vgimportdevices -a
vgremove $vg1 $vg2 $vg3 $vg4
vgcreate $vg1 "$dev1" "$dev2" "$dev3" "$dev4"
lvcreate -an -n $lv1 -l1 $vg1
rm $DF
lvmdevices --adddev "$dev4"
lvmdevices --adddev "$dev3"
lvmdevices --adddev "$dev2"
lvmdevices --adddev "$dev1"
cat $DF
cp "$DF" orig
sed -e "s|DEVNAME=$dev1|DEVNAME=tmpnm|" orig > tmp1
sed -e "s|DEVNAME=$dev3|DEVNAME=$dev1|" tmp1 > tmp2
sed -e "s|IDNAME=$dev3|IDNAME=$dev1|" tmp2 > tmp3
sed -e "s|DEVNAME=tmpnm|DEVNAME=$dev3|" tmp3 > $DF
cat "$DF"
_clear_online_files
pvscan --cache --listvg --checkcomplete --vgonline --autoactivation event "$dev1"
ls "$RUNDIR/lvm/pvs_online/$PVID1"
not ls "$RUNDIR/lvm/vgs_online/$vg1"
pvscan --cache --listvg --checkcomplete --vgonline --autoactivation event "$dev2"
ls "$RUNDIR/lvm/pvs_online/$PVID1"
not ls "$RUNDIR/lvm/vgs_online/$vg1"
pvscan --cache --listvg --checkcomplete --vgonline --autoactivation event "$dev3"
ls "$RUNDIR/lvm/pvs_online/$PVID1"
not ls "$RUNDIR/lvm/vgs_online/$vg1"
pvscan --cache --listvg --checkcomplete --vgonline --autoactivation event "$dev4"
ls "$RUNDIR/lvm/pvs_online/$PVID1"
ls "$RUNDIR/lvm/vgs_online/$vg1"
cat $DF
vgchange -aay --autoactivation event $vg1
cat $DF
# pvs will fix the DF entries
# (pvscan and vgchange aay skip the update to avoid interfering
# with the autoactivation process.)
pvs -o+uuid |tee out
cat $DF
grep "$dev1" out |tee out1
grep "$dev2" out |tee out2
grep "$dev3" out |tee out3
grep "$OPVID1" out1
grep "$OPVID2" out2
grep "$OPVID3" out3
grep "$PVID1" "$DF" |tee out
grep "$WWID1" out
grep "DEVNAME=$dev1" out
grep "$PVID3" "$DF" |tee out
not grep "$WWID1" out
grep "IDNAME=$dev3" out
grep "DEVNAME=$dev3" out
#
# lvmdevices --check|--update
#
DEVNAME_NONE=/dev/sdxyz
PVID_NONE=aaaaaa
WWID_NONE=naa.56789
rm $DF
lvmdevices --adddev "$dev1"
lvmdevices --adddev "$dev2"
lvmdevices --adddev "$dev3"
lvmdevices --adddev "$dev4"
cat $DF
cp "$DF" orig
# 1. lvmdevices --check|--update : devs with wwid
# 1.a change pvid and devname
sed -e "s|DEVNAME=$dev1|DEVNAME=$DEVNAME_NONE|" orig > tmp1
sed -e "s|PVID=$PVID1|PVID=$PVID_NONE|" tmp1 > "$DF"
cat "$DF"
not lvmdevices --check |tee out
grep PVID=$PVID1 out
grep DEVNAME=$dev1 out
grep "old $DEVNAME_NONE" out
grep "old $PVID_NONE" out
lvmdevices --update
grep PVID=$PVID1 "$DF" |tee out
grep DEVNAME=$dev1 out
lvmdevices --check
# 1.b change devname
sed -e "s|DEVNAME=$dev1|DEVNAME=$DEVNAME_NONE|" orig > "$DF"
cat "$DF"
not lvmdevices --check |tee out
grep PVID=$PVID1 out
grep DEVNAME=$dev1 out
grep "old $DEVNAME_NONE" out
lvmdevices --update
grep PVID=$PVID1 "$DF" |tee out
grep DEVNAME=$dev1 out
lvmdevices --check
# 1.c change pvid
sed -e "s|PVID=$PVID1|PVID=$PVID_NONE|" orig > "$DF"
cat "$DF"
not lvmdevices --check |tee out
grep PVID=$PVID1 out
grep DEVNAME=$dev1 out
grep "old $PVID_NONE" out
lvmdevices --update
grep PVID=$PVID1 "$DF" |tee out
grep DEVNAME=$dev1 out
lvmdevices --check
# 2. lvmdevices --check|--update : devs with only devname
# 2.a change idname and devname
sed -e "s|IDNAME=$dev3|IDNAME=$DEVNAME_NONE|" orig > tmp1
sed -e "s|DEVNAME=$dev3|DEVNAME=$DEVNAME_NONE|" tmp1 > "$DF"
cat "$DF"
not lvmdevices --check |tee out
grep PVID=$PVID3 out |tee out1
grep IDNAME=$dev3 out1
grep DEVNAME=$dev3 out1
grep "old $DEVNAME_NONE" out1
lvmdevices --update
grep PVID=$PVID3 "$DF" |tee out
grep IDNAME=$dev3 out
grep DEVNAME=$dev3 out
lvmdevices --check
# 2.b change devname
sed -e "s|DEVNAME=$dev3|DEVNAME=$DEVNAME_NONE|" orig > "$DF"
cat "$DF"
not lvmdevices --check |tee out
grep PVID=$PVID3 out |tee out1
grep IDNAME=$dev3 out1
grep DEVNAME=$dev3 out1
grep "old $DEVNAME_NONE" out1
lvmdevices --update
grep PVID=$PVID3 "$DF" |tee out
grep IDNAME=$dev3 out
grep DEVNAME=$dev3 out
lvmdevices --check
# 2.c change idname
sed -e "s|IDNAME=$dev3|IDNAME=$DEVNAME_NONE|" orig > "$DF"
cat "$DF"
not lvmdevices --check |tee out
grep PVID=$PVID3 out |tee out1
grep IDNAME=$dev3 out1
grep DEVNAME=$dev3 out1
grep "old $DEVNAME_NONE" out1
lvmdevices --update
grep PVID=$PVID3 "$DF" |tee out
grep IDNAME=$dev3 out
grep DEVNAME=$dev3 out
lvmdevices --check
# 3. lvmdevices --check|--update --refresh devs with IDTYPE=sys_wwid
# 3.a.i change idtype and idname and devname (wwid to serial)
sed -e "s|DEVNAME=$dev1|DEVNAME=$DEVNAME_NONE|" orig > tmp1
sed -e "s|IDTYPE=sys_wwid IDNAME=$WWID1|IDTYPE=sys_serial IDNAME=S123|" tmp1 > "$DF"
cat "$DF"
# this command succeeds since no update is detected, the dev is simply not found
lvmdevices --check |tee out
grep 'device not found' out
not lvmdevices --check --refresh |tee out
grep PVID=$PVID1 out |tee out1
grep DEVNAME=$dev1 out1
grep IDTYPE=sys_wwid out1
grep IDNAME=$WWID1 out1
grep "old sys_serial" out1
grep "old S123" out1
lvmdevices --update --refresh
grep PVID=$PVID1 "$DF" |tee out1
grep DEVNAME=$dev1 out1
grep IDTYPE=sys_wwid out1
grep IDNAME=$WWID1 out1
lvmdevices --check
# 3.a.ii change idtype and idname and devname (wwid to devname)
sed -e "s|DEVNAME=$dev1|DEVNAME=$DEVNAME_NONE|" orig > tmp1
sed -e "s|IDTYPE=sys_wwid IDNAME=$WWID1|IDTYPE=devname IDNAME=$DEVNAME_NONE|" tmp1 > "$DF"
cat "$DF"
# the command without --refresh thinks the update should be just to the devname
not lvmdevices --check |tee out
grep PVID=$PVID1 out | tee out1
grep DEVNAME=$dev1 out1
grep IDNAME=$dev1 out1
grep IDTYPE=devname out1
# the command with --refresh sees the update should use sys_wwid
not lvmdevices --check --refresh |tee out
grep PVID=$PVID1 out | tee out1
grep DEVNAME=$dev1 out1
grep IDNAME=$WWID1 out1
grep IDTYPE=sys_wwid out1
lvmdevices --update --refresh
grep PVID=$PVID1 "$DF" |tee out1
grep DEVNAME=$dev1 out1
grep IDTYPE=sys_wwid out1
grep IDNAME=$WWID1 out1
lvmdevices --check
# 3.b change idtype and idname
sed -e "s|IDTYPE=sys_wwid IDNAME=$WWID1|IDTYPE=sys_serial IDNAME=S123|" orig > "$DF"
cat "$DF"
# this command succeeds since no update is detected, the dev is simply not found
lvmdevices --check |tee out
grep 'device not found' out
not lvmdevices --check --refresh |tee out
grep PVID=$PVID1 out |tee out1
grep DEVNAME=$dev1 out1
grep IDTYPE=sys_wwid out1
grep IDNAME=$WWID1 out1
grep "old sys_serial" out1
grep "old S123" out1
lvmdevices --update --refresh
grep PVID=$PVID1 "$DF" |tee out1
grep DEVNAME=$dev1 out1
grep IDTYPE=sys_wwid out1
grep IDNAME=$WWID1 out1
lvmdevices --check
# 3.c change idname and devname
sed -e "s|DEVNAME=$dev1|DEVNAME=$DEVNAME_NONE|" orig > tmp1
sed -e "s|IDNAME=$WWID1|IDNAME=$WWID_NONE|" tmp1 > "$DF"
cat "$DF"
# this command succeeds since no update is detected, the dev is simply not found
lvmdevices --check |tee out
grep 'device not found' out
not lvmdevices --check --refresh |tee out
grep PVID=$PVID1 out |tee out1
grep DEVNAME=$dev1 out1
grep IDTYPE=sys_wwid out1
grep IDNAME=$WWID1 out1
grep "old $WWID_NONE" out1
lvmdevices --update --refresh
grep PVID=$PVID1 "$DF" |tee out1
grep DEVNAME=$dev1 out1
grep IDTYPE=sys_wwid out1
grep IDNAME=$WWID1 out1
lvmdevices --check
# 3.d change idname
sed -e "s|IDNAME=$WWID1|IDNAME=$WWID_NONE|" orig > "$DF"
cat "$DF"
# this command succeeds since no update is detected, the dev is simply not found
lvmdevices --check |tee out
grep 'device not found' out
not lvmdevices --check --refresh |tee out
grep PVID=$PVID1 out |tee out1
grep DEVNAME=$dev1 out1
grep IDTYPE=sys_wwid out1
grep IDNAME=$WWID1 out1
grep "old $WWID_NONE" out1
lvmdevices --update --refresh
grep PVID=$PVID1 "$DF" |tee out1
grep DEVNAME=$dev1 out1
grep IDTYPE=sys_wwid out1
grep IDNAME=$WWID1 out1
lvmdevices --check
# 3.e change devname
sed -e "s|DEVNAME=$dev1|DEVNAME=$DEVNAME_NONE|" orig > "$DF"
cat "$DF"
not lvmdevices --check |tee out
grep PVID=$PVID1 out |tee out1
grep DEVNAME=$dev1 out1
grep "old $DEVNAME_NONE" out1
not lvmdevices --check --refresh |tee out
grep PVID=$PVID1 out |tee out1
grep DEVNAME=$dev1 out1
grep IDTYPE=sys_wwid out1
grep IDNAME=$WWID1 out1
lvmdevices --update --refresh
grep PVID=$PVID1 "$DF" |tee out1
grep DEVNAME=$dev1 out1
grep IDTYPE=sys_wwid out1
grep IDNAME=$WWID1 out1
lvmdevices --check
#
# lvmdevices --check|--update with empty fields
#
# PV with wwid, set DEVNAME=. PVID=.
sed -e "s|DEVNAME=$dev1|DEVNAME=.|" orig > tmp1
sed -e "s|PVID=$PVID1|PVID=.|" tmp1 > "$DF"
cat "$DF"
not lvmdevices --check |tee out
grep PVID=$PVID1 out
grep DEVNAME=$dev1 out
grep "old none" out
lvmdevices --update
grep PVID=$PVID1 "$DF" |tee out
grep DEVNAME=$dev1 out
lvmdevices --check
# PV with wwid, set DEVNAME=.
sed -e "s|DEVNAME=$dev1|DEVNAME=.|" orig > "$DF"
cat "$DF"
not lvmdevices --check |tee out
grep PVID=$PVID1 out
grep DEVNAME=$dev1 out
grep "old none" out
lvmdevices --update
grep PVID=$PVID1 "$DF" |tee out
grep DEVNAME=$dev1 out
lvmdevices --check
# PV with wwid, set PVID=.
sed -e "s|PVID=$PVID1|PVID=.|" orig > "$DF"
cat "$DF"
not lvmdevices --check |tee out
grep PVID=$PVID1 out
grep DEVNAME=$dev1 out
grep "old none" out
lvmdevices --update
grep PVID=$PVID1 "$DF" |tee out
grep DEVNAME=$dev1 out
lvmdevices --check
# PV with wwid, set IDNAME=. DEVNAME=.
sed -e "s|IDNAME=$WWID1|IDNAME=.|" orig > tmp1
sed -e "s|DEVNAME=$dev1|DEVNAME=.|" tmp1 > "$DF"
cat "$DF"
lvmdevices --check |tee out
grep PVID=$PVID1 out |tee out1
grep 'device not found' out1
not lvmdevices --check --refresh |tee out
grep PVID=$PVID1 out |tee out1
grep IDNAME=$WWID1 out1
grep DEVNAME=$dev1 out1
grep "old none" out1
lvmdevices --update --refresh
grep PVID=$PVID1 "$DF" |tee out
grep IDNAME=$WWID1 out
grep DEVNAME=$dev1 out
lvmdevices --check
# PV with wwid, set IDNAME=.
sed -e "s|IDNAME=$WWID1|IDNAME=.|" orig > "$DF"
cat "$DF"
lvmdevices --check |tee out
grep PVID=$PVID1 out |tee out1
grep 'device not found' out1
not lvmdevices --check --refresh |tee out
grep PVID=$PVID1 out |tee out1
grep IDNAME=$WWID1 out1
grep DEVNAME=$dev1 out1
grep "old none" out1
lvmdevices --update --refresh
grep PVID=$PVID1 "$DF" |tee out
grep IDNAME=$WWID1 out
grep DEVNAME=$dev1 out
lvmdevices --check
# PV without wwid, set IDNAME=. DEVNAME=.
sed -e "s|IDNAME=$dev3|IDNAME=.|" orig > tmp1
sed -e "s|DEVNAME=$dev3|DEVNAME=.|" tmp1 > "$DF"
cat "$DF"
not lvmdevices --check |tee out
grep PVID=$PVID3 out |tee out1
grep IDNAME=$dev3 out1
grep DEVNAME=$dev3 out1
grep "old none" out1
lvmdevices --update
grep PVID=$PVID3 "$DF" |tee out
grep IDNAME=$dev3 out
grep DEVNAME=$dev3 out
lvmdevices --check
# PV without wwid, set IDNAME=.
sed -e "s|DEVNAME=$dev3|DEVNAME=.|" orig > "$DF"
cat "$DF"
not lvmdevices --check |tee out
grep PVID=$PVID3 out |tee out1
grep IDNAME=$dev3 out1
grep DEVNAME=$dev3 out1
grep "old none" out1
lvmdevices --update
grep PVID=$PVID3 "$DF" |tee out
grep IDNAME=$dev3 out
grep DEVNAME=$dev3 out
lvmdevices --check
# PV without wwid, set DEVNAME=.
sed -e "s|DEVNAME=$dev3|DEVNAME=.|" orig > "$DF"
cat "$DF"
not lvmdevices --check |tee out
grep PVID=$PVID3 out |tee out1
grep IDNAME=$dev3 out1
grep DEVNAME=$dev3 out1
grep "old none" out1
lvmdevices --update
grep PVID=$PVID3 "$DF" |tee out
grep IDNAME=$dev3 out
grep DEVNAME=$dev3 out
lvmdevices --check
# Without a wwid or a pvid, an entry is indeterminate; there's not enough
# info to definitively know what the entry refers to. These entries will
# never be useful and should be removed. It could be argued that a
# devname entry with a valid device name set in IDNAME and/or DEVNAME
# should be updated with whatever PVID happens to be found on that device.
# By that logic, any PV that's found on that device would be used by lvm,
# and that violates a central rule of the devices file: that lvm will not
# use a PV unless it's definitively identified in the devices file. For
# example, consider a PV and a clone of that PV on a different device.
# The devices file should guarantee that the correct PV and not the clone
# will be used. The user needs to intervene to select one if lvm cannot
# tell the difference.
# PV without wwid, set PVID=.
sed -e "s|PVID=$PVID3|PVID=.|" orig > "$DF"
cat "$DF"
lvmdevices --check |tee out
grep indeterminate out
# PV without wwid, set PVID=. DEVNAME=.
sed -e "s|PVID=$PVID3|PVID=.|" orig > tmp1
sed -e "s|DEVNAME=$dev3|DEVNAME=.|" tmp1 > "$DF"
cat "$DF"
lvmdevices --check |tee out
grep indeterminate out
# PV without wwid, set PVID=. IDNAME=.
sed -e "s|PVID=$PVID3|PVID=.|" orig > tmp1
sed -e "s|IDNAME=$dev3|IDNAME=.|" tmp1 > "$DF"
cat "$DF"
lvmdevices --check |tee out
grep indeterminate out
# PV without wwid, set PVID=. IDNAME=. DEVNAME=.
sed -e "s|PVID=$PVID3|PVID=.|" orig > tmp1
sed -e "s|IDNAME=$dev3|IDNAME=.|" tmp1 > tmp2
sed -e "s|DEVNAME=$dev3|DEVNAME=.|" tmp2 > "$DF"
cat "$DF"
lvmdevices --check |tee out
grep indeterminate out
# indeterminate cases with additional change
# PV without wwid, set PVID=.
sed -e "s|PVID=$PVID3|PVID=.|" orig > tmp1
sed -e "s|DEVNAME=$dev3|DEVNAME=$DEVNAME_NONE|" tmp1 > "$DF"
cat "$DF"
lvmdevices --check |tee out
grep indeterminate out
# PV without wwid, set PVID=. DEVNAME=.
sed -e "s|PVID=$PVID3|PVID=.|" orig > tmp1
sed -e "s|DEVNAME=$dev3|DEVNAME=.|" tmp1 > tmp2
sed -e "s|IDNAME=$dev3|IDNAME=$DEVNAME_NONE|" tmp2 > "$DF"
cat "$DF"
lvmdevices --check |tee out
grep indeterminate out
# PV without wwid, set PVID=. IDNAME=.
sed -e "s|PVID=$PVID3|PVID=.|" orig > tmp1
sed -e "s|IDNAME=$dev3|IDNAME=.|" tmp1 > tmp2
sed -e "s|DEVNAME=$dev3|DEVNAME=$DEVNAME_NONE|" tmp2 > "$DF"
cat "$DF"
lvmdevices --check |tee out
grep indeterminate out
cp orig "$DF"
vgchange -an $vg1
lvremove -y $vg1
|