Product SiteDocumentation Site

7.4.4. changeBegin

This method creates a restore point to which one can return later by calling changeRollback method. This function should be called before any transaction with interface configuration. Once it is known that a new configuration works, it can be committed via the changeCommit method, which frees the restore point.
If the changeBegin method is called when a transaction is already opened, an error will be thrown.

Example 7.15. Using changeBegin

# Example-31.py
#!/usr/bin/env python3
import sys
import libvirt

conn = None
try:
    conn = libvirt.open("qemu:///system")
except libvirt.libvirtError as e:
    print(repr(e), file=sys.stderr)
    exit(1)

iface = conn.changeBegin()

conn.close()
exit(0)