1 Star 0 Fork 71

梓瑶/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
qemu_alias-introduce-qemuDomainGetVhostUserAlias-hel.patch 3.34 KB
一键复制 编辑 原始数据 按行查看 历史
yezengruan 提交于 2022-12-06 15:38 . libvirt update to version 6.2.0-47
From 3c0064480e35b794992cb66ed904d60b5d143d9a Mon Sep 17 00:00:00 2001
From: Luo Yifan <luoyifan_yewu@cmss.chinamobile.com>
Date: Wed, 30 Nov 2022 18:13:36 +0800
Subject: [PATCH 13/24] qemu_alias: introduce qemuDomainGetVhostUserAlias
helper
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 6799cc3ada6830c5e4beac0cb770671466d7768a)
Signed-off-by: Luo Yifan <luoyifan_yewu@cmss.chinamobile.com>
---
src/qemu/qemu_alias.c | 6 ++++++
src/qemu/qemu_alias.h | 2 ++
src/qemu/qemu_command.c | 8 +++++---
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index b0ea62af39..cfc6985c5a 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -836,3 +836,9 @@ qemuDomainGetDBusVMStateAlias(void)
{
return "dbus-vmstate0";
}
+
+char *
+qemuDomainGetVhostUserChrAlias(const char *devalias)
+{
+ return g_strdup_printf("chr-vu-%s", devalias);
+}
diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h
index 239747beb1..fc4bdf35fa 100644
--- a/src/qemu/qemu_alias.h
+++ b/src/qemu/qemu_alias.h
@@ -97,3 +97,5 @@ const char *qemuDomainGetManagedPRAlias(void);
char *qemuDomainGetUnmanagedPRAlias(const char *parentalias);
const char *qemuDomainGetDBusVMStateAlias(void);
+
+char *qemuDomainGetVhostUserChrAlias(const char *devalias);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7bd24f042c..9157008b73 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2633,7 +2633,7 @@ qemuBuildVHostUserFsCommandLine(virCommandPtr cmd,
g_autofree char *chardev_alias = NULL;
g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
- chardev_alias = g_strdup_printf("chr-vu-%s", fs->info.alias);
+ chardev_alias = qemuDomainGetVhostUserChrAlias(fs->info.alias);
virCommandAddArg(cmd, "-chardev");
virBufferAddLit(&opt, "socket");
@@ -4603,9 +4603,10 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
virBufferAsprintf(&buf, ",max_outputs=%u", video->heads);
}
} else if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) {
+ g_autofree char *alias = qemuDomainGetVhostUserChrAlias(video->info.alias);
if (video->heads)
virBufferAsprintf(&buf, ",max_outputs=%u", video->heads);
- virBufferAsprintf(&buf, ",chardev=chr-vu-%s", video->info.alias);
+ virBufferAsprintf(&buf, ",chardev=%s", alias);
} else if (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS)) {
if (video->heads)
@@ -4724,6 +4725,7 @@ qemuBuildVhostUserChardevStr(const char *alias,
int *fd,
virCommandPtr cmd)
{
+ g_autofree char *chardev_alias = qemuDomainGetVhostUserChrAlias(alias);
char *chardev = NULL;
if (*fd == -1) {
@@ -4732,7 +4734,7 @@ qemuBuildVhostUserChardevStr(const char *alias,
return NULL;
}
- chardev = g_strdup_printf("socket,id=chr-vu-%s,fd=%d", alias, *fd);
+ chardev = g_strdup_printf("socket,id=%s,fd=%d", chardev_alias, *fd);
virCommandPassFD(cmd, *fd, VIR_COMMAND_PASS_FD_CLOSE_PARENT);
*fd = -1;
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ziyao233/libvirt.git
git@gitee.com:ziyao233/libvirt.git
ziyao233
libvirt
libvirt
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385