From nobody Mon Feb 9 09:15:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633622603; cv=none; d=zohomail.com; s=zohoarc; b=M+QpfsQOWISo5IgYzjIxeUDtqNnPazmpsny9dV6+ZaAqipi1soTnL6GIZFM3M5mLSyh92KVttd+WmNttYcUxaTcP6n0gI+qJMRP/JnzLa2ZEoFnfvjuK0itzgI2Nxu2BLkqUWH6pMUuu8gH4KeQr95BCS/eiG8OHcAT7f2VORT0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633622603; h=Content-Type:Content-Transfer-Encoding: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=CLb8ophlFTSSzAnG6EM7EQ6zYDqApOBdLB7PsQKSmDc=; b=oEq40QEkzEpFcwxb3OyCTte1G4rqZlYaDeaVjXA2dAKI0LfYFfq+Hw8MMKIVGGJEzZ+YkrKcRwcIPGVLw06ThhjcXZM5fTcya7LSndN0n1RJ87e5V22pL0sh7U2pRevdaiqQ+vIIV2ZMSck0ZwnUzgFnDblqOYuJC9s4uAmceV0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633622603096360.9199890705113; Thu, 7 Oct 2021 09:03:23 -0700 (PDT) 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-473-Hz5z4FBEMAii80B-OO10wA-1; Thu, 07 Oct 2021 12:03:20 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 713B415EBA43; Thu, 7 Oct 2021 15:45:53 +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 2C46F2AA3EC; Thu, 7 Oct 2021 15:45: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 E86A81806D01; Thu, 7 Oct 2021 15:45:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 197FJOXm023956 for ; Thu, 7 Oct 2021 11:19:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9570B5F4F1; Thu, 7 Oct 2021 15:19:24 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD4505F4EE for ; Thu, 7 Oct 2021 15:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633622602; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=CLb8ophlFTSSzAnG6EM7EQ6zYDqApOBdLB7PsQKSmDc=; b=eKL16rZR1NCZ/KOCUKkJmR1yeZg6/RQb6ayLsAkfsdsXVAk+CzxD4HFDjBxIbO8AAy5DoJ lc3Rzse09u0aVt/UhdahORwFLVGm2jcp+6XbevjSmigGmyRGjSoEUFDtxefURI3ihGMM4m Cga9KmKwaxihTZzbYMCTWYJXcDArY9A= X-MC-Unique: Hz5z4FBEMAii80B-OO10wA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 045/103] conf: Introduce 'effectiveBootIndex' into 'virDomainDeviceInfo' Date: Thu, 7 Oct 2021 17:17:33 +0200 Message-Id: <716db07e68b55cdadb89c6ec640628c60b24d077.1633619630.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633622604090100001 Content-Type: text/plain; charset="utf-8" 'effectiveBootIndex' is a copy of 'bootIndex' if ' without being visible in the XML. QEMU driver had a internal implementation for disks, which is now replaced. Additionally this will simplify a refactor of network boot assignment. Signed-off-by: Peter Krempa --- src/conf/device_conf.h | 4 ++++ src/conf/domain_conf.c | 2 ++ src/qemu/qemu_command.c | 10 ++++------ src/qemu/qemu_domain.h | 4 ---- src/qemu/qemu_process.c | 15 ++++++--------- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h index 09ef5dda92..d118966379 100644 --- a/src/conf/device_conf.h +++ b/src/conf/device_conf.h @@ -149,6 +149,10 @@ struct _virDomainDeviceInfo { /* bootIndex is only used for disk, network interface, hostdev * and redirdev devices */ unsigned int bootIndex; + /* 'effectiveBootIndex' is same as 'bootIndex' (if provided in the XML= ) but + * not formatted back. This allows HV drivers to update it if bootIndex) < 0) return -1; + info->effectiveBootIndex =3D info->bootIndex; + loadparm =3D virXMLPropString(node, "loadparm"); if (loadparm) { if (virStringToUpper(&info->loadparm, loadparm) !=3D 1) { diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index dc3320ba9a..07a8f104f4 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1862,7 +1862,6 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, virDomainDiskDef *disk, virQEMUCaps *qemuCaps) { - qemuDomainDiskPrivate *diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); g_auto(virBuffer) opt =3D VIR_BUFFER_INITIALIZER; const char *contAlias; g_autofree char *backendAlias =3D NULL; @@ -2065,8 +2064,8 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, virBufferAsprintf(&opt, ",id=3D%s", disk->info.alias); /* bootindex for floppies is configured via the fdc controller */ if (disk->device !=3D VIR_DOMAIN_DISK_DEVICE_FLOPPY && - diskPriv->effectiveBootindex > 0) - virBufferAsprintf(&opt, ",bootindex=3D%u", diskPriv->effectiveBoot= index); + disk->info.effectiveBootIndex > 0) + virBufferAsprintf(&opt, ",bootindex=3D%u", disk->info.effectiveBoo= tIndex); if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKIO)) { if (disk->blockio.logical_block_size > 0) virBufferAsprintf(&opt, ",logical_block_size=3D%u", @@ -2180,7 +2179,6 @@ qemuBuildFloppyCommandLineControllerOptions(virComman= d *cmd, g_autofree char *backendStr =3D NULL; g_autofree char *bootindexStr =3D NULL; virDomainDiskDef *disk =3D def->disks[i]; - qemuDomainDiskPrivate *diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); if (disk->bus !=3D VIR_DOMAIN_DISK_BUS_FDC) continue; @@ -2192,9 +2190,9 @@ qemuBuildFloppyCommandLineControllerOptions(virComman= d *cmd, else driveLetter =3D 'A'; - if (diskPriv->effectiveBootindex > 0) + if (disk->info.effectiveBootIndex > 0) bootindexStr =3D g_strdup_printf("bootindex%c=3D%u", driveLett= er, - diskPriv->effectiveBootindex); + disk->info.effectiveBootIndex); /* with -blockdev we setup the floppy device and it's backend with= -device */ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 31971e29ac..9cf5d5479e 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -270,10 +270,6 @@ struct _qemuDomainDiskPrivate { char *qomName; /* QOM path of the disk (also refers to the block backe= nd) */ char *nodeCopyOnRead; /* nodename of the disk-wide copy-on-read blockd= ev layer */ - unsigned int effectiveBootindex; /* boot index of the disk based on one - of the two ways we use to select a= boot - device */ - bool transientOverlayCreated; /* the overlay image of a transient disk= was created and the definition was update= d */ }; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 09a2ff8ef2..f5c28ed4bf 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6271,6 +6271,9 @@ qemuProcessPrepareDomainDiskBootorder(virDomainDef *d= ef) unsigned int bootFloppy =3D 0; unsigned int bootDisk =3D 0; + if (def->os.nBootDevs =3D=3D 0) + return; + for (i =3D 0; i < def->os.nBootDevs; i++) { switch ((virDomainBootOrder) def->os.bootDevs[i]) { case VIR_DOMAIN_BOOT_CDROM: @@ -6295,27 +6298,21 @@ qemuProcessPrepareDomainDiskBootorder(virDomainDef = *def) for (i =3D 0; i < def->ndisks; i++) { virDomainDiskDef *disk =3D def->disks[i]; - qemuDomainDiskPrivate *diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); - - if (disk->info.bootIndex > 0) { - diskPriv->effectiveBootindex =3D disk->info.bootIndex; - continue; - } switch (disk->device) { case VIR_DOMAIN_DISK_DEVICE_CDROM: - diskPriv->effectiveBootindex =3D bootCD; + disk->info.effectiveBootIndex =3D bootCD; bootCD =3D 0; break; case VIR_DOMAIN_DISK_DEVICE_DISK: case VIR_DOMAIN_DISK_DEVICE_LUN: - diskPriv->effectiveBootindex =3D bootDisk; + disk->info.effectiveBootIndex =3D bootDisk; bootDisk =3D 0; break; case VIR_DOMAIN_DISK_DEVICE_FLOPPY: - diskPriv->effectiveBootindex =3D bootFloppy; + disk->info.effectiveBootIndex =3D bootFloppy; bootFloppy =3D 0; break; --=20 2.31.1