#!/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,
                    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')
