int ret = -1;
bool releaseaddr = false;
bool iface_connected = false;
+ bool adjustmemlock = false;
virDomainNetType actualType;
const virNetDevBandwidth *actualBandwidth;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
break;
case VIR_DOMAIN_NET_TYPE_VDPA:
+ if (qemuDomainAdjustMaxMemLock(vm, false) < 0)
+ goto cleanup;
+ adjustmemlock = true;
+
if ((vdpafd = qemuInterfaceVDPAConnect(net)) < 0)
goto cleanup;
break;
*/
virDomainNetRemoveByObj(vm->def, net);
+ /* if we adjusted the memlock limit (for a vDPA device) then
+ * we need to re-adjust since we won't be using the device
+ * after all
+ */
+ if (adjustmemlock)
+ qemuDomainAdjustMaxMemLock(vm, false);
+
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
if (conn)
virDomainNetReleaseActualDevice(conn, vm->def, net);