nvme-cli: Warn and delay before formatting
By popular demand, have format print a warning that shows the relatives of
the device the format was sent to.
If this command was issued to a block device, its relative are the
parent controllers.
If this command was issued to a controller device, its relative children
are namespace block devices.
This provides a visual clue that /dev/nvme0 may or may not be the parent
controller to namespace /dev/nvme0n1, and provides ample time for the
user to abort the operation if they didn't mean to do this.
Here are some examples of what this change provides sending this command
to a controller first, then to a multipathed namespace:
# nvme format /dev/nvme0 -n 1
You are about to format nvme0, namespace 0x1.
Controller nvme0 has child namespace(s):nvme2n1
# nvme format /dev/nvme4n1
You are about to format nvme4n1, namespace 0x1.
Namespace nvme4n1 has parent controller(s):nvme4, nvme5
Link: https://github.com/linux-nvme/nvme-cli/issues/501
Signed-off-by: Keith Busch <kbusch@kernel.org>