[Libguestfs] [PATCH] appliance: reorder the steps to search for appliance

Pavel Butsykin pbutsykin at virtuozzo.com
Tue Apr 25 11:35:26 UTC 2017


The patch changes the order of the steps to search for fixed/supermin
appliance in accordance with documentation:

"If the fixed appliance is found, libguestfs skips supermin entirely
 and just runs qemu with the kernel, initrd and root disk from the
 fixed appliance."

Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
---
 lib/appliance.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/lib/appliance.c b/lib/appliance.c
index f12918573..06ee06f71 100644
--- a/lib/appliance.c
+++ b/lib/appliance.c
@@ -137,16 +137,6 @@ build_appliance (guestfs_h *g,
   CLEANUP_FREE char *path = NULL;
 
   /* Step (1). */
-  r = find_path (g, contains_supermin_appliance, NULL, &supermin_path);
-  if (r == -1)
-    return -1;
-
-  if (r == 1)
-    /* Step (2): build supermin appliance. */
-    return build_supermin_appliance (g, supermin_path,
-                                     kernel, initrd, appliance);
-
-  /* Step (3). */
   r = find_path (g, contains_fixed_appliance, NULL, &path);
   if (r == -1)
     return -1;
@@ -162,7 +152,7 @@ build_appliance (guestfs_h *g,
     return 0;
   }
 
-  /* Step (4). */
+  /* Step (2). */
   r = find_path (g, contains_old_style_appliance, NULL, &path);
   if (r == -1)
     return -1;
@@ -177,6 +167,16 @@ build_appliance (guestfs_h *g,
     return 0;
   }
 
+  /* Step (3). */
+  r = find_path (g, contains_supermin_appliance, NULL, &supermin_path);
+  if (r == -1)
+    return -1;
+
+  if (r == 1)
+    /* Step (4): build supermin appliance. */
+    return build_supermin_appliance (g, supermin_path,
+                                     kernel, initrd, appliance);
+
   error (g, _("cannot find any suitable libguestfs supermin, fixed or old-style appliance on LIBGUESTFS_PATH (search path: %s)"),
          g->path);
   return -1;
-- 
2.11.0




More information about the Libguestfs mailing list