Skip to content

v0.2.5 - Logging and VM Summary#3

Merged
noclue merged 10 commits intomainfrom
topic/v0.2.5
Apr 12, 2026
Merged

v0.2.5 - Logging and VM Summary#3
noclue merged 10 commits intomainfrom
topic/v0.2.5

Conversation

@noclue
Copy link
Copy Markdown
Owner

@noclue noclue commented Apr 12, 2026

Added

  • VM Summary (s on the Virtual Machine inventory table): opens a centered popup with a consolidated view of the selected VM—name and MO id, primary IP(s), overall status, power state and uptime, guest OS, vCPU count and CPU usage (MHz), a one-line VMware Tools summary, host memory in use versus configured size, resolved host name, provisioned disk usage, plus scrollable Networking and Disks tables. Networking lists each NIC (label, network name when it can be resolved from the backing, MAC, guest IPs); disks list virtual disks with path/backing and datastore names when available. The vSphere work runs asynchronously so typing, search, and redraws stay responsive; you briefly see “Loading VM summary…” until data arrives. Esc or q closes the popup; while it is open, /, j/k, Page Up/Page Down, Home/End, g/G, and Ctrl+B/Ctrl+F scroll the content.
  • VM Summary networking labels include standard port groups, distributed port groups (with a clear placeholder when the port group name is not yet resolved), NSX-style opaque networks (type and opaque network id), and SR-IOV (physical or virtual function device name, or a PCI-style id when the name is empty). If the backing cannot be interpreted, the network cell may show - as before.

Changed

  • Demand-driven PropertyCollector and performance polling: terminal input and PropertyCollector WaitForUpdatesEx long-polls no longer share one tokio::select!, so keystrokes no longer cancel and restart in-flight waits (which previously amplified server load during UI activity). A watch channel gates when long-polls run: on for the resource inventory table and the managed-object property browser, off for the static/event JSON property browser and during shutdown. Long-polls use a 60-second server-side wait window instead of a short timeout loop. Performance (QueryPerf) requests are explicitly cleared when perf should stop (property browsers, VM summary popup open, or other pauses) so the background worker does not keep polling with a stale visible-row set. refresh_polling_demand() centralizes these rules; polling_policy unit tests document PropertyCollector vs perf demand.
  • Suppress redundant ad-hoc perf refreshes: changing the selected row within the same visible VM/Host window no longer re-arms the background PerformanceManager worker. vTUI now only sends an immediate perf refresh when the effective observed entity set, pause/running state, or perf generation actually changes.
  • Logging (breaking operational change): vTUI no longer writes logs/vtui.log under the current working directory. Application and wire diagnostics use flexi_logger with append, rotation, retention, and optional compression under the platform state directory: on Unix-like systems $XDG_STATE_HOME/vtui/logs/ (or ~/.local/state/vtui/logs/ when XDG_STATE_HOME is unset or not absolute), and on Windows %LOCALAPPDATA%\vtui\logs\. Filenames follow flexi_logger conventions (e.g. current vtui-app / vtui-wire logs plus rotated siblings). Timestamps are UTC with millisecond precision and a Z suffix. Configure verbosity and rotation in a global [logging] section of config.toml; LOG_LEVEL remains supported and applies application logging only. Wire capture is configured with [logging.wire] mode (off, summary, detailed) and is passed to vim_rs::WireLoggingMode on ClientBuilder::wire_logging; targets vim_rs::wire::json and vim_rs::wire::soap are routed to vtui-wire.log without flooding vtui-app.log. Per-target overrides use [[logging.filters]]. Legacy [environments.*].log_level is still read for one release when no global [logging].level and no LOG_LEVEL apply, with a deprecation warning. RUST_LOG is intentionally ignored for vTUI’s own logger setup (a note is printed if set). If file logging cannot be initialized, vTUI warns and falls back to stderr-only logging instead of aborting.
  • Background VM action prefetch and execution off the UI loop: introduce an async operations facility under src/ops so vSphere work for the VM power-action flow no longer blocks the main event loop (terminal input, property updates, redraws).

Fixed

  • Preserve Unicode in pretty-printed JSON dumps (previously corrupted non-ASCII content).

noclue added 10 commits April 10, 2026 10:40
Fixed a regression that caused corruption of unicode data when saving JSON.
Introduce an async operations facility under src/ops so vSphere work for the
VM power-action flow no longer blocks the main event loop (terminal input,
property updates, redraws).

Architecture:
- operation_types.rs holds OperationId for shared request/result correlation.
- Ops supervisor owns a bounded mpsc queue (256), a concurrency limit (8) via
  Semaphore, and spawns per-request tokio tasks that call existing
  vm_power_actions helpers and post results on the existing Event::App channel.
- OpsHandle wraps the mpsc sender; shutdown drops the sender so the supervisor
  recv loop ends; quit also aborts the ops worker join handle alongside the
  perf worker and EventHandler shutdown.

App integration:
- AppEvent gains VmActionPrefetchSucceeded/Failed and OperationSucceeded/Failed
  with explicit payloads (no anyhow::Result in AppEvent).
- OpenVmActions queues PrefetchVmActions instead of awaiting prefetch in the
  UI handler; execute path queues ExecuteInventoryOperation instead of awaiting
  execute_vm_power_action in handle_terminal_event.
- App tracks next_operation_id, vm_action_pending_execute for execute results,
  and ignores stale prefetch completions if the user dismissed loading.

VmActionUi:
- LoadingPrefetch state with a loading modal; Esc closes and discards late
  prefetch results.
…Retriever for VM actions

- Replace simplelog with flexi_logger: state-dir logs, app vs wire files, rotation/retention,
  UTC timestamps, [logging] config + LOG_LEVEL / legacy migration, wire_logging on client
- Bump vim_rs to 0.4.3; use ObjectRetriever again in vm_power_actions now that it takes dyn VimClient
… labels

Add a VM Summary experience so operators can inspect a selected VM without
leaving the resource browser: a scrollable popup shows CPU, memory, VMware
Tools status, storage, and per-NIC networking derived from guest info and
hardware config.

For administrators, the goal is a single place to answer “what is this VM
running, how is it connected, and are Tools OK?” Network names prefer
sensible labels from the backing type: standard port groups, distributed
port groups (with unresolved DVPG placeholders when the name is not yet
available), NSX opaque networks (type and ID), and SR-IOV (device name or
PCI-style id). That reduces “-” or opaque MO references in the network column.

For developers, the implementation is split into fetch (PropertyCollector-
driven retrieval and normalization), merge logic joining guest NIC keys to
virtual Ethernet devices, formatting for display units and states, and a
dedicated UI layer with keyboard navigation. The feature is wired through
the existing event/ops and resource manager flow so it behaves like other
browser actions.

Tests cover merge edge cases and formatters; CI parity (fmt, clippy -D
warnings, test) is expected for this change set.
Split terminal input from PropertyCollector long-polls so keystrokes no
longer cancel in-flight WaitForUpdatesEx calls. Gate PC waits with a
watch channel: on for resource browser and managed property browser, off
for static/event property views and on quit. Use 60s server-side wait
windows instead of a tight select/timeout loop.

Centralize intent in refresh_polling_demand(): set PC demand and push
PerfRequest; use PerfRequest::paused() with empty entities when perf
should stop (property panes, VM summary modal, etc.) so QueryPerf does not
run on stale visible-row sets.

Add polling_policy helpers and unit tests; debug logs on target pc_wait.

CHANGELOG: document behavior under [Unreleased].

CHANGELOG & README updated for VM summary
Avoid rearming the background PerformanceManager worker when the selected row changes but the visible VM/Host set is unchanged. Track the last perf demand signature so ad-hoc refreshes only fire when the observed entities, pause/running state, or perf generation actually changes.
Bump version to 0.2.5, refresh UI snapshots and README install URLs,
and document 0.2.5 in CHANGELOG (VM Summary, polling/logging changes,
async VM ops, JSON unicode fix).
- Introduced constants for label, value, border, and background colors to enhance UI consistency.
- Replaced hardcoded color values with the new constants in the VM summary UI rendering logic.
- Adjusted styles for various UI elements to use the updated color scheme, improving overall visual clarity.
@noclue noclue merged commit ea15363 into main Apr 12, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant