def METHOD_NAME(test, params, env):
    """
    Test command: virsh iothread.
    The command can change the number of iothread.
    1.Prepare test environment,destroy or suspend a VM.
    2.Perform virsh iothreadadd operation.
    3.Recover test environment.
    4.Confirm the test result.
    """
    libvirt_version.is_libvirt_feature_supported(params)
    vm_name = params.get("main_vm")
    vm = env.get_vm(vm_name)
    pre_vm_state = params.get("iothread_pre_vm_state")
    command = params.get("iothread_command", "iothread")
    options = params.get("iothread_options")
    status_error = "yes" == params.get("status_error")
    add_iothread_id = params.get("add_iothread_id")
    iothread_id = params.get("iothread_id")
    disallowed_cpuset = params.get("disallowed_cpuset")
    error_msg = params.get("error_msg")
    # Save original configuration
    vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name)
    orig_config_xml = vmxml.copy()
    try:
        if vm.is_alive():
            vm.destroy()
        option_list = options.split(" ")
        for item in option_list:
            if virsh.has_command_help_match(command, item) is None:
                raise exceptions.TestSkipError("The current libvirt version"
                                               " doesn't support '%s' option"
                                               % item)
        setup_vmxml_before_start(vmxml, params)
        # Restart, unless that's not our test
        if not vm.is_alive():
            vm.start()
        vm.wait_for_login()
        dom_option = get_dom_option(vm, params.get("iothread_vm_ref"))
        if pre_vm_state == "shut off" and vm.is_alive():
            vm.destroy()
        virsh_dargs = {"debug": True}
        if "yes" == params.get("readonly", "no"):
            virsh_dargs.update({"readonly": True})
        cpuset = process_cpuset(params, test)
        if add_iothread_id:
            iothread_id = add_iothread_id
            virsh.iothreadadd(dom_option, add_iothread_id, debug=True, ignore_status=False)
        ret = virsh.iothreadpin(dom_option, iothread_id, cpuset,
                                options, **virsh_dargs)
        if error_msg:
            libvirt.check_result(ret, expected_fails=error_msg)
        else:
            libvirt.check_exit_status(ret, status_error)
        if disallowed_cpuset:
            verify_test_disallowed_cpuset(vm_name, options, test)
        if not status_error:
            # Check domainxml
            iothread_info = get_iothreadpins(vm_name, options)
            logging.debug("iothreadinfo: %s", iothread_info)
            for info in iothread_info:
                if info["iothread"] == iothread_id and info["cpuset"] == cpuset:
                    # Find the iothreadpins in domain xml
                    break
                elif iothread_info.index(info) == (len(iothread_info) - 1):
                    # Can not find the iothreadpins at last
                    raise exceptions.TestFail("Failed to add iothread %s in domain xml",
                                              iothread_id)
            # Check iothreadinfo by virsh command
            iothread_info = libvirt.get_iothreadsinfo(dom_option, options)
            logging.debug("iothreadinfo: %s", iothread_info)
            if (iothread_id not in iothread_info or
                    iothread_info[iothread_id] != cpuset):
                raise exceptions.TestFail("Failed to add iothreadpins %s", iothread_id)
    finally:
        # Cleanup
        if vm.is_alive():
            vm.destroy()
        orig_config_xml.sync()