[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3 4/8] tools/init-dom0less: Switch domain_exists to check xenstore name


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Tue, 26 Aug 2025 17:08:43 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uzDGiHAVkJNpJC5uvjQt5odWyjWh55jkKFPNsbwPekg=; b=ndekwmTYHOg/DI7VZ+4Zk8etT6nJpanzWfiQ4TaFZ7UIghxNrTX7u2gsVhnTzYlxF50+Glx+tAQfkEgNEIIOq9jNtaa5bTTRVCf2LLJDYkbYe6p8852dL+Z+XdyIphb0WX64sJq3oSU74QoYgWzwb8imsDuim+WhsmjMb8Tfh+xmum1gOhLzL62nTLpUFlsLXKIm/KhXyxYoy4Ug+Q9ZvfoveHz74VVfC98wbBJk8A44T6fLBoQ25m7YocGd9sihQlT9VLaA9NaGGpmT6WahiVbcqZEwHDMyz6W8WgfvSf7pwl36852cj3dXNBgAiJjl33iXMDtnGm03jho0ZGIOHA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nrmole8tNjK5U2NTpcnCCBcoVgfG9yQAj1ennxuw9MT/+Bv1iceWuzeWailhyMN9hP1z49Jhp9JUeu6+UBEugFySD1HNNaTzjEcGhzFKC0YcPbu1pMfpTN3jiYDmkHFWekwcUDlSIMhJuEBkdZFZccmoniIpOZGOvT8l3L+KoN0We+bPRvjQcabWumJLMNgXIvfXUiZ6Li+JehlHo5S+WK0XBaKsue7Cblc1MhY7Iblr292eXVnXl6HENwQd/PwGUpMsk5g3qcPVelAc3gjy+YyAkLlqX9gWGzYDzjknDPtTow4g4gzOd60XKcFUD18TOiCVICAb/yZRLqtzgbLDNQ==
  • Cc: Jason Andryuk <jason.andryuk@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Tue, 26 Aug 2025 21:09:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Previously, the xenstore "introduced" state was used to avoid running
init-dom0less twice on the same domain.  With xenstored
auto-introduction, that can no longer be used.  Instead check of the
domain's name has been set and use that to determine whether or not to
bail out.

Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
v3:
Move xenstore reading into domain_exists()
Reorder
---
 tools/helpers/init-dom0less.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/tools/helpers/init-dom0less.c b/tools/helpers/init-dom0less.c
index 3906c4b61a..eb793c7aab 100644
--- a/tools/helpers/init-dom0less.c
+++ b/tools/helpers/init-dom0less.c
@@ -60,6 +60,19 @@ static int get_xs_page(libxl_dominfo *info, uint64_t 
*xenstore_pfn)
     return 0;
 }
 
+static char *do_xs_read_dom(struct xs_handle *xsh, xs_transaction_t t,
+                            domid_t domid, char *path)
+{
+    char full_path[STR_MAX_LENGTH];
+    int rc;
+
+    rc = snprintf(full_path, STR_MAX_LENGTH,
+                  "/local/domain/%u/%s", domid, path);
+    if (rc < 0 || rc >= STR_MAX_LENGTH)
+        return NULL;
+    return xs_read(xsh, t, full_path, NULL);
+}
+
 static bool do_xs_write_dom(struct xs_handle *xsh, xs_transaction_t t,
                             domid_t domid, char *path, char *val)
 {
@@ -332,7 +345,13 @@ static int init_domain(libxl_dominfo *info)
 /* Check if domain has been configured in XS */
 static bool domain_exists(int domid)
 {
-    return xs_is_domain_introduced(xsh, domid);
+    char *name = do_xs_read_dom(xsh, XBT_NULL, domid, "name");
+    if (name) {
+        free(name);
+        return true;
+    }
+
+    return false;
 }
 
 int main(int argc, char **argv)
-- 
2.50.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.