From nobody Tue May 7 07:01:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549899711089404.5096475924246; Mon, 11 Feb 2019 07:41:51 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C18917A19B; Mon, 11 Feb 2019 15:41:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 83F855D96F; Mon, 11 Feb 2019 15:41:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3860018033A5; Mon, 11 Feb 2019 15:41:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1BFflgZ014907 for ; Mon, 11 Feb 2019 10:41:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0257A19741; Mon, 11 Feb 2019 15:41:47 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B82A5632A for ; Mon, 11 Feb 2019 15:41:44 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 11 Feb 2019 16:40:49 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/5] qemuDomainDetachChrDevice: Use @tmpChr to build device string X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 11 Feb 2019 15:41:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" So far we are passing @chr to qemuBuildChrDeviceStr. This is suboptimal beacuse @chr is just parsed XML definition provided by user which by definition may lack some information. On the other hand, @tmpChr is the one that was found using @chr in domain definition so it contains the same amount of information or more. Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- src/qemu/qemu_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 38600b33f8..01920a78f5 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -6131,7 +6131,7 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver, =20 sa_assert(tmpChr->info.alias); =20 - if (qemuBuildChrDeviceStr(&devstr, vmdef, chr, priv->qemuCaps) < 0) + if (qemuBuildChrDeviceStr(&devstr, vmdef, tmpChr, priv->qemuCaps) < 0) goto cleanup; =20 if (!async) --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 07:01:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549899717315854.2239373178058; Mon, 11 Feb 2019 07:41:57 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ABF4274F12; Mon, 11 Feb 2019 15:41:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 618362C165; Mon, 11 Feb 2019 15:41:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 12A803F606; Mon, 11 Feb 2019 15:41:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1BFfnAv015076 for ; Mon, 11 Feb 2019 10:41:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5A5E719741; Mon, 11 Feb 2019 15:41:49 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4BA4453A for ; Mon, 11 Feb 2019 15:41:47 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 11 Feb 2019 16:40:50 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/5] qemuL: Drop "user-" prefix for guestfwd netdev X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 11 Feb 2019 15:41:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Introduced by d86c876a66e3. There is no real need to have "user-" prefix for chardev. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 2 +- tests/qemuxml2argvdata/channel-guestfwd.args | 2 +- .../qemuxml2argvdata/channel-unix-guestfwd.x86_64-2.5.0.args | 4 ++-- .../qemuxml2argvdata/channel-unix-guestfwd.x86_64-latest.args | 4 ++-- tests/qemuxml2argvdata/name-escape.args | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 572d3bc20f..c20d8b02a9 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10857,7 +10857,7 @@ qemuBuildChannelChrDeviceStr(char **deviceStr, port =3D virSocketAddrGetPort(chr->target.addr); =20 if (virAsprintf(deviceStr, - "user,guestfwd=3Dtcp:%s:%i-chardev:char%s,id=3Duse= r-%s", + "user,guestfwd=3Dtcp:%s:%i-chardev:char%s,id=3D%s", addr, port, chr->info.alias, chr->info.alias) < 0) goto cleanup; break; diff --git a/tests/qemuxml2argvdata/channel-guestfwd.args b/tests/qemuxml2a= rgvdata/channel-guestfwd.args index a82d5b6d4e..a5e9a12520 100644 --- a/tests/qemuxml2argvdata/channel-guestfwd.args +++ b/tests/qemuxml2argvdata/channel-guestfwd.args @@ -24,5 +24,5 @@ server,nowait \ -drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ -chardev pipe,id=3Dcharchannel0,path=3D/tmp/guestfwd \ --netdev user,guestfwd=3Dtcp:10.0.2.1:4600-chardev:charchannel0,id=3Duser-c= hannel0 \ +-netdev user,guestfwd=3Dtcp:10.0.2.1:4600-chardev:charchannel0,id=3Dchanne= l0 \ -device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-2.5.0.args= b/tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-2.5.0.args index e8776ca24e..da062968ff 100644 --- a/tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-2.5.0.args +++ b/tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-2.5.0.args @@ -24,8 +24,8 @@ server,nowait \ -boot strict=3Don \ -device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ -chardev socket,id=3Dcharchannel0,path=3D/tmp/guestfwd-listen.socket,serve= r,nowait \ --netdev user,guestfwd=3Dtcp:10.0.2.1:4600-chardev:charchannel0,id=3Duser-c= hannel0 \ +-netdev user,guestfwd=3Dtcp:10.0.2.1:4600-chardev:charchannel0,id=3Dchanne= l0 \ -chardev socket,id=3Dcharchannel1,path=3D/tmp/guestfwd-connect.socket \ --netdev user,guestfwd=3Dtcp:10.0.2.1:4601-chardev:charchannel1,id=3Duser-c= hannel1 \ +-netdev user,guestfwd=3Dtcp:10.0.2.1:4601-chardev:charchannel1,id=3Dchanne= l1 \ -device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x2 \ -msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-latest.arg= s b/tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-latest.args index db14217c1b..34a3d33f27 100644 --- a/tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-latest.args +++ b/tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-latest.args @@ -25,9 +25,9 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -boot strict=3Don \ -device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ -chardev socket,id=3Dcharchannel0,fd=3D1729,server,nowait \ --netdev user,guestfwd=3Dtcp:10.0.2.1:4600-chardev:charchannel0,id=3Duser-c= hannel0 \ +-netdev user,guestfwd=3Dtcp:10.0.2.1:4600-chardev:charchannel0,id=3Dchanne= l0 \ -chardev socket,id=3Dcharchannel1,path=3D/tmp/guestfwd-connect.socket \ --netdev user,guestfwd=3Dtcp:10.0.2.1:4601-chardev:charchannel1,id=3Duser-c= hannel1 \ +-netdev user,guestfwd=3Dtcp:10.0.2.1:4601-chardev:charchannel1,id=3Dchanne= l1 \ -device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x2 \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ resourcecontrol=3Ddeny \ diff --git a/tests/qemuxml2argvdata/name-escape.args b/tests/qemuxml2argvda= ta/name-escape.args index b4cad57602..9190b0b921 100644 --- a/tests/qemuxml2argvdata/name-escape.args +++ b/tests/qemuxml2argvdata/name-escape.args @@ -36,7 +36,7 @@ cert3=3Dcert3,db=3D/etc/pki/nssdb,,foo,id=3Dsmartcard0,bu= s=3Dccid0.0 \ -chardev file,id=3Dcharserial1,path=3D/tmp/serial.log,,foo,append=3Don \ -device isa-serial,chardev=3Dcharserial1,id=3Dserial1 \ -chardev pipe,id=3Dcharchannel0,path=3D/tmp/guestfwd,,foo \ --netdev user,guestfwd=3Dtcp:10.0.2.1:4600-chardev:charchannel0,id=3Duser-c= hannel0 \ +-netdev user,guestfwd=3Dtcp:10.0.2.1:4600-chardev:charchannel0,id=3Dchanne= l0 \ -vnc unix:/tmp/lib/domain--1-foo=3D1,,bar=3D2/vnc.sock \ -spice unix,addr=3D/tmp/lib/domain--1-foo=3D1,,bar=3D2/spice.sock,gl=3Don,\ rendernode=3D/dev/dri/foo,,bar,seamless-migration=3Don \ --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 07:01:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549899716364913.5787948860494; Mon, 11 Feb 2019 07:41:56 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C39C5D61C; Mon, 11 Feb 2019 15:41:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A6E5F18E5A; Mon, 11 Feb 2019 15:41:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 47FC63F604; Mon, 11 Feb 2019 15:41:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1BFfqH3015099 for ; Mon, 11 Feb 2019 10:41:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8313C19C7D; Mon, 11 Feb 2019 15:41:52 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 054951A7D5 for ; Mon, 11 Feb 2019 15:41:49 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 11 Feb 2019 16:40:51 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/5] qemu_hotplug: Attach guestfwd using netdev_add X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 11 Feb 2019 15:41:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1624204 The guestfwd channels are -netdevs really. Hotplug them as such. Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- src/qemu/qemu_hotplug.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 01920a78f5..a0ccc3b82c 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2292,10 +2292,14 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driv= er, char *tlsAlias =3D NULL; const char *secAlias =3D NULL; bool need_release =3D false; + bool guestfwd =3D false; =20 - if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL && - qemuDomainPrepareChannel(chr, priv->channelTargetDir) < 0) - goto cleanup; + if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL) { + guestfwd =3D chr->targetType =3D=3D VIR_DOMAIN_CHR_CHANNEL_TARGET_= TYPE_GUESTFWD; + + if (qemuDomainPrepareChannel(chr, priv->channelTargetDir) < 0) + goto cleanup; + } =20 if (qemuAssignDeviceChrAlias(vmdef, chr, -1) < 0) goto cleanup; @@ -2337,8 +2341,14 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr drive= r, goto exit_monitor; chardevAttached =3D true; =20 - if (qemuMonitorAddDevice(priv->mon, devstr) < 0) - goto exit_monitor; + if (guestfwd) { + if (qemuMonitorAddNetdev(priv->mon, devstr, + NULL, NULL, 0, NULL, NULL, 0) < 0) + goto exit_monitor; + } else { + if (qemuMonitorAddDevice(priv->mon, devstr) < 0) + goto exit_monitor; + } =20 if (qemuDomainObjExitMonitor(driver, vm) < 0) goto audit; --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 07:01:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549899721571213.89134105862547; Mon, 11 Feb 2019 07:42:01 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 31B55C07224C; Mon, 11 Feb 2019 15:41:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 821BF1001F59; Mon, 11 Feb 2019 15:41:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2E324180339A; Mon, 11 Feb 2019 15:41:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1BFfrTB015112 for ; Mon, 11 Feb 2019 10:41:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 55B3319741; Mon, 11 Feb 2019 15:41:53 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id D0E0319C7D for ; Mon, 11 Feb 2019 15:41:52 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 11 Feb 2019 16:40:52 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/5] qemu_hotplug: Detach guestfwd using netdev_del X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 11 Feb 2019 15:42:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1624204 The guestfwd channels are -netdevs really. Hotunplug them as such. Also, DEVICE_DELETED event is not triggered (surprisingly, since we're not issuing device_del rather than netdev_del) and associated chardev is removed automagically too. This means that we need to do qemuDomainRemoveChrDevice() minus monitor call to remove the chardev. Signed-off-by: Michal Privoznik --- src/qemu/qemu_hotplug.c | 48 ++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index a0ccc3b82c..107d0fb7a9 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -4742,25 +4742,28 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver, static int qemuDomainRemoveChrDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, - virDomainChrDefPtr chr) + virDomainChrDefPtr chr, + bool monitor) { virObjectEventPtr event; char *charAlias =3D NULL; qemuDomainObjPrivatePtr priv =3D vm->privateData; int ret =3D -1; - int rc; + int rc =3D 0; =20 VIR_DEBUG("Removing character device %s from domain %p %s", chr->info.alias, vm, vm->def->name); =20 - if (!(charAlias =3D qemuAliasChardevFromDevAlias(chr->info.alias))) - goto cleanup; + if (monitor) { + if (!(charAlias =3D qemuAliasChardevFromDevAlias(chr->info.alias))) + goto cleanup; =20 - qemuDomainObjEnterMonitor(driver, vm); - rc =3D qemuMonitorDetachCharDev(priv->mon, charAlias); + qemuDomainObjEnterMonitor(driver, vm); + rc =3D qemuMonitorDetachCharDev(priv->mon, charAlias); =20 - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + if (qemuDomainObjExitMonitor(driver, vm) < 0) + goto cleanup; + } =20 if (rc =3D=3D 0 && qemuDomainDelChardevTLSObjects(driver, vm, chr->source, charAlias)= < 0) @@ -5064,7 +5067,7 @@ qemuDomainRemoveDevice(virQEMUDriverPtr driver, break; =20 case VIR_DOMAIN_DEVICE_CHR: - ret =3D qemuDomainRemoveChrDevice(driver, vm, dev->data.chr); + ret =3D qemuDomainRemoveChrDevice(driver, vm, dev->data.chr, true); break; case VIR_DOMAIN_DEVICE_RNG: ret =3D qemuDomainRemoveRNGDevice(driver, vm, dev->data.rng); @@ -6127,6 +6130,7 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver, virDomainDefPtr vmdef =3D vm->def; virDomainChrDefPtr tmpChr; char *devstr =3D NULL; + bool guestfwd =3D false; =20 if (!(tmpChr =3D virDomainChrFind(vmdef, chr))) { virReportError(VIR_ERR_DEVICE_MISSING, @@ -6136,6 +6140,11 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr drive= r, goto cleanup; } =20 + /* guestfwd channels are not really -device rather than + * -netdev. We need to treat them slightly differently. */ + guestfwd =3D tmpChr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_CHAN= NEL && + tmpChr->targetType =3D=3D VIR_DOMAIN_CHR_CHANNEL_TARGET_TYP= E_GUESTFWD; + if (!tmpChr->info.alias && qemuAssignDeviceChrAlias(vmdef, tmpChr, -1)= < 0) goto cleanup; =20 @@ -6144,22 +6153,31 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driv= er, if (qemuBuildChrDeviceStr(&devstr, vmdef, tmpChr, priv->qemuCaps) < 0) goto cleanup; =20 - if (!async) + if (!async && !guestfwd) qemuDomainMarkDeviceForRemoval(vm, &tmpChr->info); =20 qemuDomainObjEnterMonitor(driver, vm); - if (devstr && qemuMonitorDelDevice(priv->mon, tmpChr->info.alias) < 0)= { - ignore_value(qemuDomainObjExitMonitor(driver, vm)); - goto cleanup; + if (guestfwd) { + if (qemuMonitorRemoveNetdev(priv->mon, tmpChr->info.alias) < 0) { + ignore_value(qemuDomainObjExitMonitor(driver, vm)); + goto cleanup; + } + } else { + if (devstr && qemuMonitorDelDevice(priv->mon, tmpChr->info.alias) = < 0) { + ignore_value(qemuDomainObjExitMonitor(driver, vm)); + goto cleanup; + } } if (qemuDomainObjExitMonitor(driver, vm) < 0) goto cleanup; =20 - if (async) { + if (guestfwd) { + ret =3D qemuDomainRemoveChrDevice(driver, vm, tmpChr, false); + } else if (async) { ret =3D 0; } else { if ((ret =3D qemuDomainWaitForDeviceRemoval(vm)) =3D=3D 1) - ret =3D qemuDomainRemoveChrDevice(driver, vm, tmpChr); + ret =3D qemuDomainRemoveChrDevice(driver, vm, tmpChr, true); } =20 cleanup: --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 07:01:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549899725388432.94713119959135; Mon, 11 Feb 2019 07:42:05 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 50D0F58E2A; Mon, 11 Feb 2019 15:42:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1734B19C9C; Mon, 11 Feb 2019 15:42:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B5C3D18033CC; Mon, 11 Feb 2019 15:42:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1BFfsCY015121 for ; Mon, 11 Feb 2019 10:41:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2B9AB19741; Mon, 11 Feb 2019 15:41:54 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id A469019C7D for ; Mon, 11 Feb 2019 15:41:53 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 11 Feb 2019 16:40:53 +0100 Message-Id: <020566cb5198190b9a83feb13f11811576d2ad55.1549899626.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/5] qemuhotplugtest: Test guestfwd attach and detach X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 11 Feb 2019 15:42:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Previous two commits demonstrate a hole in our test scenario. Fix that. Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- tests/qemuhotplugtest.c | 6 ++ .../qemuhotplug-guestfwd.xml | 4 ++ .../qemuhotplug-base-live+guestfwd.xml | 55 +++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-guestfwd.xml create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-live+gues= tfwd.xml diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 6d70d5897f..1491c214d0 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -796,6 +796,12 @@ mymain(void) DO_TEST_DETACH("base-live", "watchdog-user-alias-full", false, false, "device_del", QMP_DEVICE_DELETED("ua-UserWatchdog") QMP= _OK); =20 + DO_TEST_ATTACH("base-live", "guestfwd", false, true, + "chardev-add", QMP_OK, + "netdev_add", QMP_OK); + DO_TEST_DETACH("base-live", "guestfwd", false, false, + "netdev_del", QMP_OK); + #define DO_TEST_CPU_GROUP(prefix, vcpus, modernhp, expectfail) \ do { \ cpudata.test =3D prefix; \ diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-guestfwd.xml b/tests/= qemuhotplugtestdevices/qemuhotplug-guestfwd.xml new file mode 100644 index 0000000000..c67dbdb8df --- /dev/null +++ b/tests/qemuhotplugtestdevices/qemuhotplug-guestfwd.xml @@ -0,0 +1,4 @@ + + + + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+guestfwd.xm= l b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+guestfwd.xml new file mode 100644 index 0000000000..8d7294123b --- /dev/null +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+guestfwd.xml @@ -0,0 +1,55 @@ + + hotplug + d091ea82-29e6-2e34-3005-f02617b36e87 + 4194304 + 4194304 + 4 + + hvm + + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-system-x86_64 + + +
+ + + +
+ + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list