[libvirt] [tck PATCH] scripts: shorten netdev/domain name to prevent overflow

When new pids are more than 9 digits long The nwfilter tests use tck-test${pid} as the auto-generated name for their test domains (and therefore the tap devices created for those test domains). When the pid is > 9 digits long, the total length of the name is > 16, which is the maximum length for any network device name (IFNAMSIZ), and this causes failure to create the tap device, thus failure of the test: /home/laine/devel/libvirt-tck/scripts/nwfilter/050-apply-verify-host.t .. error: Failed to start domain tck-test10513851 error: Network interface name 'tck-test10513851' is too long: Numerical result out of range The solution is to just remove "test" from the name template, so pid can be up to 12 digits long before the test fails. Signed-off-by: Laine Stump <laine@laine.org> --- scripts/nwfilter/nwfilter2vmtest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/nwfilter/nwfilter2vmtest.sh b/scripts/nwfilter/nwfilter2vmtest.sh index ae28b73..778013b 100644 --- a/scripts/nwfilter/nwfilter2vmtest.sh +++ b/scripts/nwfilter/nwfilter2vmtest.sh @@ -638,8 +638,8 @@ main() { cd "${curdir}" || { echo "cd failed" >&2; exit 1; } fi - vm1="tck-test$$1" - vm2="tck-test$$2" + vm1="tck-$$1" + vm2="tck-$$2" createTestFilters "${flags}" if [ $? -ne 0 ]; then -- 2.14.4

On Fri, Jun 08, 2018 at 11:00:34AM -0400, Laine Stump wrote:
When new pids are more than 9 digits long
The nwfilter tests use tck-test${pid} as the auto-generated name for their test domains (and therefore the tap devices created for those test domains). When the pid is > 9 digits long, the total length of the name is > 16, which is the maximum length for any network device name (IFNAMSIZ), and this causes failure to create the tap device, thus failure of the test:
/home/laine/devel/libvirt-tck/scripts/nwfilter/050-apply-verify-host.t .. error: Failed to start domain tck-test10513851 error: Network interface name 'tck-test10513851' is too long: Numerical result out of range
The solution is to just remove "test" from the name template, so pid can be up to 12 digits long before the test fails.
Alternatively just delete the <target dev=.../> and let libvirt autoassign.
Signed-off-by: Laine Stump <laine@laine.org> --- scripts/nwfilter/nwfilter2vmtest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (2)
-
Daniel P. Berrangé
-
Laine Stump