Example #1
0
def run_pxe(test, params, env):
    """
    PXE test:

    1) Boot up guest from NIC(from pxe/gpxe server)
    2) Snoop the tftp packet in the tap device
    3) Analyzing the tcpdump result

    @param test: QEMU test object.
    @param params: Dictionary with the test parameters.
    @param env: Dictionary with test environment.
    """
    error.context("Try to boot from NIC", logging.info)
    vm = env.get_vm(params["main_vm"])
    vm.verify_alive()
    timeout = int(params.get("pxe_timeout", 60))

    error.context("Snoop packet in the tap device", logging.info)
    output = aexpect.run_fg("tcpdump -nli %s" % vm.get_ifname(),
                                   logging.debug, "(pxe capture) ", timeout)[1]

    error.context("Analyzing the tcpdump result", logging.info)
    if not "tftp" in output:
        raise error.TestFail("Couldn't find any TFTP packets after %s seconds" %
                             timeout)
    logging.info("Found TFTP packet")
Example #2
0
def run_pxe(test, params, env):
    """
    PXE test:

    1) Boot up guest from NIC(from pxe/gpxe server)
    2) Snoop the tftp packet in the tap device
    3) Analyzing the tcpdump result

    @param test: QEMU test object.
    @param params: Dictionary with the test parameters.
    @param env: Dictionary with test environment.
    """
    error.context("Try to boot from NIC", logging.info)
    vm = env.get_vm(params["main_vm"])
    vm.verify_alive()
    timeout = int(params.get("pxe_timeout", 60))

    error.context("Snoop packet in the tap device", logging.info)
    output = aexpect.run_fg("tcpdump -nli %s" % vm.get_ifname(), logging.debug,
                            "(pxe capture) ", timeout)[1]

    error.context("Analyzing the tcpdump result", logging.info)
    if not "tftp" in output:
        raise error.TestFail(
            "Couldn't find any TFTP packets after %s seconds" % timeout)
    logging.info("Found TFTP packet")
Example #3
0
def run_pxe(test, params, env):
    """
    PXE test:

    1) Snoop the tftp packet in the tap device.
    2) Wait for some seconds.
    3) Check whether we could capture TFTP packets.

    @param test: QEMU test object.
    @param params: Dictionary with the test parameters.
    @param env: Dictionary with test environment.
    """
    vm = env.get_vm(params["main_vm"])
    vm.verify_alive()
    timeout = int(params.get("pxe_timeout", 60))

    logging.info("Try to boot from PXE")
    output = aexpect.run_fg("tcpdump -nli %s" % vm.get_ifname(),
                                   logging.debug, "(pxe capture) ", timeout)[1]

    logging.info("Analyzing the tcpdump result...")
    if not "tftp" in output:
        raise error.TestFail("Couldn't find any TFTP packets after %s seconds" %
                             timeout)
    logging.info("Found TFTP packet")
Example #4
0
def run(test, params, env):
    """
    Run qemu_iotests.sh script:
    1) Do some qemu_io operations(write & read etc.)
    2) Check whether qcow image file is corrupted

    :param test:   QEMU test object
    :param params: Dictionary with the test parameters
    :param env:    Dictionary with test environment.
    """

    test_type = params.get("test_type")
    qemu_io_config = None
    if test_type == "lvm":
        qemu_io_config = QemuIOConfig(test, params)
        qemu_io_config.setup()

    test_script = os.path.join(data_dir.get_root_dir(),
                               'shared/scripts/qemu_iotests.sh')
    logging.info("Running script now: %s" % test_script)
    test_image = params.get("test_image", "/tmp/test.qcow2")
    s, test_result = aexpect.run_fg("sh %s %s" % (test_script, test_image),
                                    logging.debug,
                                    timeout=1800)

    err_string = {
        "err_nums": "\d errors were found on the image.",
        "an_err": "An error occurred during the check",
        "unsupt_err": "This image format does not support checks",
        "mem_err": "Not enough memory",
        "open_err": "Could not open",
        "fmt_err": "Unknown file format",
        "commit_err": "Error while committing image",
        "bootable_err": "no bootable device",
    }

    try:
        for err_type in err_string.keys():
            msg = re.findall(err_string.get(err_type), test_result)
            if msg:
                raise error.TestFail(msg)
    finally:
        try:
            if qemu_io_config:
                qemu_io_config.cleanup()
        except Exception, e:
            logging.warn(e)
Example #5
0
def run_qemu_io(test, params, env):
    """
    Run qemu_iotests.sh script:
    1) Do some qemu_io operations(write & read etc.)
    2) Check whether qcow image file is corrupted

    @param test:   QEMU test object
    @param params: Dictionary with the test parameters
    @param env:    Dictionary with test environment.
    """

    test_type = params.get("test_type")
    qemu_io_config = None
    if test_type == "lvm":
        qemu_io_config = QemuIOConfig(test, params)
        qemu_io_config.setup()

    test_script = os.path.join(data_dir.get_root_dir(),
                               'shared/scripts/qemu_iotests.sh')
    logging.info("Running script now: %s" % test_script)
    test_image = params.get("test_image", "/tmp/test.qcow2")
    s, test_result = aexpect.run_fg("sh %s %s" % (test_script,
                                                         test_image),
                                           logging.debug, timeout = 1800)

    err_string = {
       "err_nums":    "\d errors were found on the image.",
       "an_err":      "An error occurred during the check",
       "unsupt_err":  "This image format does not support checks",
       "mem_err":     "Not enough memory",
       "open_err":    "Could not open",
       "fmt_err":     "Unknown file format",
       "commit_err":  "Error while committing image",
       "bootable_err":  "no bootable device",
       }

    try:
        for err_type in err_string.keys():
            msg = re.findall(err_string.get(err_type), test_result)
            if msg:
                raise error.TestFail, msg
    finally:
        try:
            if qemu_io_config:
                qemu_io_config.cleanup()
        except Exception, e:
            logging.warn(e)