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.andr...@amd.com>
---
 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


Reply via email to