mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-19 14:10:58 +00:00
qemuDomainChangeNet: check virtio options for non-virtio models
In a domain created with an interface with a <driver> subelement, the device contains a non-NULL virDomainVirtioOptions struct, even for non-virtio NIC models. The subelement need not be present again after libvirt restarts, or when the interface is passed to clients. When clients such as virsh domif-setlink put back the modified interface XML, the new device's virtio attribute is NULL. This may fail the equality checks for virtio options in qemuDomainChangeNet, depending on whether libvird was restarted since define or not. This patch modifies the check for non-virtio models, to ignore olddev value of virtio (assumed valid), and to allow either NULL or a struct with all values ABSENT in the new virtio options. Signed-off-by: Miroslav Los <mirlos@cisco.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
9fade1d6fb
commit
8515a178f8
@ -3681,6 +3681,7 @@ qemuDomainChangeNet(virQEMUDriver *driver,
|
||||
bool needVlanUpdate = false;
|
||||
bool needIsolatedPortChange = false;
|
||||
bool needQueryRxFilter = false;
|
||||
bool isVirtio = false;
|
||||
int ret = -1;
|
||||
int changeidx = -1;
|
||||
g_autoptr(virConnect) conn = NULL;
|
||||
@ -3742,7 +3743,9 @@ qemuDomainChangeNet(virQEMUDriver *driver,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virDomainNetIsVirtioModel(olddev) &&
|
||||
isVirtio = virDomainNetIsVirtioModel(olddev);
|
||||
|
||||
if (isVirtio &&
|
||||
(olddev->driver.virtio.name != newdev->driver.virtio.name ||
|
||||
olddev->driver.virtio.txmode != newdev->driver.virtio.txmode ||
|
||||
olddev->driver.virtio.ioeventfd != newdev->driver.virtio.ioeventfd ||
|
||||
@ -3769,12 +3772,18 @@ qemuDomainChangeNet(virQEMUDriver *driver,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!!olddev->virtio != !!newdev->virtio ||
|
||||
(olddev->virtio && newdev->virtio &&
|
||||
(olddev->virtio->iommu != newdev->virtio->iommu ||
|
||||
olddev->virtio->ats != newdev->virtio->ats ||
|
||||
olddev->virtio->packed != newdev->virtio->packed ||
|
||||
olddev->virtio->page_per_vq != newdev->virtio->page_per_vq))) {
|
||||
if ((isVirtio &&
|
||||
(!!olddev->virtio != !!newdev->virtio ||
|
||||
(olddev->virtio && newdev->virtio &&
|
||||
(olddev->virtio->iommu != newdev->virtio->iommu ||
|
||||
olddev->virtio->ats != newdev->virtio->ats ||
|
||||
olddev->virtio->packed != newdev->virtio->packed ||
|
||||
olddev->virtio->page_per_vq != newdev->virtio->page_per_vq)))) ||
|
||||
(!isVirtio && newdev->virtio &&
|
||||
(newdev->virtio->iommu != 0 ||
|
||||
newdev->virtio->ats != 0 ||
|
||||
newdev->virtio->packed != 0 ||
|
||||
newdev->virtio->page_per_vq != 0))) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("cannot modify virtio network device driver options"));
|
||||
goto cleanup;
|
||||
|
Loading…
Reference in New Issue
Block a user