mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 18:05:20 +00:00
network: make networkLogAllocation independent of domain conf
Stop passing a virDomainNetDefPtr parameter to networkLogAllocation, instead just pass in the MAC address. The actual device type is also not required, since virNetworkForwardIfDefPtr has a type field that can be used instead. Reviewed-by: Laine Stump <laine@laine.org> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
4b4a981d60
commit
19f9a864ba
@ -4326,32 +4326,29 @@ networkGetDHCPLeases(virNetworkPtr net,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
networkLogAllocation(virNetworkDefPtr netdef,
|
networkLogAllocation(virNetworkDefPtr netdef,
|
||||||
virDomainNetType actualType,
|
|
||||||
virNetworkForwardIfDefPtr dev,
|
virNetworkForwardIfDefPtr dev,
|
||||||
virDomainNetDefPtr iface,
|
virMacAddrPtr mac,
|
||||||
bool inUse)
|
bool inUse)
|
||||||
{
|
{
|
||||||
char macStr[VIR_MAC_STRING_BUFLEN];
|
char macStr[VIR_MAC_STRING_BUFLEN];
|
||||||
const char *verb = inUse ? "using" : "releasing";
|
const char *verb = inUse ? "using" : "releasing";
|
||||||
|
|
||||||
|
virMacAddrFormat(mac, macStr);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
VIR_INFO("MAC %s %s network %s (%d connections)",
|
VIR_INFO("MAC %s %s network %s (%d connections)",
|
||||||
virMacAddrFormat(&iface->mac, macStr), verb,
|
macStr, verb, netdef->name, netdef->connections);
|
||||||
netdef->name, netdef->connections);
|
|
||||||
} else {
|
} else {
|
||||||
if (actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
|
if (dev->type == VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI) {
|
||||||
VIR_INFO("MAC %s %s network %s (%d connections) "
|
VIR_INFO("MAC %s %s network %s (%d connections) "
|
||||||
"physical device %04x:%02x:%02x.%x (%d connections)",
|
"physical device %04x:%02x:%02x.%x (%d connections)",
|
||||||
virMacAddrFormat(&iface->mac, macStr), verb,
|
macStr, verb, netdef->name, netdef->connections,
|
||||||
netdef->name, netdef->connections,
|
|
||||||
dev->device.pci.domain, dev->device.pci.bus,
|
dev->device.pci.domain, dev->device.pci.bus,
|
||||||
dev->device.pci.slot, dev->device.pci.function,
|
dev->device.pci.slot, dev->device.pci.function,
|
||||||
dev->connections);
|
dev->connections);
|
||||||
} else {
|
} else {
|
||||||
VIR_INFO("MAC %s %s network %s (%d connections) "
|
VIR_INFO("MAC %s %s network %s (%d connections) "
|
||||||
"physical device %s (%d connections)",
|
"physical device %s (%d connections)",
|
||||||
virMacAddrFormat(&iface->mac, macStr), verb,
|
macStr, verb, netdef->name, netdef->connections,
|
||||||
netdef->name, netdef->connections,
|
|
||||||
dev->device.dev, dev->connections);
|
dev->device.dev, dev->connections);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4764,7 +4761,7 @@ networkAllocateActualDevice(virNetworkPtr net,
|
|||||||
dev->connections--;
|
dev->connections--;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
networkLogAllocation(netdef, actualType, dev, iface, true);
|
networkLogAllocation(netdef, dev, &iface->mac, true);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
@ -4955,7 +4952,7 @@ networkNotifyActualDevice(virNetworkPtr net,
|
|||||||
netdef->connections--;
|
netdef->connections--;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
networkLogAllocation(netdef, actualType, dev, iface, true);
|
networkLogAllocation(netdef, dev, &iface->mac, true);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -5122,7 +5119,7 @@ networkReleaseActualDevice(virNetworkPtr net,
|
|||||||
/* finally we can call the 'unplugged' hook script if any */
|
/* finally we can call the 'unplugged' hook script if any */
|
||||||
networkRunHook(obj, dom, iface, VIR_HOOK_NETWORK_OP_IFACE_UNPLUGGED,
|
networkRunHook(obj, dom, iface, VIR_HOOK_NETWORK_OP_IFACE_UNPLUGGED,
|
||||||
VIR_HOOK_SUBOP_BEGIN);
|
VIR_HOOK_SUBOP_BEGIN);
|
||||||
networkLogAllocation(netdef, actualType, dev, iface, false);
|
networkLogAllocation(netdef, dev, &iface->mac, false);
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user