提交 69cacbe5 编写于 作者: P Peter Krempa

qemublocktest: Extract printing of nodename list

There will be multiple places where we'll need to print nodenames from a
GSList of virStorageSource for testing purposes. Extract the code into a
function.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
上级 5aa423c5
......@@ -647,6 +647,23 @@ testQemuDetectBitmaps(const void *opaque)
}
static void
testQemuBitmapListPrint(const char *title,
GSList *next,
virBufferPtr buf)
{
if (!next)
return;
virBufferAsprintf(buf, "%s\n", title);
for (; next; next = next->next) {
virStorageSourcePtr src = next->data;
virBufferAsprintf(buf, "%s\n", src->nodeformat);
}
}
static virStorageSourcePtr
testQemuBackupIncrementalBitmapCalculateGetFakeImage(size_t idx)
{
......@@ -829,7 +846,6 @@ testQemuCheckpointDeleteMerge(const void *opaque)
g_autoptr(virHashTable) nodedata = NULL;
g_autoptr(GSList) reopenimages = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
GSList *tmp;
expectpath = g_strdup_printf("%s/%s%s-out.json", abs_srcdir,
checkpointDeletePrefix, data->name);
......@@ -858,14 +874,7 @@ testQemuCheckpointDeleteMerge(const void *opaque)
virBufferAddLit(&buf, "NULL\n");
}
if (reopenimages) {
virBufferAddLit(&buf, "reopen nodes:\n");
for (tmp = reopenimages; tmp; tmp = tmp->next) {
virStorageSourcePtr src = tmp->data;
virBufferAsprintf(&buf, "%s\n", src->nodeformat);
}
}
testQemuBitmapListPrint("reopen nodes:", reopenimages, &buf);
actual = virBufferContentAndReset(&buf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册