From nobody Sun May 5 04:00:25 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com 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 1625622315735735.8684236832288; Tue, 6 Jul 2021 18:45:15 -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-349-Er_urBnPMlSvN0vcSSbFRQ-1; Tue, 06 Jul 2021 21:45:11 -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 5D7778015F5; Wed, 7 Jul 2021 01:45:04 +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 2EC4A60843; Wed, 7 Jul 2021 01:45:01 +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 780421809C99; Wed, 7 Jul 2021 01:44:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1671iqnY006048 for ; Tue, 6 Jul 2021 21:44:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6DC5F53D9; Wed, 7 Jul 2021 01:44:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 681B353A4 for ; Wed, 7 Jul 2021 01:44:49 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C074805F49 for ; Wed, 7 Jul 2021 01:44:49 +0000 (UTC) Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-438-eIw1MVddNFiaI4farCHhDQ-1; Tue, 06 Jul 2021 21:44:47 -0400 Received: by mail-qv1-f51.google.com with SMTP id g14so314548qvo.7 for ; Tue, 06 Jul 2021 18:44:47 -0700 (PDT) Received: from localhost (209-6-122-159.s2973.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [209.6.122.159]) by smtp.gmail.com with UTF8SMTPSA id a6sm4825394qtw.53.2021.07.06.18.44.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jul 2021 18:44:46 -0700 (PDT) X-MC-Unique: Er_urBnPMlSvN0vcSSbFRQ-1 X-MC-Unique: eIw1MVddNFiaI4farCHhDQ-1 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:mime-version :content-transfer-encoding; bh=D0iHGF9m3Oh4CYOmiRwfY3ZnzLVgcGCI/0JkpA5ybR0=; b=dymFyNOZUPopx5EQNC8XyOWbyHpp5u4Zdzp5dioP0h4U7pCuup9alaIKMK6mBwuith F5fPNW4om78LMC0p+ZHhYtJvabSmSj1YUCRtDekHMqJZNp7JK6SyFi0uxCeDc1t5fDhw 0YAI2NT60Z3yjdweEGnaD385Aj7cGJIbsXZVMah1hdNPsAwsTsvVm5g0QEjmfHsSMfBj 3HlwxaN5SL1FlkEAS4qK73kYpPp56RcUu2o938iyVP5dtg7PD0K7YCj/MK0vsHDymwn0 DZXFcJKdzO1KoDwnLCPo+QCZFt8wGXsZSpLGVTteritsdvz9t9eTn+yKjl6CsQ0aUhke iJqg== X-Gm-Message-State: AOAM533vG89G7ddA1g3Nm+FxPwrFPBqK9bk2T+fe6vlK4pOPydAfD7jp xajadXWvTBaFcROiPsHYesVQPmJgZg== X-Google-Smtp-Source: ABdhPJxn6+9/KHV4l8Fffzlzjlu6zpe2IwTSsThhEZKFuEl/PkSgPf4DHKfkQaEtK6OtT5G/zmtphw== X-Received: by 2002:a0c:e481:: with SMTP id n1mr943130qvl.49.1625622286729; Tue, 06 Jul 2021 18:44:46 -0700 (PDT) From: Masayoshi Mizuma To: libvir-list@redhat.com Subject: [PATCH] qemuProcessSetupDisksTransientHotplug: skip system_reset when the all disks have transient shareBacking option Date: Tue, 6 Jul 2021 21:44:34 -0400 Message-Id: <20210707014434.21634-1-msys.mizuma@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Masayoshi Mizuma , Masayoshi Mizuma 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-ZM-MESSAGEID: 1625622317653100001 Content-Type: text/plain; charset="utf-8" From: Masayoshi Mizuma When both destroy and is set to the domain xml, the guest doesn't start. # virsh start Guest error: Failed to start domain 'Guest' error: internal error: qemu unexpectedly closed the monitor # That's because libvirt does system_reset qmp command when=20 is set, and the qemu is launched with '-no-reboot' option, so system_reset goes to shutdown. The boot order issue happens only if the guest has not only the transient share backing disks but also disks which isn't set the option. Let's skip system_reset when the all disks has the option. Signed-off-by: Masayoshi Mizuma --- src/qemu/qemu_process.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 2b03b0ab98..82dba64e21 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7058,7 +7058,8 @@ qemuProcessSetupDisksTransientHotplug(virDomainObj *v= m, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv =3D vm->privateData; - bool hasHotpluggedDisk =3D false; + bool needReset =3D true; + size_t attached =3D 0; size_t i; =20 for (i =3D 0; i < vm->def->ndisks; i++) { @@ -7071,12 +7072,24 @@ qemuProcessSetupDisksTransientHotplug(virDomainObj = *vm, if (qemuDomainAttachDiskGeneric(priv->driver, vm, domdisk, asyncJo= b) < 0) return -1; =20 - hasHotpluggedDisk =3D true; + attached++; + } + + /* system_reset is needed in case the domain also has the other disks = (doesn't + * have option) to fix the boot orde= r. */ + if (!attached || vm->def->ndisks =3D=3D attached) + needReset =3D false; + + if (needReset && priv->allowReboot =3D=3D VIR_TRISTATE_BOOL_NO) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Doesn't support this configuration. " + "Change the domain xml to allow rebooting the gue= st.")); + return -1; } =20 /* in order to allow booting from such disks we need to issue a system= -reset * so that the firmware tables recording bootable devices are regerate= d */ - if (hasHotpluggedDisk) { + if (needReset) { int rc; =20 if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) --=20 2.27.0