cros flash: Check HOTPLUG for removable usb: targets
Consider devices with the lsblk HOTPLUG column to be
removable for the usb:// flashing.
Allows Samsung_PSSD_T7 USB attached SCSI devices which
have removable reported as 0 to be allowed as usb://
devices.
This allows them to show up in the list of usb devices when
usb:// is specified and avoids the removable warning when the block
dev is specified.
Requires util-linux v2.26 or newer
BUG=b:229305899
TEST=./run_tests lib/osutils_unittest.py
TEST=cros flash to a removable USB nvme drive Samsung T5 SSD
Change-Id: I4eb3efddcf8e080f4a337dd2cac2c86498125c19
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3583784
Tested-by: Jeffery Miller <jefferymiller@google.com>
Reviewed-by: Tim Bain <tbain@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Jeffery Miller <jefferymiller@google.com>
diff --git a/cli/flash.py b/cli/flash.py
index f04df7c..dd8514f 100644
--- a/cli/flash.py
+++ b/cli/flash.py
@@ -176,7 +176,7 @@
devices = osutils.ListBlockDevices()
removable_devices = []
for d in devices:
- if d.TYPE == 'disk' and d.RM == '1':
+ if d.TYPE == 'disk' and (d.RM == '1' or d.HOTPLUG == '1'):
removable_devices.append(d.NAME)
return removable_devices