1 Star 0 Fork 71

Jiangjiacheng/src_libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
qemuBlockJobProcessEventCompletedPull-Add-backingSto.patch 2.54 KB
一键复制 编辑 原始数据 按行查看 历史
From 6c7c9aab6d5dd9fd836e19990bb63d5ef47871c2 Mon Sep 17 00:00:00 2001
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 12 Apr 2021 17:42:23 +0200
Subject: [PATCH 058/108] qemuBlockJobProcessEventCompletedPull: Add
backingStore terminators if base is NULL
When doing a blockpull with NULL base the full contents of the disk are
pulled into the topmost image which then becomes fully self-contained.
qemuBlockJobProcessEventCompletedPull doesn't install the backing chain
terminators though, although it's guaranteed that there will be no
backing chain behind disk->src.
Add the terminators for completness and for disabling backing chain
detection on further boots.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit b4d020790642fa4d7b8a6783b81d5d9d73cbe3d9)
---
src/qemu/qemu_blockjob.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 049afdd71a..ea82ce95eb 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -958,6 +958,7 @@ qemuBlockJobProcessEventCompletedPull(virQEMUDriverPtr driver,
qemuBlockJobDataPtr job,
qemuDomainAsyncJob asyncJob)
{
+ virStorageSource *base = NULL;
virStorageSourcePtr baseparent = NULL;
virDomainDiskDefPtr cfgdisk = NULL;
virStorageSourcePtr cfgbase = NULL;
@@ -979,8 +980,11 @@ qemuBlockJobProcessEventCompletedPull(virQEMUDriverPtr driver,
return;
if (job->data.pull.base) {
+ base = job->data.pull.base;
+
if (cfgdisk)
cfgbase = cfgdisk->src->backingStore;
+
for (n = job->disk->src->backingStore; n && n != job->data.pull.base; n = n->backingStore) {
/* find the image on top of 'base' */
@@ -991,10 +995,17 @@ qemuBlockJobProcessEventCompletedPull(virQEMUDriverPtr driver,
baseparent = n;
}
+ } else {
+ /* create terminators for the chain; since we are pulling everything
+ * into the top image the chain is automatically considered terminated */
+ base = virStorageSourceNew();
+
+ if (cfgdisk)
+ cfgbase = virStorageSourceNew();
}
tmp = job->disk->src->backingStore;
- job->disk->src->backingStore = job->data.pull.base;
+ job->disk->src->backingStore = base;
if (baseparent)
baseparent->backingStore = NULL;
qemuBlockJobEventProcessConcludedRemoveChain(driver, vm, asyncJob, tmp);
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jjiacheng/src_libvirt.git
git@gitee.com:jjiacheng/src_libvirt.git
jjiacheng
src_libvirt
src_libvirt
master

搜索帮助