qemu

FORK: QEMU emulator
git clone https://git.neptards.moe/neptards/qemu.git
Log | Files | Refs | Submodules | LICENSE

192 (1858B)


      1 #!/usr/bin/env bash
      2 # group: rw auto quick
      3 #
      4 # Test NBD export with -incoming (non-shared storage migration use case from
      5 # libvirt)
      6 #
      7 # Copyright (C) 2017 Red Hat, Inc.
      8 #
      9 # This program is free software; you can redistribute it and/or modify
     10 # it under the terms of the GNU General Public License as published by
     11 # the Free Software Foundation; either version 2 of the License, or
     12 # (at your option) any later version.
     13 #
     14 # This program is distributed in the hope that it will be useful,
     15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17 # GNU General Public License for more details.
     18 #
     19 # You should have received a copy of the GNU General Public License
     20 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
     21 #
     22 
     23 # creator
     24 owner=fam@euphon.net
     25 
     26 seq=`basename $0`
     27 echo "QA output created by $seq"
     28 
     29 status=1	# failure is the default!
     30 
     31 _cleanup()
     32 {
     33     _cleanup_qemu
     34     _cleanup_test_img
     35     rm -f "$SOCK_DIR/nbd"
     36 }
     37 trap "_cleanup; exit \$status" 0 1 2 3 15
     38 
     39 # get standard environment, filters and checks
     40 . ./common.rc
     41 . ./common.filter
     42 . ./common.qemu
     43 
     44 _supported_fmt generic
     45 _supported_proto file
     46 
     47 if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
     48     _notrun "Requires a PC machine"
     49 fi
     50 
     51 size=64M
     52 _make_test_img $size
     53 
     54 if test "$IMGOPTSSYNTAX" = "true"
     55 then
     56     DRIVE_ARG=if=ide,id=drive0,$TEST_IMG
     57 else
     58     DRIVE_ARG=if=ide,id=drive0,format=$IMGFMT,file=$TEST_IMG
     59 fi
     60 
     61 qemu_comm_method="monitor"
     62 _launch_qemu -drive $DRIVE_ARG -incoming defer
     63 h=$QEMU_HANDLE
     64 if [ "${VALGRIND_QEMU}" == "y" ]; then
     65     QEMU_COMM_TIMEOUT=7
     66 else
     67     QEMU_COMM_TIMEOUT=1
     68 fi
     69 
     70 _send_qemu_cmd $h "nbd_server_start unix:$SOCK_DIR/nbd" "(qemu)"
     71 _send_qemu_cmd $h "nbd_server_add -w drive0" "(qemu)"
     72 _send_qemu_cmd $h "q" "(qemu)"
     73 
     74 # success, all done
     75 echo "*** done"
     76 rm -f $seq.full
     77 status=0