diff options
-rwxr-xr-x | fish/test-add-domain.sh | 6 | ||||
-rwxr-xr-x | fish/test-d.sh | 8 | ||||
-rw-r--r-- | src/launch-appliance.c | 21 | ||||
-rw-r--r-- | src/launch.c | 31 |
4 files changed, 38 insertions, 28 deletions
diff --git a/fish/test-add-domain.sh b/fish/test-add-domain.sh index 749f3bcd..9548fa1e 100755 --- a/fish/test-add-domain.sh +++ b/fish/test-add-domain.sh @@ -69,10 +69,10 @@ EOF domain guest libvirturi:test://$cwd/test.xml readonly:true debug-drives EOF -grep -sq "test1.img.*snapshot=on" test.out +grep -sq "test1.img readonly" test.out ! grep -sq "test1.img.*format" test.out -grep -sq "test2.img.*snapshot=on.*format=raw" test.out -grep -sq "test3.img.*snapshot=on.*format=qcow2" test.out +grep -sq "test2.img readonly format=raw" test.out +grep -sq "test3.img readonly format=qcow2" test.out # Test readonlydisk = "ignore". ./guestfish >test.out <<EOF diff --git a/fish/test-d.sh b/fish/test-d.sh index 104b8f3b..eb19b518 100755 --- a/fish/test-d.sh +++ b/fish/test-d.sh @@ -67,10 +67,10 @@ EOF ./guestfish -c "test://$cwd/test.xml" --ro -d guest \ debug-drives </dev/null >test.out -grep -sq "test1.img.*snapshot=on" test.out +grep -sq "test1.img readonly" test.out ! grep -sq "test1.img.*format" test.out -grep -sq "test2.img.*snapshot=on.*format=raw" test.out -grep -sq "test3.img.*snapshot=on.*format=qcow2" test.out -grep -sq "test4.img.*snapshot=on.*format=raw" test.out +grep -sq "test2.img readonly format=raw" test.out +grep -sq "test3.img readonly format=qcow2" test.out +grep -sq "test4.img readonly format=raw" test.out rm -f test1.img test2.img test3.img test4.img test.xml test.out diff --git a/src/launch-appliance.c b/src/launch-appliance.c index efc12844..815666fe 100644 --- a/src/launch-appliance.c +++ b/src/launch-appliance.c @@ -1030,27 +1030,6 @@ guestfs__get_pid (guestfs_h *g) } } -/* 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] = qemu_drive_param (g, drv, i); - - ret[count] = NULL; - - return ret; /* caller frees */ -} - /* Maximum number of disks. */ int guestfs__max_disks (guestfs_h *g) 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) { |