Blob Blame History Raw
From a0a2e4eaa6ab0b6435286f9af6e7026f0000b9e5 Mon Sep 17 00:00:00 2001
Message-Id: <a0a2e4eaa6ab0b6435286f9af6e7026f0000b9e5@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 16 Mar 2020 22:12:23 +0100
Subject: [PATCH] qemublocktest: Fix and optimize fake image chain
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Set the 'id' field of the backing chain properly so that we can look
up images, and initialize 6 images instead of 10 as we don't use more
currently.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit f8389505aae66e705046f5cbd9fe4ac10f1dee2e)
https://bugzilla.redhat.com/show_bug.cgi?id=1799013
Message-Id: <c45885fd70242874545a5c8129bcb52022014112.1584391727.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 tests/qemublocktest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index f48875e16d..6ccc2328b3 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -636,6 +636,7 @@ testQemuBackupIncrementalBitmapCalculateGetFakeImage(size_t idx)
    if (!(ret = virStorageSourceNew()))
        abort();
 
+   ret->id = idx;
    ret->type = VIR_STORAGE_TYPE_FILE;
    ret->format = VIR_STORAGE_FILE_QCOW2;
    ret->path = g_strdup_printf("/image%zu", idx);
@@ -655,7 +656,7 @@ testQemuBackupIncrementalBitmapCalculateGetFakeChain(void)
 
     n = ret = testQemuBackupIncrementalBitmapCalculateGetFakeImage(1);
 
-    for (i = 2; i < 10; i++) {
+    for (i = 2; i < 6; i++) {
         n->backingStore = testQemuBackupIncrementalBitmapCalculateGetFakeImage(i);
         n = n->backingStore;
     }
-- 
2.25.1