예제 #1
0
        domid = vm.get_id()

    if vm_ref == "domname":
        vm_ref = vm_name
    elif vm_ref == "domid":
        vm_ref = domid
    elif vm_ref == "domuuid":
        vm_ref = domuuid
    elif domid and vm_ref == "hex_id":
        vm_ref = hex(int(domid))

    try:
        # Run virsh command
        cmd_result = virsh.qemu_agent_command(vm_ref,
                                              cmd,
                                              options,
                                              ignore_status=True,
                                              debug=True)
        status = cmd_result.exit_status

        # Check result
        if not libvirtd_inst.is_running():
            raise error.TestFail("Libvirtd is not running after run command.")
        if status_error:
            if not status:
                # Bug 853673
                err_msg = "Expect fail but run successfully, please check Bug: "
                err_msg += "https://bugzilla.redhat.com/show_bug.cgi?id=853673"
                err_msg += " for more info"
                raise error.TestFail(err_msg)
            else:
예제 #2
0
def run(test, params, env):
    """
    Test command: virsh qemu-agent-command.
    """
    vm_name = params.get("main_vm")
    vm = env.get_vm(vm_name)
    status_cmd = params.get("status_cmd", "")
    freeze_cmd = params.get("freeze_cmd", "")
    thaw_cmd = params.get("thaw_cmd", "")
    xml_backup = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name)
    try:

        def get_dirty(session, frozen=False):
            """
            Get dirty data of guest
            """
            try:
                data_cmd = "cat /proc/meminfo | grep Dirty"
                if not frozen:
                    result = utils_misc.wait_for(
                        lambda: int(
                            session.cmd_output(data_cmd).strip().split()[1]) !=
                        0, 60)
                    if result:
                        return int(
                            session.cmd_output(data_cmd).strip().split()[1])
                    else:
                        return 0
                    dirty_info = session.cmd_output(data_cmd).strip()
                    return int(dirty_info.split()[1])
                else:
                    result = utils_misc.wait_for(
                        lambda: int(
                            session.cmd_output(data_cmd).strip().split()[1]) ==
                        0, 60)
                    if result:
                        return 0
                    else:
                        return int(
                            session.cmd_output(data_cmd).strip().split()[1])
            except (IndexError, ValueError) as details:
                test.fail("Get dirty info failed: %s" % details)

        device_source_path = os.path.join(data_dir.get_tmp_dir(), "disk.img")
        device_source = libvirt.create_local_disk("file",
                                                  path=device_source_path,
                                                  disk_format="qcow2")
        vm.prepare_guest_agent()

        # Do operation before freeze guest filesystem
        session = vm.wait_for_login()
        tmp_file = "/mnt/test.file"
        try:
            # Create extra image and attach to guest, then mount
            old_parts = utils_disk.get_parts_list(session)
            ret = virsh.attach_disk(vm_name, device_source, "vdd")
            if ret.exit_status:
                test.fail("Attaching device failed before testing agent:%s" %
                          ret.stdout.strip())
            time.sleep(1)
            new_parts = utils_disk.get_parts_list(session)
            added_part = list(set(new_parts).difference(set(old_parts)))
            session.cmd("mkfs.ext3 -F /dev/{0} && mount /dev/{0} /mnt".format(
                added_part[0]))

            # Generate dirty memory
            session.cmd("rm -f %s" % tmp_file)
            session.cmd_output("cp /dev/zero %s 2>/dev/null &" % tmp_file)
            # Get original dirty data
            org_dirty_info = get_dirty(session)
            fz_cmd_result = virsh.qemu_agent_command(vm_name,
                                                     freeze_cmd,
                                                     ignore_status=True,
                                                     debug=True)
            libvirt.check_exit_status(fz_cmd_result)

            # Get frozen dirty data
            fz_dirty_info = get_dirty(session, True)
            st_cmd_result = virsh.qemu_agent_command(vm_name,
                                                     status_cmd,
                                                     ignore_status=True,
                                                     debug=True)
            libvirt.check_exit_status(st_cmd_result)
            if not st_cmd_result.stdout.strip().count("frozen"):
                test.fail("Guest filesystem status is not frozen: %s" %
                          st_cmd_result.stdout.strip())

            tw_cmd_result = virsh.qemu_agent_command(vm_name,
                                                     thaw_cmd,
                                                     ignore_status=True,
                                                     debug=True)
            libvirt.check_exit_status(tw_cmd_result)

            # Get thawed dirty data
            tw_dirty_info = get_dirty(session)
            st_cmd_result = virsh.qemu_agent_command(vm_name,
                                                     status_cmd,
                                                     ignore_status=True,
                                                     debug=True)
            libvirt.check_exit_status(st_cmd_result)
            if not st_cmd_result.stdout.strip().count("thawed"):
                test.fail("Guest filesystem status is not thawed: %s" %
                          st_cmd_result.stdout.strip())
            logging.info("Original dirty data: %s" % org_dirty_info)
            logging.info("Frozen dirty data: %s" % fz_dirty_info)
            logging.info("Thawed dirty data: %s" % tw_dirty_info)
            if not tw_dirty_info or not org_dirty_info:
                test.fail("The thawed dirty data should not be 0!")
            if fz_dirty_info:
                test.fail("The frozen dirty data should be 0!")
        finally:
            # Thaw the file system that remove action can be done
            virsh.qemu_agent_command(vm_name, thaw_cmd, ignore_status=True)
            session.cmd("rm -f %s" % tmp_file)
            session.close()
    finally:
        xml_backup.sync()
        os.remove(device_source_path)
def run(test, params, env):
    """
    Test command: virsh qemu-agent-command.
    """
    vm_name = params.get("main_vm")
    vm = env.get_vm(vm_name)
    vm_ref = params.get("vm_ref", "domname")
    vm_state = params.get("vm_state", "running")
    cmd = params.get("agent_cmd", "")
    options = params.get("options", "")
    needs_agent = "yes" == params.get("needs_agent", "yes")
    status_error = "yes" == params.get("status_error", "no")
    if not status_error and options:
        option = options.split()[0]
        test_cmd = "qemu-agent-command"
        if virsh.has_command_help_match(test_cmd, option) is None:
            test.cancel("The current libvirt doesn't support"
                        " %s option for %s" % (option, test_cmd))
    guest_cpu_busy = "yes" == params.get("guest_cpu_busy", "no")
    password = params.get("password", None)
    domuuid = vm.get_uuid()
    domid = ""
    xml_file = os.path.join(data_dir.get_tmp_dir(), "vm.xml")
    virsh.dumpxml(vm_name, extra="--inactive", to_file=xml_file)
    libvirtd_inst = utils_libvirtd.Libvirtd()

    # Prepare domain
    try:
        reset_domain(test, vm, vm_state, needs_agent, guest_cpu_busy, password)
    except exceptions.TestCancel as details:
        reset_env(vm_name, xml_file)
        test.cancel(details)
    except Exception as details:
        reset_env(vm_name, xml_file)
        test.fail(details)

    if vm_state != "shut off":
        domid = vm.get_id()

    if vm_ref == "domname":
        vm_ref = vm_name
    elif vm_ref == "domid":
        vm_ref = domid
    elif vm_ref == "domuuid":
        vm_ref = domuuid
    elif domid and vm_ref == "hex_id":
        vm_ref = hex(int(domid))

    try:
        if vm_state == "running" and needs_agent:
            # Check whether qemu-guest-agent is active in guest
            session = vm.wait_for_login()

            def verify_alive():
                return utils_misc.get_guest_service_status(
                    session, 'qemu-guest-agent') == 'active'

            if not utils_misc.wait_for(verify_alive, 30):
                test.error('Service "qemu-guest-agent" is not active')

        # Run virsh command
        cmd_result = virsh.qemu_agent_command(vm_ref,
                                              cmd,
                                              options,
                                              ignore_status=True,
                                              debug=True)
        status = cmd_result.exit_status

        # Check result
        if not libvirtd_inst.is_running():
            test.fail("Libvirtd is not running after run command.")
        if status_error:
            if not status:
                # Bug 853673
                err_msg = "Expect fail but run successfully, please check Bug: "
                err_msg += "https://bugzilla.redhat.com/show_bug.cgi?id=853673"
                err_msg += " for more info"
                test.fail(err_msg)
            else:
                logging.debug("Command failed as expected.")
        else:
            if status:
                if cmd_result.stderr.count("not responding"):
                    test.cancel(cmd_result.stderr.strip())
                if cmd.count("guest-shutdown") and\
                   cmd_result.stderr.count("Missing monitor reply object"):
                    err_msg = "Please check bug: "
                    err_msg += "https://bugzilla.redhat.com/show_bug.cgi?id="
                    err_msg += "1050843 for more info"
                    logging.error(err_msg)
                if "--async" in options:
                    err_msg = "Please check bug: "
                    err_msg += "https://bugzilla.redhat.com/show_bug.cgi?id="
                    err_msg += "1099060 for more info"
                    logging.error(err_msg)
                test.fail("Expect succeed, but run fail.")
    finally:
        # Cleanup
        reset_env(vm_name, xml_file)
        if not libvirtd_inst.is_running():
            libvirtd_inst.restart()
def run(test, params, env):
    """
    Test command: virsh qemu-agent-command.
    """
    vm_name = params.get("main_vm")
    vm = env.get_vm(vm_name)
    status_cmd = params.get("status_cmd", "")
    freeze_cmd = params.get("freeze_cmd", "")
    thaw_cmd = params.get("thaw_cmd", "")
    tmp_file = params.get("tmp_file", "/tmp/test.file")
    xml_backup = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name)
    try:

        def get_dirty(session, frozen=False):
            """
            Get dirty data of guest
            """
            try:
                data_cmd = "cat /proc/meminfo | grep Dirty"
                if not frozen:
                    result = utils_misc.wait_for(
                        lambda: int(
                            session.cmd_output(data_cmd).strip().split()[1]) !=
                        0, 60)
                    if result:
                        return int(
                            session.cmd_output(data_cmd).strip().split()[1])
                    else:
                        return 0
                    dirty_info = session.cmd_output(data_cmd).strip()
                    return int(dirty_info.split()[1])
                else:
                    result = utils_misc.wait_for(
                        lambda: int(
                            session.cmd_output(data_cmd).strip().split()[1]) ==
                        0, 60)
                    if result:
                        return 0
                    else:
                        return int(
                            session.cmd_output(data_cmd).strip().split()[1])
            except (IndexError, ValueError), details:
                raise error.TestFail("Get dirty info failed: %s" % details)

        vm.prepare_guest_agent()

        # Do operation before freeze guest filesystem
        session = vm.wait_for_login()
        try:
            session.cmd("rm -f %s" % tmp_file)
            session.cmd_output("cp /dev/zero %s 2>/dev/null &" % tmp_file)
            time.sleep(5)
            # Get original dirty data
            org_dirty_info = get_dirty(session)
            fz_cmd_result = virsh.qemu_agent_command(vm_name,
                                                     freeze_cmd,
                                                     ignore_status=True,
                                                     debug=True)
            libvirt.check_exit_status(fz_cmd_result)
            # Wait for freeze filesystem
            time.sleep(1)

            # Get frozen dirty data
            fz_dirty_info = get_dirty(session, True)
            st_cmd_result = virsh.qemu_agent_command(vm_name,
                                                     status_cmd,
                                                     ignore_status=True,
                                                     debug=True)
            libvirt.check_exit_status(st_cmd_result)
            if not st_cmd_result.stdout.count("frozen"):
                raise error.TestFail(
                    "Guest filesystem status is not frozen: %s" %
                    st_cmd_result.stdout.strip())

            tw_cmd_result = virsh.qemu_agent_command(vm_name,
                                                     thaw_cmd,
                                                     ignore_status=True,
                                                     debug=True)
            libvirt.check_exit_status(tw_cmd_result)

            # Get thawed dirty data
            tw_dirty_info = get_dirty(session)
            st_cmd_result = virsh.qemu_agent_command(vm_name,
                                                     status_cmd,
                                                     ignore_status=True,
                                                     debug=True)
            libvirt.check_exit_status(st_cmd_result)
            if not st_cmd_result.stdout.count("thawed"):
                raise error.TestFail(
                    "Guest filesystem status is not thawed: %s" %
                    st_cmd_result.stdout.strip())
            logging.info("Original dirty data: %s" % org_dirty_info)
            logging.info("Frozen dirty data: %s" % fz_dirty_info)
            logging.info("Thawed dirty data: %s" % tw_dirty_info)
            if not tw_dirty_info or not org_dirty_info:
                raise error.TestFail("The thawed dirty data should not be 0!")
            if fz_dirty_info:
                raise error.TestFail("The frozen dirty data should be 0!")
        finally:
            # Thaw the file system that remove action can be done
            virsh.qemu_agent_command(vm_name, thaw_cmd, ignore_status=True)
            session.cmd("rm -f %s" % tmp_file)
            session.close()
def run(test, params, env):
    """
    Test command: virsh qemu-agent-command.
    """
    vm_name = params.get("main_vm")
    vm = env.get_vm(vm_name)
    status_cmd = params.get("status_cmd", "")
    freeze_cmd = params.get("freeze_cmd", "")
    thaw_cmd = params.get("thaw_cmd", "")
    tmp_file = params.get("tmp_file", "/tmp/test.file")
    xml_backup = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name)
    vm_xml.VMXML.set_agent_channel(vm_name)
    vm.start()
    session = vm.wait_for_login()
    session.cmd("qemu-ga -d")
    stat_ps = session.cmd_status("ps aux |grep [q]emu-ga")
    if stat_ps:
        session.close()
        xml_backup.sync()
        raise error.TestError("Fail to start qemu-guest-agent!")

    try:
        def get_dirty(session, frozen=False):
            """
            Get dirty data of guest
            """
            try:
                data_cmd = "cat /proc/meminfo | grep Dirty"
                if not frozen:
                    result = utils_misc.wait_for(lambda:
                                                 int(session.
                                                     cmd_output(data_cmd).
                                                     strip().split()[1]) != 0,
                                                 60)
                    if result:
                        return int(session.cmd_output(data_cmd).strip().
                                   split()[1])
                    else:
                        return 0
                    dirty_info = session.cmd_output(data_cmd).strip()
                    return int(dirty_info.split()[1])
                else:
                    result = utils_misc.wait_for(lambda:
                                                 int(session.
                                                     cmd_output(data_cmd).
                                                     strip().split()[1]) == 0,
                                                 60)
                    if result:
                        return 0
                    else:
                        return int(session.cmd_output(data_cmd).strip().
                                   split()[1])
            except (IndexError, ValueError), details:
                raise error.TestFail("Get dirty info failed: %s" % details)

        # Do operation before freeze guest filesystem
        session.cmd("rm -f %s" % tmp_file)
        session.cmd_output("cp /dev/zero %s 2>/dev/null &" % tmp_file)
        time.sleep(5)
        # Get original dirty data
        org_dirty_info = get_dirty(session)
        fz_cmd_result = virsh.qemu_agent_command(vm_name, freeze_cmd,
                                                 ignore_status=True,
                                                 debug=True)
        libvirt.check_exit_status(fz_cmd_result)
        # Wait for freeze filesystem
        time.sleep(1)

        # Get frozen dirty data
        fz_dirty_info = get_dirty(session, True)
        st_cmd_result = virsh.qemu_agent_command(vm_name, status_cmd,
                                                 ignore_status=True,
                                                 debug=True)
        libvirt.check_exit_status(st_cmd_result)
        if not st_cmd_result.stdout.count("frozen"):
            raise error.TestFail("Guest filesystem status is not frozen: %s"
                                 % st_cmd_result.stdout.strip())

        tw_cmd_result = virsh.qemu_agent_command(vm_name, thaw_cmd,
                                                 ignore_status=True,
                                                 debug=True)
        libvirt.check_exit_status(tw_cmd_result)

        # Get thawed dirty data
        tw_dirty_info = get_dirty(session)
        st_cmd_result = virsh.qemu_agent_command(vm_name, status_cmd,
                                                 ignore_status=True,
                                                 debug=True)
        libvirt.check_exit_status(st_cmd_result)
        if not st_cmd_result.stdout.count("thawed"):
            raise error.TestFail("Guest filesystem status is not thawed: %s"
                                 % st_cmd_result.stdout.strip())
        logging.info("Original dirty data: %s" % org_dirty_info)
        logging.info("Frozen dirty data: %s" % fz_dirty_info)
        logging.info("Thawed dirty data: %s" % tw_dirty_info)
        if not tw_dirty_info or not org_dirty_info:
            raise error.TestFail("The thawed dirty data should not be 0!")
        if fz_dirty_info:
            raise error.TestFail("The frozen dirty data should be 0!")
            raise error.TestFail("Guest filesystem status is not frozen: %s"
                                 % st_cmd_result.stdout.strip())

        tw_cmd_result = virsh.qemu_agent_command(vm_name, thaw_cmd,
                                                 ignore_status=True,
                                                 debug=True)
        libvirt.check_exit_status(tw_cmd_result)

        # Get thawed dirty data
        tw_dirty_info = get_dirty(session)
        st_cmd_result = virsh.qemu_agent_command(vm_name, status_cmd,
                                                 ignore_status=True,
                                                 debug=True)
        libvirt.check_exit_status(st_cmd_result)
        if not st_cmd_result.stdout.count("thawed"):
            raise error.TestFail("Guest filesystem status is not thawed: %s"
                                 % st_cmd_result.stdout.strip())
        logging.info("Original dirty data: %s" % org_dirty_info)
        logging.info("Frozen dirty data: %s" % fz_dirty_info)
        logging.info("Thawed dirty data: %s" % tw_dirty_info)
        if not tw_dirty_info or not org_dirty_info:
            raise error.TestFail("The thawed dirty data should not be 0!")
        if fz_dirty_info:
            raise error.TestFail("The frozen dirty data should be 0!")
    finally:
        # Thaw the file system that remove action can be done
        virsh.qemu_agent_command(vm_name, thaw_cmd, ignore_status=True)
        session.cmd("rm -f %s" % tmp_file)
        session.close()
        xml_backup.sync()
def run(test, params, env):
    """
    Test command: virsh qemu-agent-command.
    """
    vm_name = params.get("main_vm")
    vm = env.get_vm(vm_name)
    status_cmd = params.get("status_cmd", "")
    freeze_cmd = params.get("freeze_cmd", "")
    thaw_cmd = params.get("thaw_cmd", "")
    xml_backup = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name)
    try:
        def get_dirty(session, frozen=False):
            """
            Get dirty data of guest
            """
            try:
                data_cmd = "cat /proc/meminfo | grep Dirty"
                if not frozen:
                    result = utils_misc.wait_for(lambda:
                                                 int(session.
                                                     cmd_output(data_cmd).
                                                     strip().split()[1]) != 0,
                                                 60)
                    if result:
                        return int(session.cmd_output(data_cmd).strip().
                                   split()[1])
                    else:
                        return 0
                    dirty_info = session.cmd_output(data_cmd).strip()
                    return int(dirty_info.split()[1])
                else:
                    result = utils_misc.wait_for(lambda:
                                                 int(session.
                                                     cmd_output(data_cmd).
                                                     strip().split()[1]) == 0,
                                                 60)
                    if result:
                        return 0
                    else:
                        return int(session.cmd_output(data_cmd).strip().
                                   split()[1])
            except (IndexError, ValueError) as details:
                test.fail("Get dirty info failed: %s" % details)

        device_source_path = os.path.join(data_dir.get_tmp_dir(), "disk.img")
        device_source = libvirt.create_local_disk("file", path=device_source_path,
                                                  disk_format="qcow2")
        vm.prepare_guest_agent()

        # Do operation before freeze guest filesystem
        session = vm.wait_for_login()
        tmp_file = "/mnt/test.file"
        try:
            # Create extra image and attach to guest, then mount
            old_parts = libvirt.get_parts_list(session)
            ret = virsh.attach_disk(vm_name, device_source, "vdd")
            if ret.exit_status:
                test.fail("Attaching device failed before testing agent:%s" % ret.stdout.strip())
            time.sleep(1)
            new_parts = libvirt.get_parts_list(session)
            added_part = list(set(new_parts).difference(set(old_parts)))
            session.cmd("mkfs.ext3 -F /dev/{0} && mount /dev/{0} /mnt".format(added_part[0]))

            # Generate dirty memory
            session.cmd("rm -f %s" % tmp_file)
            session.cmd_output("cp /dev/zero %s 2>/dev/null &" % tmp_file)
            # Get original dirty data
            org_dirty_info = get_dirty(session)
            fz_cmd_result = virsh.qemu_agent_command(vm_name, freeze_cmd,
                                                     ignore_status=True,
                                                     debug=True)
            libvirt.check_exit_status(fz_cmd_result)

            # Get frozen dirty data
            fz_dirty_info = get_dirty(session, True)
            st_cmd_result = virsh.qemu_agent_command(vm_name, status_cmd,
                                                     ignore_status=True,
                                                     debug=True)
            libvirt.check_exit_status(st_cmd_result)
            if not st_cmd_result.stdout.strip().count("frozen"):
                test.fail("Guest filesystem status is not frozen: %s"
                          % st_cmd_result.stdout.strip())

            tw_cmd_result = virsh.qemu_agent_command(vm_name, thaw_cmd,
                                                     ignore_status=True,
                                                     debug=True)
            libvirt.check_exit_status(tw_cmd_result)

            # Get thawed dirty data
            tw_dirty_info = get_dirty(session)
            st_cmd_result = virsh.qemu_agent_command(vm_name, status_cmd,
                                                     ignore_status=True,
                                                     debug=True)
            libvirt.check_exit_status(st_cmd_result)
            if not st_cmd_result.stdout.strip().count("thawed"):
                test.fail("Guest filesystem status is not thawed: %s"
                          % st_cmd_result.stdout.strip())
            logging.info("Original dirty data: %s" % org_dirty_info)
            logging.info("Frozen dirty data: %s" % fz_dirty_info)
            logging.info("Thawed dirty data: %s" % tw_dirty_info)
            if not tw_dirty_info or not org_dirty_info:
                test.fail("The thawed dirty data should not be 0!")
            if fz_dirty_info:
                test.fail("The frozen dirty data should be 0!")
        finally:
            # Thaw the file system that remove action can be done
            virsh.qemu_agent_command(vm_name, thaw_cmd, ignore_status=True)
            session.cmd("rm -f %s" % tmp_file)
            session.close()
    finally:
        xml_backup.sync()
        os.remove(device_source_path)
예제 #8
0
    if vm_state != "shut off":
        domid = vm.get_id()

    if vm_ref == "domname":
        vm_ref = vm_name
    elif vm_ref == "domid":
        vm_ref = domid
    elif vm_ref == "domuuid":
        vm_ref = domuuid
    elif domid and vm_ref == "hex_id":
        vm_ref = hex(int(domid))

    try:
        # Run virsh command
        cmd_result = virsh.qemu_agent_command(vm_ref, cmd, options,
                                              ignore_status=True,
                                              debug=True)
        status = cmd_result.exit_status

        # Check result
        if not libvirtd_inst.is_running():
            raise error.TestFail("Libvirtd is not running after run command.")
        if status_error:
            if not status:
                # Bug 853673
                err_msg = "Expect fail but run successfully, please check Bug: "
                err_msg += "https://bugzilla.redhat.com/show_bug.cgi?id=853673"
                err_msg += " for more info"
                raise error.TestFail(err_msg)
            else:
                logging.debug("Command failed as expected.")
예제 #9
0
        tw_cmd_result = virsh.qemu_agent_command(vm_name,
                                                 thaw_cmd,
                                                 ignore_status=True,
                                                 debug=True)
        libvirt.check_exit_status(tw_cmd_result)

        # Get thawed dirty data
        tw_dirty_info = get_dirty(session)
        st_cmd_result = virsh.qemu_agent_command(vm_name,
                                                 status_cmd,
                                                 ignore_status=True,
                                                 debug=True)
        libvirt.check_exit_status(st_cmd_result)
        if not st_cmd_result.stdout.count("thawed"):
            raise error.TestFail("Guest filesystem status is not thawed: %s" %
                                 st_cmd_result.stdout.strip())
        logging.info("Original dirty data: %s" % org_dirty_info)
        logging.info("Frozen dirty data: %s" % fz_dirty_info)
        logging.info("Thawed dirty data: %s" % tw_dirty_info)
        if not tw_dirty_info or not org_dirty_info:
            raise error.TestFail("The thawed dirty data should not be 0!")
        if fz_dirty_info:
            raise error.TestFail("The frozen dirty data should be 0!")
    finally:
        # Thaw the file system that remove action can be done
        virsh.qemu_agent_command(vm_name, thaw_cmd, ignore_status=True)
        session.cmd("rm -f %s" % tmp_file)
        session.close()
        xml_backup.sync()