On Thu, Mar 21, 2019 at 18:28:59 -0400, Laine Stump wrote: > This function can be called with a virDomainDevicePtr and whether or > not the removal was successful, and it will call the appropriate > virDomainAudit*() function with the appropriate args for whatever type > of device it's given (or do nothing, if that's appropriate). This > permits generalizing some code that currently has a separate copy for > each type of device. > > Signed-off-by: Laine Stump <laine@xxxxxxxxx> > --- > src/qemu/qemu_hotplug.c | 72 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 72 insertions(+) > > diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c > index b0e2c738b9..5e5ffe16d3 100644 > --- a/src/qemu/qemu_hotplug.c > +++ b/src/qemu/qemu_hotplug.c > @@ -5208,6 +5208,78 @@ qemuDomainRemoveRedirdevDevice(virQEMUDriverPtr driver, > } > > > +static inline void Don't use inline, it's pointless. > +qemuDomainRemoveAuditDevice(virDomainObjPtr vm, > + virDomainDeviceDefPtr detach, > + bool success) @success is always false in the one call place the other patches add. Especially I doubt it will ever be different. All async device deletion callbacks do their own per-device-type audit call on success. This function is unused thus breaks build. > +{ > + switch ((virDomainDeviceType)detach->type) { > + case VIR_DOMAIN_DEVICE_CHR: > + virDomainAuditChardev(vm, detach->data.chr, NULL, "detach", success); > + break; > + > + case VIR_DOMAIN_DEVICE_DISK: > + virDomainAuditDisk(vm, detach->data.disk->src, NULL, "detach", success); > + break; > + > + case VIR_DOMAIN_DEVICE_NET: > + virDomainAuditNet(vm, detach->data.net, NULL, "detach", success); > + break; > + > + case VIR_DOMAIN_DEVICE_HOSTDEV: > + virDomainAuditHostdev(vm, detach->data.hostdev, "detach", success); > + break; > + > + case VIR_DOMAIN_DEVICE_RNG: > + virDomainAuditRNG(vm, detach->data.rng, NULL, "detach", success); > + break; > + > + case VIR_DOMAIN_DEVICE_MEMORY: { > + unsigned long long oldmem = virDomainDefGetMemoryTotal(vm->def); > + unsigned long long newmem = oldmem - detach->data.memory->size; > + > + virDomainAuditMemory(vm, oldmem, newmem, "update", success); This is currently not audited, I think it should be added separately.
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list