Skip to content

Commit e783f53

Browse files
authored
Merge pull request #661 from Mirantis/jell/libvirt_sh
Allow start of libvirt with sriov_enabled on node without sriov
2 parents 815af0c + 06741f1 commit e783f53

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

images/image_skel/libvirt.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ if [[ -f /dind/vmwrapper ]]; then
1414
fi
1515

1616
function regenerate_qemu_conf() {
17-
set $(ls -l /sys/class/net/*/device/iommu_group | sed 's@.*/\(.*\)@"/dev/vfio/\1",@')
18-
sed -i "s|# @DEVS@|$*|" /etc/libvirt/qemu.conf
17+
if ls /sys/class/net/*/device/iommu_group >/dev/null 2>&1 ; then
18+
set $(ls -l /sys/class/net/*/device/iommu_group | sed 's@.*/\(.*\)@"/dev/vfio/\1",@')
19+
sed -i "s|# @DEVS@|$*|" /etc/libvirt/qemu.conf
20+
else
21+
echo WARNING - Virtlet is configured to use SR-IOV but no such resources are available on this host
22+
sed -i "/# @DEVS@/d" /etc/libvirt/qemu.conf
23+
fi
1924
}
2025

2126
VIRTLET_SRIOV_SUPPORT="${VIRTLET_SRIOV_SUPPORT:-}"

0 commit comments

Comments
 (0)