Skip to content

extend libvirt pool XML to add format and <protocol ver> #11757

@jeanvetorello

Description

@jeanvetorello

The required feature described as a wish

Currently, when the KVM agent creates a netfs storage pool via libvirt, the generated XML does not specify .

Example from logs:
2025-09-29 15:35:26,147 DEBUG [kvm.storage.LibvirtStorageAdaptor] (AgentRequest-Handler-2:[]) (logid:7984caf2) Attempting to create storage pool 507ad79a-d3f3-3b6d-949c-c59d94a533f5
2025-09-29 15:35:26,147 DEBUG [kvm.storage.LibvirtStorageAdaptor] (AgentRequest-Handler-2:[]) (logid:7984caf2)

<name>507ad79a-d3f3-3b6d-949c-c59d94a533f5</name>
<uuid>507ad79a-d3f3-3b6d-949c-c59d94a533f5</uuid>
<source>
<host name='192.168.27.14'/>
<dir path='/srv/nfs/cloudstack'/>
</source>
<target>
<path>/mnt/507ad79a-d3f3-3b6d-949c-c59d94a533f5</path>
</target>
<fs:mount_opts>
</fs:mount_opts>
</pool>

Because neither nor are defined, libvirt defaults to:

(implicitly)

(implicitly → NFSv3)

This breaks environments where the server only supports NFSv4.x (for example, CephFS with NFS Ganesha), and it also makes the pool definition diverge from the recommended XML schema in libvirt documentation.

Reference

According to the libvirt storage pool XML format
, the recommended definition for an NFS/NetFS pool is:

<pool type='netfs'>
  <name>nfs-pool</name>
  <source>
    <host name='nfs.example.com'/>
    <dir path='/exported/path'/>
    <format type='nfs'/>
    <protocol ver='3'/>
  </source>
  <target>
    <path>/var/lib/libvirt/images</path>
  </target>
</pool>

Notes:

can support multiple values (nfs, gluster, cifs, etc.).

can explicitly define the version (3, 4, 4.1, 4.2).

Proposal

Extend LibvirtStoragePoolDef and LibvirtStorageAdaptor to generate and in the XML for netfs pools.

The values should be configurable:

format type should default to nfs, but allow other formats supported by libvirt.

protocol ver should be derived from the global setting secstorage.nfs.version.

Example for 4.2:

<pool type='netfs' xmlns:fs='http://libvirt.org/schemas/storagepool/fs/1.0'>
  <name>507ad79a-d3f3-3b6d-949c-c59d94a533f5</name>
  <uuid>507ad79a-d3f3-3b6d-949c-c59d94a533f5</uuid>
  <source>
    <host name='192.168.27.14'/>
    <dir path='/srv/nfs/cloudstack'/>
    <format type='nfs'/>
    <protocol ver='4.2'/>
  </source>
  <target>
    <path>/mnt/507ad79a-d3f3-3b6d-949c-c59d94a533f5</path>
  </target>
  <fs:mount_opts/>
</pool>

Workaround:
At the moment, this only works if the NFS server supports protocol negotiation.
In this case, even though CloudStack/libvirt does not specify , the server accepts the connection request and transparently upgrades it to NFSv4.x.

With a standard Linux NFS server, this negotiation works and the pool mounts successfully in NFSv4.
However, with CephFS (NFS Ganesha) negotiation is not supported, and the mount fails unless is explicitly set.

Benefits

Aligns CloudStack with libvirt’s recommended schema.

Ensures compatibility with NFS servers that only support v4.x (e.g. CephFS + Ganesha).

Provides flexibility to support other NetFS formats (glusterfs, cifs) if needed.

Makes the configuration consistent between SSVM (which already respects secstorage.nfs.version) and KVM agent.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions