1*4dddeac1SMax Reitz#!/usr/bin/env bash 2*4dddeac1SMax Reitz# 3*4dddeac1SMax Reitz# Test generic image creation fallback (by using NBD) 4*4dddeac1SMax Reitz# 5*4dddeac1SMax Reitz# Copyright (C) 2019 Red Hat, Inc. 6*4dddeac1SMax Reitz# 7*4dddeac1SMax Reitz# This program is free software; you can redistribute it and/or modify 8*4dddeac1SMax Reitz# it under the terms of the GNU General Public License as published by 9*4dddeac1SMax Reitz# the Free Software Foundation; either version 2 of the License, or 10*4dddeac1SMax Reitz# (at your option) any later version. 11*4dddeac1SMax Reitz# 12*4dddeac1SMax Reitz# This program is distributed in the hope that it will be useful, 13*4dddeac1SMax Reitz# but WITHOUT ANY WARRANTY; without even the implied warranty of 14*4dddeac1SMax Reitz# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*4dddeac1SMax Reitz# GNU General Public License for more details. 16*4dddeac1SMax Reitz# 17*4dddeac1SMax Reitz# You should have received a copy of the GNU General Public License 18*4dddeac1SMax Reitz# along with this program. If not, see <http://www.gnu.org/licenses/>. 19*4dddeac1SMax Reitz# 20*4dddeac1SMax Reitz 21*4dddeac1SMax Reitz# creator 22*4dddeac1SMax Reitzowner=mreitz@redhat.com 23*4dddeac1SMax Reitz 24*4dddeac1SMax Reitzseq=$(basename $0) 25*4dddeac1SMax Reitzecho "QA output created by $seq" 26*4dddeac1SMax Reitz 27*4dddeac1SMax Reitzstatus=1 # failure is the default! 28*4dddeac1SMax Reitz 29*4dddeac1SMax Reitz_cleanup() 30*4dddeac1SMax Reitz{ 31*4dddeac1SMax Reitz _cleanup_test_img 32*4dddeac1SMax Reitz} 33*4dddeac1SMax Reitztrap "_cleanup; exit \$status" 0 1 2 3 15 34*4dddeac1SMax Reitz 35*4dddeac1SMax Reitz# get standard environment, filters and checks 36*4dddeac1SMax Reitz. ./common.rc 37*4dddeac1SMax Reitz. ./common.filter 38*4dddeac1SMax Reitz 39*4dddeac1SMax Reitz_supported_fmt raw 40*4dddeac1SMax Reitz_supported_proto nbd 41*4dddeac1SMax Reitz_supported_os Linux 42*4dddeac1SMax Reitz 43*4dddeac1SMax Reitz 44*4dddeac1SMax Reitz_make_test_img 64M 45*4dddeac1SMax Reitz 46*4dddeac1SMax Reitzecho 47*4dddeac1SMax Reitzecho '--- Testing creation ---' 48*4dddeac1SMax Reitz 49*4dddeac1SMax Reitz$QEMU_IMG create -f qcow2 "$TEST_IMG" 64M | _filter_img_create 50*4dddeac1SMax Reitz$QEMU_IMG info "$TEST_IMG" | _filter_img_info 51*4dddeac1SMax Reitz 52*4dddeac1SMax Reitzecho 53*4dddeac1SMax Reitzecho '--- Testing creation for which the node would need to grow ---' 54*4dddeac1SMax Reitz 55*4dddeac1SMax Reitz# NBD does not support resizing, so this will fail 56*4dddeac1SMax Reitz$QEMU_IMG create -f qcow2 -o preallocation=metadata "$TEST_IMG" 64M 2>&1 \ 57*4dddeac1SMax Reitz | _filter_img_create 58*4dddeac1SMax Reitz 59*4dddeac1SMax Reitz# success, all done 60*4dddeac1SMax Reitzecho "*** done" 61*4dddeac1SMax Reitzrm -f $seq.full 62*4dddeac1SMax Reitzstatus=0 63