summaryrefslogtreecommitdiffstats
path: root/src/launch.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-07-23 18:56:20 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-07-23 20:17:24 +0100
commit3614d76b37ee8ef90f5a280e1bb51bccd87eaadb (patch)
treefcf80c1d1cee66100a7bb15c2dba319042bb0923 /src/launch.c
parenta6366f5dae0e8332cfdad0894aa6e5c7fc3faa2c (diff)
downloadlibguestfs-3614d76b37ee8ef90f5a280e1bb51bccd87eaadb.tar.gz
libguestfs-3614d76b37ee8ef90f5a280e1bb51bccd87eaadb.tar.xz
libguestfs-3614d76b37ee8ef90f5a280e1bb51bccd87eaadb.zip
tests: Move debug-drives testing API to launch.c and change the output.
It should work with any attach-method.
Diffstat (limited to 'src/launch.c')
-rw-r--r--src/launch.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/launch.c b/src/launch.c
index 02441db1..387c91f0 100644
--- a/src/launch.c
+++ b/src/launch.c
@@ -289,6 +289,37 @@ guestfs__config (guestfs_h *g,
return 0;
}
+/* Internal command to return the list of drives. */
+char **
+guestfs__debug_drives (guestfs_h *g)
+{
+ size_t i, count;
+ char **ret;
+ struct drive *drv;
+
+ for (count = 0, drv = g->drives; drv; count++, drv = drv->next)
+ ;
+
+ ret = safe_malloc (g, sizeof (char *) * (count + 1));
+
+ for (i = 0, drv = g->drives; drv; i++, drv = drv->next) {
+ ret[i] = safe_asprintf (g, "path=%s%s%s%s%s%s%s%s%s",
+ drv->path,
+ drv->readonly ? " readonly" : "",
+ drv->format ? " format=" : "",
+ drv->format ? : "",
+ drv->iface ? " iface=" : "",
+ drv->iface ? : "",
+ drv->name ? " name=" : "",
+ drv->name ? : "",
+ drv->use_cache_none ? " cache=none" : "");
+ }
+
+ ret[count] = NULL;
+
+ return ret; /* caller frees */
+}
+
int
guestfs__launch (guestfs_h *g)
{