14dddeac1SMax Reitz#!/usr/bin/env bash 2f8b467b4SThomas Huth# group: rw quick 34dddeac1SMax Reitz# 44dddeac1SMax Reitz# Test generic image creation fallback (by using NBD) 54dddeac1SMax Reitz# 64dddeac1SMax Reitz# Copyright (C) 2019 Red Hat, Inc. 74dddeac1SMax Reitz# 84dddeac1SMax Reitz# This program is free software; you can redistribute it and/or modify 94dddeac1SMax Reitz# it under the terms of the GNU General Public License as published by 104dddeac1SMax Reitz# the Free Software Foundation; either version 2 of the License, or 114dddeac1SMax Reitz# (at your option) any later version. 124dddeac1SMax Reitz# 134dddeac1SMax Reitz# This program is distributed in the hope that it will be useful, 144dddeac1SMax Reitz# but WITHOUT ANY WARRANTY; without even the implied warranty of 154dddeac1SMax Reitz# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 164dddeac1SMax Reitz# GNU General Public License for more details. 174dddeac1SMax Reitz# 184dddeac1SMax Reitz# You should have received a copy of the GNU General Public License 194dddeac1SMax Reitz# along with this program. If not, see <http://www.gnu.org/licenses/>. 204dddeac1SMax Reitz# 214dddeac1SMax Reitz 224dddeac1SMax Reitz# creator 23*42a5009dSJohn Snowowner=hreitz@redhat.com 244dddeac1SMax Reitz 254dddeac1SMax Reitzseq=$(basename $0) 264dddeac1SMax Reitzecho "QA output created by $seq" 274dddeac1SMax Reitz 284dddeac1SMax Reitzstatus=1 # failure is the default! 294dddeac1SMax Reitz 304dddeac1SMax Reitz_cleanup() 314dddeac1SMax Reitz{ 324dddeac1SMax Reitz _cleanup_test_img 334dddeac1SMax Reitz} 344dddeac1SMax Reitztrap "_cleanup; exit \$status" 0 1 2 3 15 354dddeac1SMax Reitz 364dddeac1SMax Reitz# get standard environment, filters and checks 374dddeac1SMax Reitz. ./common.rc 384dddeac1SMax Reitz. ./common.filter 394dddeac1SMax Reitz 404dddeac1SMax Reitz_supported_fmt raw 414dddeac1SMax Reitz_supported_proto nbd 424dddeac1SMax Reitz_supported_os Linux 434dddeac1SMax Reitz 444dddeac1SMax Reitz 454dddeac1SMax Reitz_make_test_img 64M 464dddeac1SMax Reitz 474dddeac1SMax Reitzecho 484dddeac1SMax Reitzecho '--- Testing creation ---' 494dddeac1SMax Reitz 504dddeac1SMax Reitz$QEMU_IMG create -f qcow2 "$TEST_IMG" 64M | _filter_img_create 514dddeac1SMax Reitz$QEMU_IMG info "$TEST_IMG" | _filter_img_info 524dddeac1SMax Reitz 534dddeac1SMax Reitzecho 544dddeac1SMax Reitzecho '--- Testing creation for which the node would need to grow ---' 554dddeac1SMax Reitz 564dddeac1SMax Reitz# NBD does not support resizing, so this will fail 574dddeac1SMax Reitz$QEMU_IMG create -f qcow2 -o preallocation=metadata "$TEST_IMG" 64M 2>&1 \ 584dddeac1SMax Reitz | _filter_img_create 594dddeac1SMax Reitz 604dddeac1SMax Reitz# success, all done 614dddeac1SMax Reitzecho "*** done" 624dddeac1SMax Reitzrm -f $seq.full 634dddeac1SMax Reitzstatus=0 64