[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 1/6] Move qemu_audit.h helpers into shared code



On 07/04/2011 05:33 AM, Daniel P. Berrange wrote:
> The LXC and UML drivers can both make use of auditing. Move
> the qemu_audit.{c,h} files to src/conf/domain_audit.{c,h}
> 
> * src/conf/domain_audit.c: Rename from src/qemu/qemu_audit.c
> * src/conf/domain_audit.h: Rename from src/qemu/qemu_audit.h
> * src/Makefile.am: Remove qemu_audit.{c,h}, add domain_audit.{c,h}
> * src/qemu/qemu_audit.h, src/qemu/qemu_cgroup.c,
>   src/qemu/qemu_command.c, src/qemu/qemu_driver.c,
>   src/qemu/qemu_hotplug.c, src/qemu/qemu_migration.c,
>   src/qemu/qemu_process.c: Update for changed audit API names
> ---
>  src/Makefile.am                                |    2 +-
>  src/{qemu/qemu_audit.c => conf/domain_audit.c} |  116 ++++++++++++------------
>  src/conf/domain_audit.h                        |   99 ++++++++++++++++++++
>  src/libvirt_private.syms                       |   15 +++
>  src/qemu/qemu_audit.h                          |   99 --------------------
>  src/qemu/qemu_cgroup.c                         |   18 ++--
>  src/qemu/qemu_command.c                        |    8 +-
>  src/qemu/qemu_driver.c                         |   26 +++---
>  src/qemu/qemu_hotplug.c                        |   48 +++++-----
>  src/qemu/qemu_migration.c                      |   24 +++---
>  src/qemu/qemu_process.c                        |   10 +-
>  11 files changed, 240 insertions(+), 225 deletions(-)
>  rename src/{qemu/qemu_audit.c => conf/domain_audit.c} (78%)
>  create mode 100644 src/conf/domain_audit.h
>  delete mode 100644 src/qemu/qemu_audit.h
> 
> --- a/src/qemu/qemu_audit.c
> +++ b/src/conf/domain_audit.c
> @@ -1,5 +1,5 @@
>  /*
> - * qemu_audit.c: QEMU audit management
> + * virDomain_audit.c: VIRDOMAIN audit management

s/virDomain_audit/domain_audit/ (your global search-and-replace didn't
know how to handle comments mentioning a file name :)

> +++ b/src/conf/domain_audit.h
> @@ -0,0 +1,99 @@
> +/*
> + * virDomain_audit.h: VIRDOMAIN audit management

s/virDomain_audit/domain_audit/

> +
> +void virDomainAuditStart(virDomainObjPtr vm,
> +                         const char *reason,
> +                               bool success)

Odd indentation.

> +void virDomainAuditCgroupPath(virDomainObjPtr vm,
> +                              virCgroupPtr group,
> +                              const char *reason,
> +                              const char *path,
> +                              const char *perms,
> +                         int rc)
> +    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
> +    ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5);
> +void virDomainAuditMemory(virDomainObjPtr vm,
> +                          unsigned long long oldmem,
> +                          unsigned long long newmem,
> +                          const char *reason,
> +                     bool success)

A couple more odd indentations.

> @@ -70,7 +70,7 @@ qemuSetupDiskPathAllow(virDomainDiskDefPtr disk,
>      rc = virCgroupAllowDevicePath(data->cgroup, path,
>                                    (disk->readonly ? VIR_CGROUP_DEVICE_READ
>                                     : VIR_CGROUP_DEVICE_RW));
> -    qemuAuditCgroupPath(data->vm, data->cgroup, "allow", path,
> +    virDomainAuditCgroupPath(data->vm, data->cgroup, "allow", path,
>                          disk->readonly ? "r" : "rw", rc);

Indentation.

> @@ -156,7 +156,7 @@ qemuSetupChardevCgroup(virDomainDefPtr def,
>      VIR_DEBUG("Process path '%s' for disk", dev->source.data.file.path);
>      rc = virCgroupAllowDevicePath(data->cgroup, dev->source.data.file.path,
>                                    VIR_CGROUP_DEVICE_RW);
> -    qemuAuditCgroupPath(data->vm, data->cgroup, "allow",
> +    virDomainAuditCgroupPath(data->vm, data->cgroup, "allow",
>                          dev->source.data.file.path, "rw", rc);

Indentation.

> @@ -234,7 +234,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
>  
>          rc = virCgroupAllowDeviceMajor(cgroup, 'c', DEVICE_PTY_MAJOR,
>                                         VIR_CGROUP_DEVICE_RW);
> -        qemuAuditCgroupMajor(vm, cgroup, "allow", DEVICE_PTY_MAJOR,
> +        virDomainAuditCgroupMajor(vm, cgroup, "allow", DEVICE_PTY_MAJOR,
>                               "pty", "rw", rc == 0);

Again.

> @@ -249,7 +249,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
>                (vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL)))) {
>              rc = virCgroupAllowDeviceMajor(cgroup, 'c', DEVICE_SND_MAJOR,
>                                             VIR_CGROUP_DEVICE_RW);
> -            qemuAuditCgroupMajor(vm, cgroup, "allow", DEVICE_SND_MAJOR,
> +            virDomainAuditCgroupMajor(vm, cgroup, "allow", DEVICE_SND_MAJOR,
>                                   "sound", "rw", rc == 0);

Any guesses?

> @@ -1752,7 +1752,7 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
>              qemuDomainObjEnterMonitor(vm);
>              r = qemuMonitorSetBalloon(priv->mon, newmem);
>              qemuDomainObjExitMonitor(vm);
> -            qemuAuditMemory(vm, vm->def->mem.cur_balloon, newmem, "update",
> +            virDomainAuditMemory(vm, vm->def->mem.cur_balloon, newmem, "update",
>                              r == 1);

I'm a broken record...

ACK with formatting nits fixed.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]