Skip to content

Failed to get Nova metadata error on shutoff VMs due to DOMAIN_AFFECT_LIVE #36

@okozachenko1203

Description

@okozachenko1203

What

When the exporter tries to collect Nova metadata for instances, it always calls:

metadata, err := dom.GetMetadata(
    libvirt.DOMAIN_METADATA_ELEMENT,
    "http://openstack.org/xmlns/libvirt/nova/1.0",
    libvirt.DOMAIN_AFFECT_LIVE,
)

If the domain is not running, this fails with:

virError(Code=55, Domain=20, Message='Requested operation is not valid: domain is not running')

This causes noisy error logs like:

time=2025-09-25T08:42:35.323Z level=ERROR source=/go/src/app/collectors/domain_stats.go:458 msg="Failed to get Nova metadata" err="virError(Code=55, Domain=20, Message='Requested operation is not valid: domain is not running')"

Steps to Reproduce

  1. Run libvirtd_exporter on a host with at least one shut off instance.
  2. Observe the logs during metrics collection.

Expected behavior:
Exporter should gracefully handle inactive domains. Metadata should still be retrieved from the persistent config if the VM is not running, instead of logging errors.

Proposed fix

Fallback to DOMAIN_AFFECT_CONFIG if DOMAIN_AFFECT_LIVE fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions