[libvirt] [PATCH 3/7] qemu_cgroup: Kill qemuSetupHostSCSIVHostDeviceCgroup

Marc-André Lureau marcandre.lureau at gmail.com
Thu Feb 16 12:12:24 UTC 2017


Hi

On Fri, Feb 10, 2017 at 6:57 PM Michal Privoznik <mprivozn at redhat.com>
wrote:

> There's no need for this function. Currently it is passed as a
> callback to virSCSIVHostDeviceFileIterate(). However, SCSI host
> devices have just one file path. Therefore we can mimic approach
> used in qemuDomainGetHostdevPath() to get path and call
> virCgroupAllowDevicePath() directly.
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>


Reviewed-by: Marc-André Lureau <marcandre.lureau at redhat.com>



> ---
>  src/qemu/qemu_cgroup.c | 33 +++++++++++----------------------
>  1 file changed, 11 insertions(+), 22 deletions(-)
>
> diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
> index 6017da662..89854b5bd 100644
> --- a/src/qemu/qemu_cgroup.c
> +++ b/src/qemu/qemu_cgroup.c
> @@ -260,25 +260,6 @@ qemuSetupInputCgroup(virDomainObjPtr vm,
>  }
>
>
> -static int
> -qemuSetupHostSCSIVHostDeviceCgroup(virSCSIVHostDevicePtr dev
> ATTRIBUTE_UNUSED,
> -                                   const char *path,
> -                                   void *opaque)
> -{
> -    virDomainObjPtr vm = opaque;
> -    qemuDomainObjPrivatePtr priv = vm->privateData;
> -    int ret;
> -
> -    VIR_DEBUG("Process path '%s' for scsi_host device", path);
> -
> -    ret = virCgroupAllowDevicePath(priv->cgroup, path,
> -                                   VIR_CGROUP_DEVICE_RW, false);
> -
> -    virDomainAuditCgroupPath(vm, priv->cgroup, "allow", path, "rw", ret
> == 0);
> -
> -    return ret;
> -}
> -
>  int
>  qemuSetupHostdevCgroup(virDomainObjPtr vm,
>                         virDomainHostdevDefPtr dev)
> @@ -397,9 +378,17 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm,
>                  if (!(host = virSCSIVHostDeviceNew(hostsrc->wwpn)))
>                      goto cleanup;
>
> -                if (virSCSIVHostDeviceFileIterate(host,
> -
>  qemuSetupHostSCSIVHostDeviceCgroup,
> -                                             vm) < 0)
> +                if (VIR_STRDUP(path, virSCSIVHostDeviceGetPath(host)) < 0)
> +                    goto cleanup;
> +
> +                VIR_DEBUG("Process path '%s' for scsi_host device", path);
> +
> +                rv = virCgroupAllowDevicePath(priv->cgroup, path,
> +                                              VIR_CGROUP_DEVICE_RW,
> false);
> +
> +                virDomainAuditCgroupPath(vm, priv->cgroup,
> +                                         "allow", path, "rw", rv == 0);
> +                if (rv < 0)
>                      goto cleanup;
>              }
>              break;
> --
> 2.11.0
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>
-- 
Marc-André Lureau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170216/f9935185/attachment-0001.htm>


More information about the libvir-list mailing list