#!/usr/bin/env python
#
# Test parallels and file image creation
#
# Copyright (C) 2018 Red Hat, Inc.
#
# Creator/Owner: Kevin Wolf <kwolf@redhat.com>
#
# 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/>.
#

import iotests
from iotests import imgfmt

iotests.verify_image_format(supported_fmts=['parallels'])
iotests.verify_protocol(supported=['file'])

with iotests.FilePath('t.parallels') as disk_path, \
     iotests.VM() as vm:

    #
    # Successful image creation (defaults)
    #
    iotests.log("=== Successful image creation (defaults) ===")
    iotests.log("")

    size = 128 * 1024 * 1024

    vm.launch()
    vm.blockdev_create({ 'driver': 'file',
                         'filename': disk_path,
                         'size': 0 })

    vm.qmp_log('blockdev-add', driver='file', filename=disk_path,
               node_name='imgfile', filters=[iotests.filter_qmp_testfiles])

    vm.blockdev_create({ 'driver': imgfmt,
                         'file': 'imgfile',
                         'size': size })
    vm.shutdown()

    iotests.img_info_log(disk_path)

    #
    # Successful image creation (explicit defaults)
    #
    iotests.log("=== Successful image creation (explicit defaults) ===")
    iotests.log("")

    # Choose a different size to show that we got a new image
    size = 64 * 1024 * 1024

    vm.launch()
    vm.blockdev_create({ 'driver': 'file',
                         'filename': disk_path,
                         'size': 0 })
    vm.blockdev_create({ 'driver': imgfmt,
                         'file': {
                             'driver': 'file',
                             'filename': disk_path,
                         },
                         'size': size,
                         'cluster-size': 1048576 })
    vm.shutdown()

    iotests.img_info_log(disk_path)

    #
    # Successful image creation (with non-default options)
    #
    iotests.log("=== Successful image creation (with non-default options) ===")
    iotests.log("")

    # Choose a different size to show that we got a new image
    size = 32 * 1024 * 1024

    vm.launch()
    vm.blockdev_create({ 'driver': 'file',
                         'filename': disk_path,
                         'size': 0 })
    vm.blockdev_create({ 'driver': imgfmt,
                         'file': {
                             'driver': 'file',
                             'filename': disk_path,
                         },
                         'size': size,
                         'cluster-size': 65536 })
    vm.shutdown()

    iotests.img_info_log(disk_path)

    #
    # Invalid BlockdevRef
    #
    iotests.log("=== Invalid BlockdevRef ===")
    iotests.log("")

    vm.launch()
    vm.blockdev_create({ 'driver': imgfmt,
                         'file': "this doesn't exist",
                         'size': size })
    vm.shutdown()

    #
    # Zero size
    #
    iotests.log("=== Zero size ===")
    iotests.log("")

    vm.add_blockdev('driver=file,filename=%s,node-name=node0' % (disk_path))
    vm.launch()
    vm.blockdev_create({ 'driver': imgfmt,
                         'file': 'node0',
                         'size': 0 })
    vm.shutdown()

    iotests.img_info_log(disk_path)

    #
    # Maximum size
    #
    iotests.log("=== Maximum size ===")
    iotests.log("")

    vm.launch()
    vm.blockdev_create({ 'driver': imgfmt,
                         'file': 'node0',
                         'size': 4503599627369984})
    vm.shutdown()

    iotests.img_info_log(disk_path)

    #
    # Invalid sizes
    #

    # TODO Negative image sizes aren't handled correctly, but this is a problem
    # with QAPI's implementation of the 'size' type and affects other commands
    # as well. Once this is fixed, we may want to add a test case here.

    # 1. Misaligned image size
    # 2. 2^64 - 512
    # 3. 2^63 = 8 EB (qemu-img enforces image sizes less than this)
    # 4. 2^63 - 512 (generally valid, but with the image header the file will
    #                exceed 63 bits)
    # 5. 2^52 (512 bytes more than maximum image size)

    iotests.log("=== Invalid sizes ===")
    iotests.log("")

    vm.launch()
    for size in [ 1234, 18446744073709551104, 9223372036854775808,
                  9223372036854775296, 4503599627370497 ]:
        vm.blockdev_create({ 'driver': imgfmt,
                             'file': 'node0',
                             'size': size })
    vm.shutdown()

    #
    # Invalid cluster size
    #
    iotests.log("=== Invalid cluster size ===")
    iotests.log("")

    vm.launch()
    for csize in [ 1234, 128, 4294967296, 9223372036854775808,
                   18446744073709551104, 0 ]:
        vm.blockdev_create({ 'driver': imgfmt,
                             'file': 'node0',
                             'size': 67108864,
                             'cluster-size': csize })
    vm.blockdev_create({ 'driver': imgfmt,
                         'file': 'node0',
                         'size': 281474976710656,
                         'cluster-size': 512 })
    vm.shutdown()
