1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-10 04:06:47 +00:00

fix(interfaces): no create, start, stop or delete where libvirt cannot change interfaces

libvirt's udev interface backend (RHEL 9 and later, Debian 12) only reads
interfaces, so the create form and the start, stop and delete buttons
only failed there. The pages ask the host with an invalid definition,
which defines nothing: a backend without define refuses it as not
supported. There they show the interface state and a note instead, and
posts change nothing; the host's devices, needed only by the create
form, are not read. Any other answer keeps the pages as they were.
This commit is contained in:
catborise 2026-10-10 21:27:31 +03:00
parent 35fea424ee
commit 0bb4337043
9 changed files with 175 additions and 12 deletions

View file

@ -958,6 +958,17 @@ class wvmConnect(object):
instance.append(dom.name())
return instance
def can_change_interfaces(self):
"""False when the host's libvirt cannot define interfaces (the udev
backend only reads them). The definition sent is invalid, so nothing is
defined: a backend without define refuses it with VIR_ERR_NO_SUPPORT,
one with define with an XML error."""
try:
self.wvm.interfaceDefineXML("<interface/>", 0)
except libvirtError as err:
return err.get_error_code() != libvirt.VIR_ERR_NO_SUPPORT
return True
def get_net_devices(self):
"""The host's network interface names; libvirt lists only the network devices"""
return [