Re: [PATCH v2 08/13] qemu: put data-file path to VM's cgroup and namespace

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

 



On Sat, Sep 07, 2024 at 17:15:31 +0300, Nikolai Barybin via Devel wrote:
> Signed-off-by: Nikolai Barybin <nikolai.barybin@xxxxxxxxxxxxx>
> ---
>  src/qemu/qemu_cgroup.c    | 4 ++++
>  src/qemu/qemu_namespace.c | 5 +++++
>  2 files changed, 9 insertions(+)

Firstly, that applies everywhere, you must not use the 'path' member of
virStorageSource as a local file path unless you check that it's a local
source by calling virStorageSourceIsLocalStorage. Network storage
backends (e.g. NBD) use that field for the relative path/export name
so it's not a local path then.

> 
> diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
> index 23b7e6b4e8..a6d3c16e50 100644
> --- a/src/qemu/qemu_cgroup.c
> +++ b/src/qemu/qemu_cgroup.c
> @@ -223,6 +223,10 @@ qemuSetupImageCgroupInternal(virDomainObj *vm,
>          qemuSetupImagePathCgroup(vm, QEMU_DEVICE_MAPPER_CONTROL_PATH, false) < 0)
>          return -1;
>  
> +    if (src->dataFileStore &&
> +        qemuSetupImagePathCgroup(vm, src->dataFileStore->path, readonly) < 0)
> +        return -1;
> +

I don't think this is correct. You should call
'qemuSetupImageCgroupInternal' on the data file virStorageSource struct
instead, rather than setup it partially inside.

>      return qemuSetupImagePathCgroup(vm, path, readonly);
>  }
>  
> diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
> index bbe3d5a1f7..afeec63a4f 100644
> --- a/src/qemu/qemu_namespace.c
> +++ b/src/qemu/qemu_namespace.c
> @@ -290,6 +290,11 @@ qemuDomainSetupDisk(virStorageSource *src,
>  
>              if (targetPaths)
>                  *paths = g_slist_concat(g_slist_reverse(targetPaths), *paths);
> +
> +            if (next->dataFileStore) {
> +                g_autofree char *dataFilePath = g_strdup(next->dataFileStore->path);
> +                *paths = g_slist_prepend(*paths, g_steal_pointer(&dataFilePath));
> +            }

And this isn't correct either because this code will be skipped if the
QCOW2 bit (the metadata file) is not stored locally.

>          }
>  
>          *paths = g_slist_prepend(*paths, g_steal_pointer(&tmpPath));
> -- 
> 2.43.5
> 




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux