CLI Tools & Debugging Utilities
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
CLI Tools & Debugging Utilities in ManageIQ encompass a suite of Ruby-based scripts designed to facilitate environment management, performance analysis, and request debugging. These tools provide developers and administrators with the ability to interact with the system's core components—such as the database, virtualization managers (VIM), and provisioning workflows—directly from the command line.
The scope of these utilities includes environment setup, database inspection, performance timing analysis from logs, and reconstruction of complex provision requests for testing purposes. These tools are primarily located in the tools/ and lib/manageiq/ directories.
Environment Management Utilities
The system utilizes central environment management logic to handle dependencies, database migrations, and asset compilation. This ensures consistency across different development and CI environments.
ManageIQ::Environment
The ManageIQ::Environment module provides methods to automate the installation of gems via Bundler, configuration of database files, and the setup of test environments. It specifically manages configuration templates such as config/database.pg.yml and config/cable.yml.sample.
The flow ensures that any plugin or core update results in a functional development environment.
Sources: lib/manageiq/environment.rb:10-50
| Method | Description |
|---|---|
manageiq_plugin_setup | High-level setup for plugins, assumes call from bin/ script. |
ensure_config_files | Copies .sample or .pg YAML files to active config/ paths. |
bundle_update | Updates gems; skips if bundle check passes and force is false. |
run_rake_task | Executes Rails tasks using bin/rails. |
| Sources: lib/manageiq/environment.rb:10-120 |
Provisioning Debugging
Utilities exist to reconstruct and re-run complex provisioning requests that may have failed or require verification.
Rebuild Provision Request
The rebuild_provision_request.rb utility allows an architect to take an existing MiqProvisionRequest ID and generate the necessary parameters to re-submit the request via the API. It interprets the dialog content and provision options stored in the database to build a valid API payload.
This tool is critical for replicating issues found in production by generating a reproducible API call.
Sources: tools/rebuild_provision_request.rb:48-120
Performance & Diagnostic Tools
These utilities are used to gather and analyze data related to system performance and infrastructure provider health.
VIM Performance Collection
The vim_collect_perf_history.rb script interacts with VMware Web Services (MiqVim) to collect performance metrics for specific Managed Object References (MORs) like Virtual Machines, Host Systems, or Clusters.
- Capabilities: Collects intervals, counter IDs, and provider summaries.
- Storage: Outputs collected data into YAML files within a
miq_vim_perf_historydirectory for offline analysis.
Sources: tools/vim_collect_perf_history.rb:30-100
Diagnostic Utilities
The system includes specialized scripts for database and log inspection:
- PG Inspector: (
tools/pg_inspector.rb) Used for inspecting PostgreSQL specific details. - Perf Timings: (
tools/log_processing/perf_timings.rb) Processes logs to extract and summarize performance timing data. - Relationship Printer: (
tools/db_printers/print_relationships.rb) Visualizes object relationships directly from the database schema.
Summary
The CLI Tools and Debugging Utilities serve as the primary interface for low-level system maintenance and troubleshooting. By providing automated environment setup through ManageIQ::Environment and specialized debugging scripts like rebuild_provision_request.rb, the project maintains a robust framework for development and operational support. These tools bridge the gap between high-level UI operations and the underlying Ruby/Rails infrastructure.