#2295 PR merged: Issue 2281(missing delete_dummy_partitions_and_resize_real_ones calls)

Labels: bug, cleanup, fixed / solved / done

rmetrich opened issue at 2019-12-09 08:22:

See #2281 for details.

jsmeix commented at 2019-12-09 10:14:

@rmetrich
thank you so much for your fix!

Ony as a side note a question FYI:

As far as I see we have now the same code

    cat >> "$LAYOUT_CODE" <<EOF
# Make sure device nodes are visible (eg. in RHEL4)
my_udevtrigger
my_udevsettle

# Clean up transient partitions and resize shrinked ones
delete_dummy_partitions_and_resize_real_ones

in three scripts:

layout/prepare/GNU/Linux/100_include_partition_code.sh
layout/prepare/GNU/Linux/120_include_raid_code.sh
layout/prepare/GNU/Linux/210_load_multipath.sh

in each one directly after the create_partitions call.

I am wondering if that code could be moved
into the create_partitions function at its end, cf.
https://github.com/rear/rear/issues/2281#issuecomment-558081653
(excerpt)

@rmetrich
when my assumption is right
that delete_dummy_partitions_and_resize_real_ones
must be called after any create_partitions call
then it is perhaps best to add the
delete_dummy_partitions_and_resize_real_ones call
into the create_partitions function to ensure that
delete_dummy_partitions_and_resize_real_ones
is always called at the end of each create_partitions call?

Or what is the reason why code like

    cat >> "$LAYOUT_CODE" <<EOF
# Make sure device nodes are visible (eg. in RHEL4)
my_udevtrigger
my_udevsettle

# Clean up transient partitions and resize shrinked ones
delete_dummy_partitions_and_resize_real_ones

#
# End of code handling disk or software RAID or multipath device '$disk'
#
EOF

cannot be added at the end of the create_partitions function
in layout/prepare/GNU/Linux/100_include_partition_code.sh
?

Perhaps the reason is obvious but I still do not see it.

rmetrich commented at 2019-12-09 10:37:

The idea behind create_partitions is to create partitions, but we want to let the admin create additional ones if he needs to. Hence the code being split.
Now, regarding having twice the same code, this could indeed be consolidated, but probably harder to read and detect errors, since create_disk function would now have different parameters passed to it depending on if we are multipath, a disk, or a softraid ...

rmetrich commented at 2019-12-12 14:02:

@pcahyna we may need this.


[Export of Github issue for rear/rear.]