From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 1EAA45A0271 for ; Fri, 24 Feb 2023 19:49:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677264597; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l9YrMz4R760l+l25mNO53Z5a/VBhnFzzSsnV6de/TV4=; b=aYoBj2av6pOOyEQHa9jcKYPivn4+AGKmtADd4aiJGGlIHcn013milAZwSiym2HzGBegVDc IMDEvn5bfRtR98lC7PisrnPJG+azu8Ym+KtJGEPogzOwEut7Ekf45q7/aaCfuGLK6Vngmx /Ga3iVovNafi9xe46XyVQ3iNESNuLQc= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-177-CdrfMo8LO4qUoWXB2P3cDg-1; Fri, 24 Feb 2023 13:49:55 -0500 X-MC-Unique: CdrfMo8LO4qUoWXB2P3cDg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1F9FA1C05B00 for ; Fri, 24 Feb 2023 18:49:55 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.45.224.52]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4AAB140EBF6 for ; Fri, 24 Feb 2023 18:49:54 +0000 (UTC) From: Andrea Bolognani To: passt-dev@passt.top Subject: [PATCH 5/5] qrap: Generate -netdev as JSON Date: Fri, 24 Feb 2023 19:49:49 +0100 Message-Id: <20230224184949.518615-6-abologna@redhat.com> In-Reply-To: <20230224184949.518615-1-abologna@redhat.com> References: <20230224184949.518615-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: WY2EYJW5PPRAGM2HCK5CZACARGMBHXZK X-Message-ID-Hash: WY2EYJW5PPRAGM2HCK5CZACARGMBHXZK X-MailFrom: abologna@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: While generating -device as JSON when JSON is in use is mandatory, because not doing so can often prevent the VM from starting up, using JSON for -netdev simply makes things a bit nicer. No reason not to do it, though. Signed-off-by: Andrea Bolognani --- qrap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qrap.c b/qrap.c index 27c12ed..d0e2fb2 100644 --- a/qrap.c +++ b/qrap.c @@ -311,7 +311,11 @@ int main(int argc, char **argv) } qemu_argv[qemu_argc++] = "-netdev"; - qemu_argv[qemu_argc++] = "socket,fd=" STR(DEFAULT_FD) ",id=hostnet0"; + if (!has_json) { + qemu_argv[qemu_argc++] = "socket,fd=" STR(DEFAULT_FD) ",id=hostnet0"; + } else { + qemu_argv[qemu_argc++] = "{\"type\":\"socket\",\"fd\":\"" STR(DEFAULT_FD) "\",\"id\":\"hostnet0\"}"; + } qemu_argv[qemu_argc] = NULL; valid_args: -- 2.39.2