From nobody Mon Sep 8 07:36:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1753031226157587.6148809918323; Sun, 20 Jul 2025 10:07:06 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E3AED1280; Sun, 20 Jul 2025 13:07:04 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 8881B1268; Sun, 20 Jul 2025 13:06:47 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 35E8B1207; Sun, 20 Jul 2025 13:06:44 -0400 (EDT) Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 3ACAC11F2 for ; Sun, 20 Jul 2025 13:06:43 -0400 (EDT) Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-ae0de1c378fso535753066b.3 for ; Sun, 20 Jul 2025 10:06:43 -0700 (PDT) Received: from tulp.dynamic.ziggo.nl (80-115-115-199.cable.dynamic.v4.ziggo.nl. [80.115.115.199]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aec6caf7d06sm519128766b.161.2025.07.20.10.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Jul 2025 10:06:39 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753031201; x=1753636001; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Y0UV3tLV82QXcqmw8QEfj/FGEg0UvojCMQ61oPS/0UU=; b=hEdA+qKIAfygl+iKTHaTIqcNaCtkJtI7Z9b3pyXZhpBucno1kODiiRxfbK07BUhxT7 N1dj+ovYEKGNKL4ERCGz0K97j0jBSLxc9DghwYrT7IR4BlVQyRTo47vzagd+ZxLb+yKd tkKPcbCTqVRH4UQdpl7eFjuHrcRRU7HxIIj//D9JrBl/Y1RksSF+Em4VtYQkS3YIEhH5 jFLM94zfanUG9ZX3YjuLuNsdqhg3FAjoAsI1gU8EmEILI0R00BnBKhLXh9nPnys6FebD u4RRZ29o2gEzY56DyGTbRNuugpiu5a0BwWuHy1DjCy4km43nqym8CjdDaBbNeijOzPOe nHIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753031201; x=1753636001; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Y0UV3tLV82QXcqmw8QEfj/FGEg0UvojCMQ61oPS/0UU=; b=VfQ2sIw72opO/KablNQZYzRR6aJQZborw1ogNrU2MTd+TpbHvMCkGaKmpJroewqe5j ZKMywkwamBlFuoxsGC/JWQhtJXjDi2lApUByPcQnrdxu+BpE+cnGA55fwztP/H6PoM9f PXKtNDGLKGX2zGSNzD5q6ezqrNpx42Oajg/8T+/uTiwWhW44Zj6apx2NDeBRrqNF2kv3 TSZFOS5jYZxlMMBPddhMB0ci7D0FHvXOfgRUuLBXfu36CZqR/YfIUrO04SE81pbHmG61 meCaqmb8s7+sHBJi13NVLKRwgtU84P85i+AmMOuQmonA7ZV18wuw0ew2+gSLtRQz0InN 8HpA== X-Gm-Message-State: AOJu0YxEX9Mv+YKlWkWErJy4ylxfvNAPRgEgSEj1mYavye99WPLqwrIW HrPJtPk04WeT67cUyMDoa09K67kH5fjsdU2fhCqrWUvD3FcZu3n27batxiq4GQ0gdS0L9w== X-Gm-Gg: ASbGncsOJdbGx8fnH9dtmJVzv6dXbfyaeREOFcZSvhFzpa9CkQLvi65+mZsOlfutZBt K/zKrdAzuOhAYLpV37LKJffEkDrYBwy/YRGRpaToMiL2baqHRmdlgjJjqaXe8jAhoH3cju9Rzun wCowrNzviXfFS6pL3ZQAcxs565hHCq7kqng5l+ZJIrnuaY7jON3AjszmDS6vWcFZ8tMjbLOfjy7 IFtDLK2zkj/RdMGcOvZi29uf7SD38XoNDeHstdyw4F+2+s5uF6nTS1ClGLPPDjT3LGRefltS8Hf qNZ/zNLPQt3fnfJtqv9jE5yPc4LH7X7fbThjuGTSbjN9gy1VavJFxHV2OEUxDxHHiY6Bsjr5vBW yqRRjZu9Fb76WAdUlwjAXELaFtO3H8oqn8E/y7T9QX69C245vyjGAwxSjHpzUEqNaZ4P/FM836g 5UG9aK X-Google-Smtp-Source: AGHT+IHyaD+UWkZI3Ygd5apVISseZhsdrAW4WEFi8zHSD7cSx9uR9+xblEZ9JlzG9SYCdSNEJUjoRQ== X-Received: by 2002:a17:907:c1d:b0:ae3:f3ce:3269 with SMTP id a640c23a62f3a-ae9cde00354mr1897206766b.20.1753031200871; Sun, 20 Jul 2025 10:06:40 -0700 (PDT) From: Roman Bogorodskiy To: devel@lists.libvirt.org Subject: [PATCH] bhyve: don't reset domain autostart flag on destroy Date: Sun, 20 Jul 2025 19:04:14 +0200 Message-ID: <20250720170414.25710-1-bogorodskiy@gmail.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FNOLDZP6BLP3Z5XTAOWPGKMHF4W5HBXD X-Message-ID-Hash: FNOLDZP6BLP3Z5XTAOWPGKMHF4W5HBXD X-MailFrom: bogorodskiy@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Roman Bogorodskiy X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1753031228024116600 Content-Type: text/plain; charset="utf-8" Currently, virBhyveProcessStop() uses the virDomainDeleteConfig() helper to clean up domain status. It passes BHYVE_STATE_DIR as a configuration dir and NULL as autostart dir, so the helper does its job, even though it has a different purpose. However, the issue is that it also resets the autostart (and autostartOnce) property. This results in a situation that when a persistent domain with autostart enabled gets destroyed, its autostart state is reported as disabled, which is not correct. To fix that, implement the bhyveProcessRemoveDomainStatus() which removes the status file without side effects on the virDomainObj object. Signed-off-by: Roman Bogorodskiy Reviewed-by: Michal Privoznik --- src/bhyve/bhyve_process.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 5e77a9c4d6..79be6f7aba 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -427,6 +427,17 @@ virBhyveProcessStart(bhyveConn *driver, return virBhyveProcessStartImpl(driver, vm, reason); } =20 +static void +bhyveProcessRemoveDomainStatus(const char *statusDir, + const char *name) +{ + g_autofree char *file =3D virDomainConfigFile(statusDir, name); + + if (unlink(file) < 0 && errno !=3D ENOENT && errno !=3D ENOTDIR) + VIR_WARN("Failed to remove domain XML for %s: %s", + name, g_strerror(errno)); +} + int virBhyveProcessStop(struct _bhyveConn *driver, virDomainObj *vm, @@ -483,7 +494,7 @@ virBhyveProcessStop(struct _bhyveConn *driver, =20 cleanup: virPidFileDelete(BHYVE_STATE_DIR, vm->def->name); - virDomainDeleteConfig(BHYVE_STATE_DIR, NULL, vm); + bhyveProcessRemoveDomainStatus(BHYVE_STATE_DIR, vm->def->name); =20 return ret; } --=20 2.49.0