[libvirt] [PATCH v3 2/5] qemu: Rename qemuProcessBuildDestroyHugepagesPath

John Ferlan jferlan at redhat.com
Tue Nov 7 21:27:55 UTC 2017



On 11/07/2017 10:51 AM, Michal Privoznik wrote:
> At the same time, move its internals into a separate function so
> that they can be reused.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/qemu/qemu_hotplug.c |  2 +-
>  src/qemu/qemu_process.c | 76 +++++++++++++++++++++++++++++--------------------
>  src/qemu/qemu_process.h |  8 +++---
>  3 files changed, 50 insertions(+), 36 deletions(-)
> 

[...]

> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 7df440ee4..e27cd0d40 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -3324,11 +3324,45 @@ qemuProcessNeedHugepagesPath(virDomainDefPtr def,
>  }
>  
>  
> +static int
> +qemuProcessBuildDestroyMemoryPathsImpl(virQEMUDriverPtr driver,
> +                                       virDomainDefPtr def,
> +                                       const char *path,
> +                                       bool build)
> +{
> +    if (build) {
> +        if (virFileExists(path))
> +            return 0;
> +
> +        if (virFileMakePathWithMode(path, 0700) < 0) {
> +            virReportSystemError(errno,
> +                                 _("Unable to create %s"),
> +                                 path);
> +            return -1;
> +        }
> +
> +        if (qemuSecurityDomainSetPathLabel(driver->securityManager,
> +                                           def, path) < 0) {
> +            virReportError(VIR_ERR_INTERNAL_ERROR,
> +                            _("Unable to label %s"), path);
> +            return -1;
> +        }
> +    } else {
> +        if (rmdir(path) < 0 &&
> +            errno != ENOENT)
> +            VIR_WARN("Unable to remove hugepage path: %s (errno=%d)",

This won't be hugepage specific soon...

John

> +                     path, errno);
> +    }
> +
> +    return 0;
> +}
> +
> +

[...]




More information about the libvir-list mailing list