mirror of https://gitee.com/openkylin/libvirt.git
qemu: forbid updating any attributes of an interface <backend> with update-device
Changing any of the attributes of an <interface>'s <backend> would require removing and re-adding the interface for the new setting to take effect, so fail any update-device that changes anything in <backend> Resolves: https://bugzilla.redhat.com/2169245 Signed-off-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
9445a8e398
commit
110d209263
|
@ -19854,6 +19854,20 @@ virDomainFsDefCheckABIStability(virDomainFSDef *src,
|
|||
}
|
||||
|
||||
|
||||
bool
|
||||
virDomainNetBackendIsEqual(virDomainNetBackend *src,
|
||||
virDomainNetBackend *dst)
|
||||
{
|
||||
if (src->type != dst->type ||
|
||||
STRNEQ_NULLABLE(src->tap, dst->tap) ||
|
||||
STRNEQ_NULLABLE(src->vhost, dst->vhost) ||
|
||||
STRNEQ_NULLABLE(src->logFile, dst->logFile)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
virDomainNetDefCheckABIStability(virDomainNetDef *src,
|
||||
virDomainNetDef *dst)
|
||||
|
|
|
@ -3863,6 +3863,8 @@ virDomainNetDef *virDomainNetFindByName(virDomainDef *def, const char *ifname);
|
|||
bool virDomainHasNet(virDomainDef *def, virDomainNetDef *net);
|
||||
int virDomainNetInsert(virDomainDef *def, virDomainNetDef *net);
|
||||
int virDomainNetUpdate(virDomainDef *def, size_t netidx, virDomainNetDef *newnet);
|
||||
bool virDomainNetBackendIsEqual(virDomainNetBackend *src,
|
||||
virDomainNetBackend *dst);
|
||||
int virDomainNetDHCPInterfaces(virDomainDef *def, virDomainInterfacePtr **ifaces);
|
||||
int virDomainNetARPInterfaces(virDomainDef *def, virDomainInterfacePtr **ifaces);
|
||||
virDomainNetDef *virDomainNetRemove(virDomainDef *def, size_t i);
|
||||
|
|
|
@ -528,6 +528,7 @@ virDomainMouseModeTypeToString;
|
|||
virDomainNetAllocateActualDevice;
|
||||
virDomainNetAppendIPAddress;
|
||||
virDomainNetARPInterfaces;
|
||||
virDomainNetBackendIsEqual;
|
||||
virDomainNetBandwidthUpdate;
|
||||
virDomainNetDefActualFromNetworkPort;
|
||||
virDomainNetDefActualToNetworkPort;
|
||||
|
|
|
@ -3675,6 +3675,15 @@ qemuDomainChangeNet(virQEMUDriver *driver,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
/* nothing in <backend> can be modified in an existing interface -
|
||||
* the entire device will need to be removed and re-added.
|
||||
*/
|
||||
if (!virDomainNetBackendIsEqual(&olddev->backend, &newdev->backend)) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("cannot modify network device backend settings"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* allocate new actual device to compare to old - we will need to
|
||||
* free it if we fail for any reason
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue