Merge "Do not fail when called on an invalid device"
This commit is contained in:
commit
04802babc5
|
@ -211,9 +211,13 @@ def should_enable_discard(devices):
|
||||||
if (device.startswith("/dev/nvme") or
|
if (device.startswith("/dev/nvme") or
|
||||||
device.startswith("/dev/vd")):
|
device.startswith("/dev/vd")):
|
||||||
continue
|
continue
|
||||||
|
try:
|
||||||
|
sata_3_or_less = is_sata30orless(device)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
sata_3_or_less = True
|
||||||
if (device.startswith("/dev/") and
|
if (device.startswith("/dev/") and
|
||||||
os.path.exists(device) and
|
os.path.exists(device) and
|
||||||
is_sata30orless(device)):
|
sata_3_or_less):
|
||||||
discard_enable = False
|
discard_enable = False
|
||||||
log("SSD Discard autodetection: {} is forcing discard off"
|
log("SSD Discard autodetection: {} is forcing discard off"
|
||||||
"(sata <= 3.0)".format(device), level=WARNING)
|
"(sata <= 3.0)".format(device), level=WARNING)
|
||||||
|
|
Loading…
Reference in New Issue