# How the vt_settings Plugin Manages VT-Specific Configuration Options in Avocado-VT

> Discover how the vt_settings plugin manages VT specific configuration options in Avocado. Learn to integrate virtualization testing defaults and override them easily.

- Repository: [avocado/avocado-vt](https://github.com/avocado-framework/avocado-vt)
- Tags: how-to-guide
- Published: 2026-02-25

---

**The vt_settings plugin injects VT-specific configuration files into Avocado's settings search path by prepending them to the configuration hierarchy, enabling seamless integration of virtualization testing defaults that users can override via standard Avocado configuration files.**

The vt_settings plugin in the `avocado-framework/avocado-vt` repository provides a robust mechanism for managing virtualization testing (VT) configuration options. By implementing Avocado's Settings plugin interface, it ensures that VT-specific defaults from `conf.d/*.conf` files are loaded early in the configuration hierarchy, making them available to all Avocado-VT components while remaining fully overridable by end users.

## Architecture of the vt_settings Plugin

### The VTSettings Class and adjust_settings_paths()

The core implementation resides in [`avocado_vt/plugins/vt_settings.py`](https://github.com/avocado-framework/avocado-vt/blob/main/avocado_vt/plugins/vt_settings.py), where the `VTSettings` class implements the **Settings** plugin interface from `avocado.core.plugin_interfaces`. The critical method is `adjust_settings_paths()`, which receives the mutable `paths` list during Avocado startup and modifies it to include VT-specific configuration files.

### Plugin Registration via Entry Points

The plugin is registered in [`setup.py`](https://github.com/avocado-framework/avocado-vt/blob/main/setup.py) under the `avocado.plugins.settings` entry point group. This registration uses the identifier `vt-settings` mapped to `avocado_vt.plugins.vt_settings:VTSettings`, ensuring automatic discovery during Avocado's plugin initialization phase.

## How VT Configuration Files Are Injected

During Avocado startup, the vt_settings plugin executes a specific sequence to insert VT defaults at the highest priority level. The `adjust_settings_paths()` method uses `importlib.resources` to locate the package-installed configuration directory:

```python
def adjust_settings_paths(self, paths):
    base = importlib.resources.files("avocado_vt").joinpath("conf.d")
    for path in base.iterdir():
        if path.is_file() and path.name.endswith(".conf"):
            paths.insert(0, str(path))  # Prepend to highest priority

```

This code iterates through `avocado_vt/conf.d/`, identifying files like [`vt.conf`](https://github.com/avocado-framework/avocado-vt/blob/main/vt.conf) and [`vt_joblock.conf`](https://github.com/avocado-framework/avocado-vt/blob/main/vt_joblock.conf). By inserting each file at index 0 of the `paths` list, the plugin ensures these VT-specific defaults are processed before any user-supplied configuration files. This ordering follows Avocado's configuration hierarchy where earlier entries take precedence during the merge process.

## Practical Usage and Override Behavior

Once injected, VT configuration options behave like standard Avocado settings. You can view the merged configuration using the command line:

```bash

# Display the complete configuration including VT defaults

avocado config

# Filter for specific VT-related settings

avocado config | grep vt

```

Users override VT defaults by creating or editing `~/.config/avocado/avocado.conf`. For example, to change the maximum parallel tasks from the VT default:

```bash
echo "[run]
max_parallel_tasks = 4" >> ~/.config/avocado/avocado.conf

```

When Avocado reloads, the user-defined value takes precedence over the VT default because the user configuration file appears later in the merged paths list.

Within test code, access these settings through Avocado's settings API:

```python
from avocado.core import settings

# Retrieve current VT-related configuration

config = settings.as_dict()
max_tasks = config.get('run.max_parallel_tasks')
print(f"Configured max parallel tasks: {max_tasks}")

```

Because the plugin pre-loads [`vt.conf`](https://github.com/avocado-framework/avocado-vt/blob/main/vt.conf), the above call will return the default value unless the user has overridden it in their personal configuration.

## Summary

- The **vt_settings plugin** implements Avocado's Settings interface to inject VT-specific configuration files into the startup sequence.
- Located in [`avocado_vt/plugins/vt_settings.py`](https://github.com/avocado-framework/avocado-vt/blob/main/avocado_vt/plugins/vt_settings.py), the **VTSettings** class prepends `.conf` files from `avocado_vt/conf.d/` to the configuration paths list.
- This prepending strategy ensures VT defaults load with highest priority while remaining fully overridable by user configuration files.
- Configuration files like [`vt.conf`](https://github.com/avocado-framework/avocado-vt/blob/main/vt.conf) and [`vt_joblock.conf`](https://github.com/avocado-framework/avocado-vt/blob/main/vt_joblock.conf) provide defaults for sections such as `[vt]`, `[vt.qemu]`, and `[plugins.vtjoblock]`.
- Users interact with these settings through standard Avocado commands and APIs, with overrides stored in `~/.config/avocado/avocado.conf`.

## Frequently Asked Questions

### What is the vt_settings plugin in Avocado-VT?

The **vt_settings plugin** is an Avocado settings extension that automatically injects virtualization testing (VT) configuration defaults into Avocado's configuration hierarchy. It ensures that VT-specific options from files like [`vt.conf`](https://github.com/avocado-framework/avocado-vt/blob/main/vt.conf) are available to all Avocado-VT components without requiring manual configuration file management by users.

### How does the vt_settings plugin prioritize configuration files?

The plugin prioritizes VT defaults by **prepending** them to the configuration paths list during Avocado startup. In the `adjust_settings_paths()` method, each `.conf` file from `avocado_vt/conf.d/` is inserted at index 0 of the paths list, ensuring these files are processed first. Since Avocado merges configurations in path order, with earlier files taking precedence, this gives VT defaults the highest priority while still allowing user overrides from later files.

### Can users override VT-specific configuration options?

Yes, users can override any VT-specific option by creating or editing their user configuration file at `~/.config/avocado/avocado.conf`. Because the vt_settings plugin inserts VT defaults at the beginning of the configuration paths list, user configuration files loaded later in the sequence will override any conflicting values. Users can verify current settings using the `avocado config` command.

### Where are the VT configuration files located in the source repository?

The VT configuration files are located in the `avocado_vt/conf.d/` directory within the avocado-vt repository. Key files include [`vt.conf`](https://github.com/avocado-framework/avocado-vt/blob/main/vt.conf), which contains defaults for general VT settings and QEMU-specific options, and [`vt_joblock.conf`](https://github.com/avocado-framework/avocado-vt/blob/main/vt_joblock.conf), which configures the VT job lock plugin. These files are packaged with the avocado-vt installation and located at runtime using `importlib.resources`.