On Thu, Nov 21, 2024 at 18:03:30 +0100, Peter Krempa wrote:
On Wed, Nov 20, 2024 at 18:48:46 +0300, Nikolai Barybin via Devel
wrote:
> Signed-off-by: Nikolai Barybin <nikolai.barybin(a)virtuozzo.com>
> ---
> src/qemu/qemu_cgroup.c | 13 ++++++++++++-
> src/qemu/qemu_namespace.c | 7 +++++++
> 2 files changed, 19 insertions(+), 1 deletion(-)
> diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
> index 0ebc115524..9fc13ee759 100644
> --- a/src/qemu/qemu_namespace.c
> +++ b/src/qemu/qemu_namespace.c
> @@ -272,6 +272,13 @@ qemuDomainSetupDisk(virStorageSource *src,
> } else {
> GSList *targetPaths = NULL;
>
> + if (next->dataFileStore &&
> + !virStorageSourceIsEmpty(next->dataFileStore) &&
> + virStorageSourceIsLocalStorage(next->dataFileStore)) {
> + g_autofree char *dataFilePath =
g_strdup(next->dataFileStore->path);
> + *paths = g_slist_prepend(*paths,
g_steal_pointer(&dataFilePath));
> + }
> +
This can be simplified:
if (next->dataFileStore &&
virStorageSourceIsLocalStorage(next->dataFileStore))
*paths = g_slist_prepend(*paths,
g_strdup(next->dataFileStore->path));
virStorageSourceIsEmpty is pointless because the data file can't be
empty and there's no need for a temporary variable.
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>