From nobody Sun Feb 8 16:30:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1575933388; cv=none; d=zohomail.com; s=zohoarc; b=gqCqRlP2OYOlVEwEJ//3Y5vOJavsoUBjBsfYQ9mcspw9bvymSZwYajuHDarnFQdlt6in1+78OE9+xbnXUz72sDQUnsI93cD3Epr7Y4Vjs4coxbuoQ0KYvRnDYf34+pkF2cfZECKiWMTos22SBzZukVePQTqVJdvXmhJxvn5p+xE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575933388; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=z97LWt/6dZlWsoyS1muM9/2AgVUAmdfuXRiYG4fDhrc=; b=bWo+z2+7jJ52nOjnUR38fqtJJhS0LXEJbsRuJ1epDc7wNIAnlxFBFlvtQ8jWtr5RDKofe4V+op9rwyBMrgQiYlc802odt17BvKWNBjenHh61aRgl4ZGHtdZunripF/fpBzEhQmkVVB2LisI2SweHKfuM9CRDJAaXFTuXsWiXkyc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1575933388309362.59739624829035; Mon, 9 Dec 2019 15:16:28 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-220--5fN1xFGN0KA52etb9yVrQ-1; Mon, 09 Dec 2019 18:16:25 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 04EEE107ACC9; Mon, 9 Dec 2019 23:16:20 +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 BF5BB60C81; Mon, 9 Dec 2019 23:16:19 +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 669FA18034EB; Mon, 9 Dec 2019 23:16:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB9NGHvT008520 for ; Mon, 9 Dec 2019 18:16:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id F11252166B27; Mon, 9 Dec 2019 23:16:16 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EC6732166B29 for ; Mon, 9 Dec 2019 23:16:16 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D2B8690016A for ; Mon, 9 Dec 2019 23:16:16 +0000 (UTC) Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-410-j4s7TGOHP-GbnReFMIQ8DQ-1; Mon, 09 Dec 2019 18:16:12 -0500 Received: by mail-qt1-f193.google.com with SMTP id d5so964882qto.0; Mon, 09 Dec 2019 15:16:11 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:fe5:8243:c780:f073:3beb]) by smtp.gmail.com with ESMTPSA id e130sm352436qkb.72.2019.12.09.15.16.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 15:16:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575933387; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=z97LWt/6dZlWsoyS1muM9/2AgVUAmdfuXRiYG4fDhrc=; b=idnZrFT/vd0ng1oKTHbvCijarYWOICz0fplxz/MlY2RAOcReNA5PyhbZe/X64B4pVZdtGi BiHhovm43zblVHDgXZN6rz5zdLW0YjofV373J6FMvc1Ns1CmkNB7R6gxdM8eh2UCszwl43 ODtE/nXhisLDw3s8m/RxdwKNTADvf/E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z4tdJ+0nSKJUoiZbzJY2YN9vabkgqtWOG3/lj7BXNAM=; b=fv8YRqfu9wUacmNMfVfum/8YTpTYqOk4y+/PD4Es3p0Ii4TiiwFaDaLsLXLdxcduzH SrLF5rMxjBwG/QsWJTt8guEFB0kvOEn3g8XTevwjGxVCpAjR1Xv0F4AzNZdRAJak0CBr Cvg0d4bNMArfpj8F0tiFLL7MRmFES1oNZJZtuJ7OHaXM5fYLv43MCPAT155I0cZGhSvw zZP6aOKPTCgszaPm03ylAvkdRPzSuJ5EKAco4QocEjGseejulPQxxzbP3Yjw90nk9vdU wNbbtMOximw9Om8sLQYwF+bIS+mErCo6Lnocp8dyxq+8fcpfxF1vAQXgLnESBiTdDIQD ohYA== X-Gm-Message-State: APjAAAX4CjtKtxOu5XszwYd7gIbvFCbzbHPqnF6fVLWfqSfeMU5as6ZT sCBRxtxbL5h5YKvXNhkCJXnrAgOSQ7w= X-Google-Smtp-Source: APXvYqwBP/GdsBzajoZ/E5IZVkkKqlrafOtxzPubIf7TFLqkl0DbdsqFYcnXan63KlZDktm31nw8uw== X-Received: by 2002:ac8:5346:: with SMTP id d6mr28002353qto.49.1575933371367; Mon, 09 Dec 2019 15:16:11 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Mon, 9 Dec 2019 20:15:23 -0300 Message-Id: <20191209231531.2423222-19-danielhb413@gmail.com> In-Reply-To: <20191209231531.2423222-1-danielhb413@gmail.com> References: <20191209231531.2423222-1-danielhb413@gmail.com> MIME-Version: 1.0 X-MC-Unique: j4s7TGOHP-GbnReFMIQ8DQ-1 X-MC-Unique: -5fN1xFGN0KA52etb9yVrQ-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xB9NGHvT008520 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , crobinso@redhat.com Subject: [libvirt] [PATCH v1 18/26] qemu: move qemuBuildBootCommandLine validation to qemu_domain.c 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Move the boot validation being done by qemuBuildBootCommandLine() to to a new qemuDomainDefValidateBoot() function. This new function is called by qemuDomainDefValidate(), allowing boot validation in domain define time. Tests were adapted to consider the new caps being needed in this earlier stage. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 17 +---------------- src/qemu/qemu_domain.c | 29 +++++++++++++++++++++++++++++ tests/qemuxml2argvtest.c | 4 ++-- tests/qemuxml2xmltest.c | 6 +++--- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5c29ec897b..7d4272a896 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6293,28 +6293,13 @@ qemuBuildBootCommandLine(virCommandPtr cmd, } =20 if (def->os.bios.rt_set) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_REBOOT_TIMEOUT)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("reboot timeout is not supported " - "by this QEMU binary")); - return -1; - } - virBufferAsprintf(&boot_buf, "reboot-timeout=3D%d,", def->os.bios.rt_delay); } =20 - if (def->os.bm_timeout_set) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPLASH_TIMEOUT)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("splash timeout is not supported " - "by this QEMU binary")); - return -1; - } - + if (def->os.bm_timeout_set) virBufferAsprintf(&boot_buf, "splash-time=3D%u,", def->os.bm_timeo= ut); - } =20 if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOT_STRICT)) virBufferAddLit(&boot_buf, "strict=3Don,"); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a87f283f19..0c04ba9dcc 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5449,6 +5449,32 @@ qemuDomainDefValidatePM(const virDomainDef *def, } =20 =20 +static int +qemuDomainDefValidateBoot(const virDomainDef *def, + virQEMUCapsPtr qemuCaps) +{ + if (def->os.bios.rt_set) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_REBOOT_TIMEOUT)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("reboot timeout is not supported " + "by this QEMU binary")); + return -1; + } + } + + if (def->os.bm_timeout_set) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPLASH_TIMEOUT)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("splash timeout is not supported " + "by this QEMU binary")); + return -1; + } + } + + return 0; +} + + static int qemuDomainDefValidate(const virDomainDef *def, void *opaque) @@ -5547,6 +5573,9 @@ qemuDomainDefValidate(const virDomainDef *def, if (qemuDomainDefValidatePM(def, qemuCaps) < 0) goto cleanup; =20 + if (qemuDomainDefValidateBoot(def, qemuCaps) < 0) + goto cleanup; + /* QEMU 2.7 (detected via the availability of query-hotpluggable-cpus) * enforces stricter rules than previous versions when it comes to gue= st * CPU topology. Verify known constraints are respected */ diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 6f6585ba71..802ecc98f8 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -844,7 +844,7 @@ mymain(void) DO_TEST("boot-menu-enable", NONE); DO_TEST("boot-menu-enable-with-timeout", QEMU_CAPS_SPLASH_TIMEOUT); - DO_TEST_FAILURE("boot-menu-enable-with-timeout", NONE); + DO_TEST_PARSE_ERROR("boot-menu-enable-with-timeout", NONE); DO_TEST_PARSE_ERROR("boot-menu-enable-with-timeout-invalid", NONE); DO_TEST("boot-menu-disable", NONE); DO_TEST("boot-menu-disable-drive", NONE); @@ -860,7 +860,7 @@ mymain(void) =20 DO_TEST("reboot-timeout-disabled", QEMU_CAPS_REBOOT_TIMEOUT); DO_TEST("reboot-timeout-enabled", QEMU_CAPS_REBOOT_TIMEOUT); - DO_TEST_FAILURE("reboot-timeout-enabled", NONE); + DO_TEST_PARSE_ERROR("reboot-timeout-enabled", NONE); =20 DO_TEST("bios", QEMU_CAPS_DEVICE_ISA_SERIAL, diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 29d3a31e9f..ee76d50a41 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -251,13 +251,13 @@ mymain(void) QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI); DO_TEST("boot-multi", NONE); - DO_TEST("boot-menu-enable-with-timeout", NONE); + DO_TEST("boot-menu-enable-with-timeout", QEMU_CAPS_SPLASH_TIMEOUT); DO_TEST("boot-menu-disable", NONE); DO_TEST("boot-menu-disable-with-timeout", NONE); DO_TEST("boot-order", NONE); =20 - DO_TEST("reboot-timeout-enabled", NONE); - DO_TEST("reboot-timeout-disabled", NONE); + DO_TEST("reboot-timeout-enabled", QEMU_CAPS_REBOOT_TIMEOUT); + DO_TEST("reboot-timeout-disabled", QEMU_CAPS_REBOOT_TIMEOUT); =20 DO_TEST("clock-utc", NONE); DO_TEST("clock-localtime", NONE); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list