Fix grep for /dev/disk/by-id to identify SCSI devices

For VMs with hw_disk_bus=scsi and/or hw_scsi_model=virtio-scsi
the volume won't be identified, because for those VMs the result
from `ls /dev/disk/by-id` will look like this:

scsi-0QEMU_QEMU_HARDDISK_3c8f086d-e1f4-4ce1-a91a-c4a8d6d538bb

This patch extends the current grep by allowing the full UUID of
the volume to be matched as well.

Change-Id: I3c6b7a85f8cbf5a8379965c44be854ea3002123b
This commit is contained in:
Marius Leustean 2021-07-24 21:56:26 +03:00
parent d8cc88284b
commit d262c6732c
2 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@ if [ -n "$DOCKER_VOLUME_SIZE" ] && [ "$DOCKER_VOLUME_SIZE" -gt 0 ]; then
else
attempts=60
while [ ${attempts} -gt 0 ]; do
device_name=$($ssh_cmd ls /dev/disk/by-id | grep ${DOCKER_VOLUME:0:20}$)
device_name=$($ssh_cmd ls /dev/disk/by-id | grep -e ${DOCKER_VOLUME:0:20}$ -e ${DOCKER_VOLUME}$)
if [ -n "${device_name}" ]; then
break
fi

View File

@ -20,7 +20,7 @@ if [ -n "$ETCD_VOLUME_SIZE" ] && [ "$ETCD_VOLUME_SIZE" -gt 0 ]; then
attempts=60
while [ ${attempts} -gt 0 ]; do
device_name=$($ssh_cmd ls /dev/disk/by-id | grep ${ETCD_VOLUME:0:20}$)
device_name=$($ssh_cmd ls /dev/disk/by-id | grep -e ${ETCD_VOLUME:0:20}$ -e ${ETCD_VOLUME}$)
if [ -n "${device_name}" ]; then
break
fi