[libvirt] [RFE] Raise enumeration limit for virDomain-{ListAllSnapshots, SnapshotListNames}?

Kashyap Chamarthy kchamart at redhat.com
Thu May 11 10:35:18 UTC 2017

I've got a server with multiple guests, and wanted to quickly check how
many of them had snapshots (and in turn, how many snapshots).

So I quickly wrote the below script to enumerate the snapshots using the
virDomainSnapshotListNames() API, and it turned out, one of the guests
had 1329 snaphots (created by a script for testing):

    libvirt.libvirtError: too many remote undefineds: 1329 > 1024

DanPB on IRC said we could likely raise that limit:

    "we can likely increase that limit, since the rpc message size would
    allow many more before the ultimate limit is hit"

He also points out the error message could be improved and is a sign of
a bug:

    "'undefined' is a perl NULL that must come from a bug in the rpc

* * *

Script I used to test:

[ Version: libvirt-daemon-kvm-3.2.0-1.fc25.x86_64 ]

import libvirt
import sys

conn = libvirt.openReadOnly('qemu:///system')
if conn == None:
    print 'Failed to open connection to the hypervisor'

domains = conn.listAllDomains(0)

for name in domains:
        dom = conn.lookupByName(name.name())
    except libvirt.libvirtError:
        print "Domain %s not found" % name

    print("Name: %s, ID: %d, OSType: %s" % (name.name(), dom.ID(),
    # print(dom.listAllSnapshots())

Executing the above script throws (since the 'ostack1' guest apparently
had 1329 snapshots):

Name: cirros, ID: -1, OSType: hvm
Name: compute, ID: -1, OSType: hvm
Name: ostack1, ID: -1, OSType: hvm
Traceback (most recent call last):
  File "enumerate-snapshots.py", line 23, in <module>
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 2527, in snapshotListNames
    if ret is None: raise libvirtError ('virDomainSnapshotListNames() failed', dom=self)
libvirt.libvirtError: too many remote undefineds: 1329 > 1024


More information about the libvir-list mailing list