|
| 1 | +# Foreman Virt Who Configure Plugin |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +The Foreman Virt Who Configure plugin is a Ruby on Rails plugin that simplifies the configuration and management of virt-who instances in Red Hat Foreman environments. Virt-who is a daemon that retrieves virtual machine information from hypervisors and reports it to Red Hat Satellite/Foreman for subscription management and host tracking. |
| 6 | + |
| 7 | +## Purpose |
| 8 | + |
| 9 | +This plugin provides a user-friendly web interface and API for: |
| 10 | +- Creating and managing virt-who configurations |
| 11 | +- Generating deployment scripts for virt-who instances |
| 12 | +- Monitoring virt-who reports and status |
| 13 | +- Supporting multiple hypervisor types (VMware vSphere, Microsoft Hyper-V, libvirt, KubeVirt, Nutanix AHV) |
| 14 | + |
| 15 | +## Architecture |
| 16 | + |
| 17 | +### Core Components |
| 18 | + |
| 19 | +#### Models |
| 20 | +- **`Config`** (`app/models/foreman_virt_who_configure/config.rb`) |
| 21 | + - Central model representing a virt-who configuration |
| 22 | + - Stores hypervisor connection details, filtering rules, and scheduling information |
| 23 | + - Supports multiple hypervisor types: esx, hyperv, libvirt, kubevirt, ahv |
| 24 | + - Handles configuration validation and deployment script generation |
| 25 | + - Tracks reporting status and last update times |
| 26 | + |
| 27 | +- **`ServiceUser`** (`app/models/foreman_virt_who_configure/service_user.rb`) |
| 28 | + - Manages service account credentials for virt-who authentication |
| 29 | + |
| 30 | +#### Controllers |
| 31 | +- **`ConfigsController`** (`app/controllers/foreman_virt_who_configure/configs_controller.rb`) |
| 32 | + - Web UI controller for CRUD operations on virt-who configurations |
| 33 | + - Handles configuration creation wizard and deployment script downloads |
| 34 | + |
| 35 | +- **`Api::V2::ConfigsController`** (`app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb`) |
| 36 | + - RESTful API controller for programmatic access |
| 37 | + - Supports JSON responses and shell script deployment downloads |
| 38 | + - Organization-scoped resource access |
| 39 | + |
| 40 | +#### Services |
| 41 | +- **`Cleaner`** (`app/services/foreman_virt_who_configure/cleaner.rb`) |
| 42 | + - Background service for cleaning up outdated configurations |
| 43 | + |
| 44 | +- **`OutputGenerator`** (`app/models/foreman_virt_who_configure/output_generator.rb`) |
| 45 | + - Generates virt-who configuration files and deployment scripts |
| 46 | + |
| 47 | +### Key Features |
| 48 | + |
| 49 | +#### Hypervisor Support |
| 50 | +- **VMware vSphere/vCenter (esx)**: VMware virtualization platform support |
| 51 | +- **Microsoft Hyper-V (hyperv)**: Windows Server virtualization |
| 52 | +- **libvirt**: Open-source virtualization API |
| 53 | +- **KubeVirt (kubevirt)**: Container-native virtualization |
| 54 | +- **Nutanix AHV (ahv)**: Nutanix hyperconverged infrastructure |
| 55 | + |
| 56 | +#### Configuration Options |
| 57 | +- **Scheduling**: Configurable reporting intervals (hourly, every 2/4/6/8/12/24 hours) |
| 58 | +- **Filtering**: Whitelist/blacklist host filtering with regex support |
| 59 | +- **Proxy Support**: HTTP proxy configuration for network connectivity |
| 60 | +- **Debug Mode**: Enhanced logging for troubleshooting |
| 61 | +- **Organization Scoping**: Multi-tenant organization support |
| 62 | + |
| 63 | +#### Deployment |
| 64 | +- Generates shell scripts for automated virt-who installation and configuration |
| 65 | +- Supports both manual deployment and configuration management integration |
| 66 | +- Provides Hammer CLI command examples for automation |
| 67 | + |
| 68 | +### Database Schema |
| 69 | + |
| 70 | +Key database tables managed by migrations in `db/migrate/`: |
| 71 | +- `configs`: Main configuration storage |
| 72 | +- `service_users`: Authentication credentials |
| 73 | +- Various attribute additions over time (proxy settings, filtering, etc.) |
| 74 | + |
| 75 | +### API Endpoints |
| 76 | + |
| 77 | +**Base URL**: `/foreman_virt_who_configure/api/v2` |
| 78 | + |
| 79 | +- `GET /configs` - List all configurations |
| 80 | +- `GET /configs/:id` - Show specific configuration |
| 81 | +- `POST /configs` - Create new configuration |
| 82 | +- `PUT /configs/:id` - Update configuration |
| 83 | +- `DELETE /configs/:id` - Delete configuration |
| 84 | +- `GET /configs/:id/deploy_script` - Download deployment script |
| 85 | + |
| 86 | +Organization-scoped variants available under `/organizations/:organization_id/configs` |
| 87 | + |
| 88 | +### Internationalization |
| 89 | + |
| 90 | +Comprehensive i18n support with translations in 30+ languages including: |
| 91 | +- English, Spanish, French, German, Italian, Portuguese |
| 92 | +- Chinese (Simplified/Traditional), Japanese, Korean |
| 93 | +- Hindi, Bengali, Tamil, Telugu, Gujarati |
| 94 | +- Russian, Polish, Czech, Swedish |
| 95 | +- Arabic, Hebrew |
| 96 | + |
| 97 | +Translation files located in `locale/` directory with `.po` files and compiled `.mo` files. |
| 98 | + |
| 99 | +### Configuration Parameters |
| 100 | + |
| 101 | +#### Required Parameters |
| 102 | +- `name`: Configuration identifier |
| 103 | +- `hypervisor_type`: Hypervisor platform (esx, hyperv, libvirt, kubevirt, ahv) |
| 104 | +- `hypervisor_id`: Host identification method (hostname, uuid, hwuuid) |
| 105 | +- `satellite_url`: Foreman server FQDN |
| 106 | +- `organization_id`: Target organization |
| 107 | + |
| 108 | +#### Optional Parameters |
| 109 | +- `interval`: Reporting frequency in minutes (default: 240) |
| 110 | +- `hypervisor_server`: Hypervisor hostname/IP |
| 111 | +- `hypervisor_username`/`hypervisor_password`: Authentication credentials |
| 112 | +- `whitelist`/`blacklist`: Host filtering rules |
| 113 | +- `filter_host_parents`/`exclude_host_parents`: Parent host filtering |
| 114 | +- `http_proxy_id`: HTTP proxy configuration |
| 115 | +- `debug`: Enable debug logging |
| 116 | +- `kubeconfig_path`: Kubernetes config file path (for kubevirt) |
| 117 | + |
| 118 | +### Installation & Setup |
| 119 | + |
| 120 | +#### Development Environment |
| 121 | +```bash |
| 122 | +dnf install rubygem-foreman_virt_who_configure |
| 123 | +foreman-rake db:migrate |
| 124 | +foreman-rake db:seed |
| 125 | +``` |
| 126 | + |
| 127 | +#### Production Environment |
| 128 | +```bash |
| 129 | +foreman-installer --enable-foreman-plugin-virt-who-configure |
| 130 | +foreman-installer --enable-foreman-cli-virt-who-configure |
| 131 | +``` |
| 132 | + |
| 133 | +### Dependencies |
| 134 | + |
| 135 | +- **Foreman**: >= 3.13 |
| 136 | +- **Katello**: Required for subscription management features |
| 137 | +- **Ruby on Rails**: Framework dependency |
| 138 | +- **Database**: PostgreSQL/MySQL support via ActiveRecord |
| 139 | + |
| 140 | +### Testing |
| 141 | + |
| 142 | +Test suite located in `test/` directory with: |
| 143 | +- Unit tests for models and services |
| 144 | +- Functional tests for controllers and API endpoints |
| 145 | +- Factory definitions for test data generation |
| 146 | + |
| 147 | +### Plugin Integration |
| 148 | + |
| 149 | +Registered as a Foreman plugin with: |
| 150 | +- Menu integration in Infrastructure section |
| 151 | +- Permission system integration |
| 152 | +- API documentation via Apipie |
| 153 | +- Audit logging for configuration changes |
| 154 | + |
| 155 | +### Security |
| 156 | + |
| 157 | +- Role-based access control with granular permissions |
| 158 | +- Organization-scoped data access |
| 159 | +- Audit trail for configuration changes |
| 160 | +- Encrypted credential storage |
| 161 | +- CSRF protection on web forms |
| 162 | + |
| 163 | +### Performance Considerations |
| 164 | + |
| 165 | +- Background job processing for cleanup tasks |
| 166 | +- Efficient database queries with proper indexing |
| 167 | +- Minimal API payload sizes |
| 168 | +- Cached configuration generation |
| 169 | + |
| 170 | +This plugin is essential for organizations using Red Hat Satellite/Foreman with virtualized infrastructure, providing streamlined virt-who deployment and management capabilities across diverse hypervisor environments. |
0 commit comments