#!/usr/bin/env python3
#
# Copy-on-read tests using a COR filter node
#
# 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: Max Reitz <mreitz@redhat.com>

import iotests
from iotests import log, qemu_img, qemu_io_silent

# Need backing file support
iotests.script_initialize(supported_fmts=['qcow2', 'qcow', 'qed', 'vmdk'],
                          supported_platforms=['linux'])

log('')
log('=== Copy-on-read across nodes ===')
log('')

# The old copy-on-read mechanism without a filter node cannot request
# WRITE_UNCHANGED permissions for its child.  Therefore it just tries
# to sneak its write by the usual permission system and holds its
# fingers crossed.  However, that sneaking does not work so well when
# there is a filter node in the way: That will receive the write
# request and re-issue a new one to its child, which this time is a
# proper write request that will make the permission system cough --
# unless there is someone at the top (like a guest device) that has
# requested write permissions.
#
# A COR filter node, however, can request the proper permissions for
# its child and therefore is not hit by this issue.

with iotests.FilePath('base.img') as base_img_path, \
     iotests.FilePath('top.img') as top_img_path, \
     iotests.VM() as vm:

    log('--- Setting up images ---')
    log('')

    assert qemu_img('create', '-f', iotests.imgfmt, base_img_path, '64M') == 0
    assert qemu_io_silent(base_img_path, '-c', 'write -P 1 0M 1M') == 0
    assert qemu_img('create', '-f', iotests.imgfmt, '-b', base_img_path,
                    '-F', iotests.imgfmt, top_img_path) == 0
    assert qemu_io_silent(top_img_path,  '-c', 'write -P 2 1M 1M') == 0

    log('Done')

    log('')
    log('--- Doing COR ---')
    log('')

    # Compare with e.g. the following:
    #   vm.add_drive_raw('if=none,node-name=node0,copy-on-read=on,driver=raw,' \
    #                    'file.driver=%s,file.file.filename=%s' %
    #                       (iotests.imgfmt, top_img_path))
    # (Remove the blockdev-add instead.)
    # ((Not tested here because it hits an assertion in the permission
    #   system.))

    vm.launch()

    log(vm.qmp('blockdev-add',
                    node_name='node0',
                    driver='copy-on-read',
                    file={
                        'driver': 'raw',
                        'file': {
                            'driver': 'copy-on-read',
                            'file': {
                                'driver': 'raw',
                                'file': {
                                    'driver': iotests.imgfmt,
                                    'file': {
                                        'driver': 'file',
                                        'filename': top_img_path
                                    },
                                    'backing': {
                                        'driver': iotests.imgfmt,
                                        'file': {
                                            'driver': 'file',
                                            'filename': base_img_path
                                        }
                                    }
                                }
                            }
                        }
                    }))

    # Trigger COR
    log(vm.qmp('human-monitor-command',
               command_line='qemu-io node0 "read 0 64M"'))

    vm.shutdown()

    log('')
    log('--- Checking COR result ---')
    log('')

    assert qemu_io_silent(base_img_path, '-c', 'discard 0 64M') == 0
    assert qemu_io_silent(top_img_path,  '-c', 'read -P 1 0M 1M') == 0
    assert qemu_io_silent(top_img_path,  '-c', 'read -P 2 1M 1M') == 0

    log('Done')
