#!/usr/bin/env python3
#
# Copyright (C) 2018 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Creator/Owner: Stefan Hajnoczi <stefanha@redhat.com>
#
# Check that the runtime NBD server does not crash when stopped after
# blockdev-snapshot-sync.

import iotests

iotests.script_initialize(supported_fmts=['generic'])

with iotests.FilePath('disk.img') as disk_img_path, \
     iotests.FilePath('disk-snapshot.img') as disk_snapshot_img_path, \
     iotests.FilePath('nbd.sock', iotests.sock_dir) as nbd_sock_path, \
     iotests.VM() as vm:

    img_size = '10M'
    iotests.qemu_img_create('-f', iotests.imgfmt, disk_img_path, img_size)

    iotests.log('Launching VM...')
    (vm.add_drive(disk_img_path, 'node-name=drive0-node', interface='none')
       .launch())

    iotests.log('Starting NBD server...')
    iotests.log(vm.qmp('nbd-server-start', addr={
            "type": "unix",
            "data": {
                "path": nbd_sock_path,
            }
        }))

    iotests.log('Adding NBD export...')
    iotests.log(vm.qmp('nbd-server-add', device='drive0-node', writable=True))

    iotests.log('Creating external snapshot...')
    iotests.log(vm.qmp('blockdev-snapshot-sync',
        node_name='drive0-node',
        snapshot_node_name='drive0-snapshot-node',
        snapshot_file=disk_snapshot_img_path))

    iotests.log('Stopping NBD server...')
    iotests.log(vm.qmp('nbd-server-stop'))
