summaryrefslogtreecommitdiffstats
path: root/src/guestfs.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-07-19 15:32:03 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-07-21 15:47:50 +0100
commit42ba2620031d4b52e5319e212c2ea96d80a93b52 (patch)
tree43ed01efe9ac0223a7a7b6330864348ce7dda0dd /src/guestfs.c
parentf32b93416a9579feb1af19540c3c04924290f131 (diff)
downloadlibguestfs-42ba2620031d4b52e5319e212c2ea96d80a93b52.tar.gz
libguestfs-42ba2620031d4b52e5319e212c2ea96d80a93b52.tar.xz
libguestfs-42ba2620031d4b52e5319e212c2ea96d80a93b52.zip
Add attach-method "libvirt" or "libvirt:<URI>".
With this commit, you can set the attach method to libvirt, but calling launch will give an error.
Diffstat (limited to 'src/guestfs.c')
-rw-r--r--src/guestfs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/guestfs.c b/src/guestfs.c
index e848ff83..e13dd9fa 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -746,6 +746,16 @@ guestfs__set_attach_method (guestfs_h *g, const char *method)
free (g->attach_method_arg);
g->attach_method_arg = NULL;
}
+ else if (STREQ (method, "libvirt")) {
+ g->attach_method = ATTACH_METHOD_LIBVIRT;
+ free (g->attach_method_arg);
+ g->attach_method_arg = NULL;
+ }
+ else if (STRPREFIX (method, "libvirt:") && strlen (method) > 8) {
+ g->attach_method = ATTACH_METHOD_LIBVIRT;
+ free (g->attach_method_arg);
+ g->attach_method_arg = safe_strdup (g, method + 8);
+ }
else if (STRPREFIX (method, "unix:") && strlen (method) > 5) {
g->attach_method = ATTACH_METHOD_UNIX;
free (g->attach_method_arg);
@@ -770,6 +780,13 @@ guestfs__get_attach_method (guestfs_h *g)
ret = safe_strdup (g, "appliance");
break;
+ case ATTACH_METHOD_LIBVIRT:
+ if (g->attach_method_arg == NULL)
+ ret = safe_strdup (g, "libvirt");
+ else
+ ret = safe_asprintf (g, "libvirt:%s", g->attach_method_arg);
+ break;
+
case ATTACH_METHOD_UNIX:
ret = safe_asprintf (g, "unix:%s", g->attach_method_arg);
break;