Beispiel #1
0
def run_normal_checks(
    tracker: ProblemTracker,
    instance: EdenInstance,
    out: ui.Output,
    mount_table: mtab.MountTable,
    fs_util: filesystem.FsUtil,
) -> None:
    checkouts: Dict[Path, CheckoutInfo] = {}
    # Get information about the checkouts currently known to the running edenfs process
    with instance.get_thrift_client() as client:
        for mount in client.listMounts():
            # Old versions of edenfs did not return a mount state field.
            # These versions only listed running mounts, so treat the mount state
            # as running in this case.
            mount_state = mount.state if mount.state is not None else MountState.RUNNING
            path = Path(os.fsdecode(mount.mountPoint))
            checkout = CheckoutInfo(
                instance,
                path,
                running_state_dir=Path(os.fsdecode(mount.edenClientPath)),
                state=mount_state,
            )
            checkouts[path] = checkout

    # Get information about the checkouts listed in the config file
    for configured_checkout in instance.get_checkouts():
        checkout_info = checkouts.get(configured_checkout.path, None)
        if checkout_info is None:
            checkout_info = CheckoutInfo(instance, configured_checkout.path)
            checkout_info.configured_state_dir = configured_checkout.state_dir
            checkouts[checkout_info.path] = checkout_info

        checkout_info.configured_state_dir = configured_checkout.state_dir

    check_filesystems.check_eden_directory(tracker, instance)
    check_stale_mounts.check_for_stale_mounts(tracker, mount_table)
    check_edenfs_version(tracker, instance)
    check_filesystems.check_disk_usage(
        tracker, list(instance.get_mount_paths()), instance
    )

    watchman_info = check_watchman.pre_check()

    for path, checkout in sorted(checkouts.items()):
        out.writeln(f"Checking {path}")
        try:
            check_mount(tracker, checkout, mount_table, fs_util, watchman_info)
        except Exception as ex:
            tracker.add_problem(
                Problem(f"unexpected error while checking {path}: {ex}")
            )
Beispiel #2
0
def run_normal_checks(
    tracker: ProblemTracker,
    instance: EdenInstance,
    out: ui.Output,
    mount_table: mtab.MountTable,
    fs_util: filesystem.FsUtil,
) -> None:
    checkouts: Dict[Path, CheckoutInfo] = {}
    # Get information about the checkouts currently known to the running edenfs process
    with instance.get_thrift_client() as client:
        for mount in client.listMounts():
            # Old versions of edenfs did not return a mount state field.
            # These versions only listed running mounts, so treat the mount state
            # as running in this case.
            mount_state = mount.state if mount.state is not None else MountState.RUNNING
            path = Path(os.fsdecode(mount.mountPoint))
            checkout = CheckoutInfo(
                instance,
                path,
                running_state_dir=Path(os.fsdecode(mount.edenClientPath)),
                state=mount_state,
            )
            checkouts[path] = checkout

    # Get information about the checkouts listed in the config file
    for configured_checkout in instance.get_checkouts():
        checkout_info = checkouts.get(configured_checkout.path, None)
        if checkout_info is None:
            checkout_info = CheckoutInfo(instance, configured_checkout.path)
            checkout_info.configured_state_dir = configured_checkout.state_dir
            checkouts[checkout_info.path] = checkout_info

        checkout_info.configured_state_dir = configured_checkout.state_dir

    check_filesystems.check_eden_directory(tracker, instance)
    check_stale_mounts.check_for_stale_mounts(tracker, mount_table)
    check_edenfs_version(tracker, instance)
    check_filesystems.check_disk_usage(tracker,
                                       list(instance.get_mount_paths()),
                                       instance,
                                       fs_util=fs_util)

    watchman_info = check_watchman.pre_check()

    for path, checkout in sorted(checkouts.items()):
        out.writeln(f"Checking {path}")
        try:
            check_mount(tracker, checkout, mount_table, fs_util, watchman_info)
        except Exception as ex:
            tracker.add_problem(
                Problem(f"unexpected error while checking {path}: {ex}"))
Beispiel #3
0
def run_edenfs_not_healthy_checks(
    tracker: ProblemTracker,
    instance: EdenInstance,
    out: ui.Output,
    status: config_mod.HealthStatus,
    mount_table: mtab.MountTable,
    fs_util: filesystem.FsUtil,
) -> None:
    check_stale_mounts.check_for_stale_mounts(tracker, mount_table)

    configured_mounts = instance.get_mount_paths()
    check_filesystems.check_disk_usage(tracker, list(configured_mounts), instance)
    if configured_mounts:
        tracker.add_problem(EdenfsNotHealthy())
Beispiel #4
0
def run_edenfs_not_healthy_checks(
    tracker: ProblemTracker,
    instance: EdenInstance,
    out: ui.Output,
    status: config_mod.HealthStatus,
    mount_table: mtab.MountTable,
    fs_util: filesystem.FsUtil,
) -> None:
    check_stale_mounts.check_for_stale_mounts(tracker, mount_table)

    configured_mounts = instance.get_mount_paths()
    check_filesystems.check_disk_usage(tracker, list(configured_mounts),
                                       instance)
    if configured_mounts:
        tracker.add_problem(EdenfsNotHealthy())