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

[PATCH v2 16/17] tools/init-dom0less: Configure already-introduced domains


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Wed, 16 Jul 2025 17:15:03 -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=ilFL7snKWKGO1xBaFJIr9eFBC74prAtQEcljgArVvrU=; b=wA6OUT7qqz/hsgSPLAiD/MQIySY6rEyPnn+mklcGXo1xiBW9DdHz3ZjiaSJVaCFT0jYExP19eXCbnc/gNETxAL7LbJ4Jin1pqnib5en9tYwzyJWDaVSk0hgidO0zeAqSxP3EZ/5wc7Fz96LlzLTq2nC9obi3OlZGUonSJMCKS0GW8IqBws9iprbTRll8nOw3vcBZOQ4K+FArIntP55x2LZc4q4jh23TlTPV0JaWCJtscsmcBoNRF2wsgy4pOO1ug4NAkys7y8/NOktNWe6ZXe50LigZF+UMxP8tNV8BGGKv/5HdDqjGimKNjE3G2VZIox85nFqQvZi46LLy8AAsjZQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uW2OKmxr/FpDa2PedIdD7mEA1FWwN7A/u7It7+4thaIiamVHpVDR9GTX8mEx5FWtrZFHABgurI4s79JkIASnwqMHs+S0gcIKvLcSNxgPRwFPSK4swe4Ba9wTZMsClSsOFn1m/5siqngQMuSwPtC1KhwuowQJLHaWZMUtFcQnC2baq2R3vYeTT+pBzwDhnpLOJSbKe8Tv5ugiHZhLuLcEx44EOvVh0tt+4Y/Pq3RZxfsf33XmkwEKiRRw+/7NYRptUbaRujsHEGZ13CL3WiVAKavxplNjFKqM+wBW1r9G3ZDVY0YQ4d03b+uHv498V99f8on3VRGxs9RBLTubqydbBQ==
  • Cc: Jason Andryuk <jason.andryuk@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Wed, 16 Jul 2025 21:22:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

With xenstore automatically introducing domains at startup, the
xs_is_domain_introduced() check is no longer accurate.  Instead, process
all domains and introduce non-introduced domains.  This writes the
xenstore entries and xl configuration for xenstore-enhanced domains as
those entries are still useful with an already-introduced domain.

Non-xenstore domains are still skipped.

While at it, remove domain_exists() which is just a simple wrapper.

Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
 tools/helpers/init-dom0less.c | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/tools/helpers/init-dom0less.c b/tools/helpers/init-dom0less.c
index 6ae7cf2e7e..4336e0f418 100644
--- a/tools/helpers/init-dom0less.c
+++ b/tools/helpers/init-dom0less.c
@@ -324,16 +324,14 @@ static int init_domain(struct xs_handle *xsh,
     if (rc)
         err(1, "writing to xenstore");
 
-    rc = xs_introduce_domain(xsh, info->domid, xenstore_pfn, xenstore_evtchn);
-    if (!rc)
-        err(1, "xs_introduce_domain");
-    return 0;
-}
+    if (!xs_is_domain_introduced(xsh, info->domid)) {
+        rc = xs_introduce_domain(xsh, info->domid, xenstore_pfn,
+                                 xenstore_evtchn);
+        if (!rc)
+            err(1, "xs_introduce_domain");
+    }
 
-/* Check if domain has been configured in XS */
-static bool domain_exists(struct xs_handle *xsh, int domid)
-{
-    return xs_is_domain_introduced(xsh, domid);
+    return 0;
 }
 
 int main(int argc, char **argv)
@@ -376,14 +374,10 @@ int main(int argc, char **argv)
             continue;
 
         printf("Checking domid: %u\n", domid);
-        if (!domain_exists(xsh, domid)) {
-            rc = init_domain(xsh, xch, xfh, &info[i]);
-            if (rc < 0) {
-                fprintf(stderr, "init_domain failed.\n");
-                goto out;
-            }
-        } else {
-            printf("Domain %u has already been initialized\n", domid);
+        rc = init_domain(xsh, xch, xfh, &info[i]);
+        if (rc < 0) {
+            fprintf(stderr, "init_domain failed.\n");
+            goto out;
         }
     }
 out:
-- 
2.50.0




 


Rackspace

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