1 Star 0 Fork 71

baijing_0022/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
virsh-cmdBlock-Remove-error-prefix-for-an-empty-line.patch 2.57 KB
一键复制 编辑 原始数据 按行查看 历史
yezengruan 提交于 2022-11-25 19:41 . sync some bugfix patches from upstream
From 72d16dabd48f8916e7296f19ec48ff3109a040c1 Mon Sep 17 00:00:00 2001
From: tangbin <tangbin_yewu@cmss.chinamobile.com>
Date: Wed, 23 Nov 2022 16:00:29 +0200
Subject: [PATCH 11/23] virsh: cmdBlock*: Remove 'error:' prefix for an empty
line
When a block copy job fails prior to reaching the synchronized phase
while we are waiting for the job to finish virsh would print the
following:
$ virsh blockcopy backup-test vda /tmp/dst.qcow2 --wait --reuse-external --transient-job
error:
Copy failed
The above message looks like we've forgot to print the error message
itself as the line ends after 'error:'. Unfortunately with the current
API design clients have no way of actually getting the error message as
the VIR_DOMAIN_EVENT_ID_BLOCK_JOB(_2) event only reports the status but
not an error and the job then vanishes.
Fix the expectations by using vshPrintExtra instead of vshError:
$ virsh blockcopy backup-test vda /tmp/dst.qcow2 --wait --reuse-external --transient-job
Copy failed
Note that the newline is required to avoid printing the 'Copy failed'
message on the same line when printing the job progress percentage.
Inspired by https://bugzilla.redhat.com/show_bug.cgi?id=1847867
Fix the same issue also for block pull and block commit job
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: tangbin <tangbin_yewu@cmss.chinamobile.com>
(cherry-pick from fc09f3d823aba430d38db0d5ba8cdc5b0a71b9e5)
---
tools/virsh-domain.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 50568203aa..7033232015 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2140,7 +2140,7 @@ cmdBlockcommit(vshControl *ctl, const vshCmd *cmd)
break;
case VIR_DOMAIN_BLOCK_JOB_FAILED:
- vshError(ctl, "\n%s", _("Commit failed"));
+ vshPrintExtra(ctl, "\n%s", _("Commit failed"));
goto cleanup;
break;
@@ -2457,7 +2457,7 @@ cmdBlockcopy(vshControl *ctl, const vshCmd *cmd)
break;
case VIR_DOMAIN_BLOCK_JOB_FAILED:
- vshError(ctl, "\n%s", _("Copy failed"));
+ vshPrintExtra(ctl, "\n%s", _("Copy failed"));
goto cleanup;
break;
@@ -2865,7 +2865,7 @@ cmdBlockpull(vshControl *ctl, const vshCmd *cmd)
break;
case VIR_DOMAIN_BLOCK_JOB_FAILED:
- vshError(ctl, "\n%s", _("Pull failed"));
+ vshPrintExtra(ctl, "\n%s", _("Pull failed"));
goto cleanup;
break;
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/baijing_0022/libvirt.git
git@gitee.com:baijing_0022/libvirt.git
baijing_0022
libvirt
libvirt
master

搜索帮助