summaryrefslogtreecommitdiffstats
path: root/rescue
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-09-04 12:04:31 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-09-04 12:04:31 +0100
commit2e36adf83ce4a9cbccd313d6f3a88b5c5973ce44 (patch)
treeb3eb152102e3cf6551d77793f54ab998354adc8b /rescue
parent6fdf1f40fa85d2e6e7a1118f4cfa532ea9831b89 (diff)
downloadlibguestfs-2e36adf83ce4a9cbccd313d6f3a88b5c5973ce44.tar.gz
libguestfs-2e36adf83ce4a9cbccd313d6f3a88b5c5973ce44.tar.xz
libguestfs-2e36adf83ce4a9cbccd313d6f3a88b5c5973ce44.zip
rescue: If attach-method is 'libvirt', force it to be 'appliance'.
The libvirt backend currently doesn't support direct mode. We should make that work in future. As a workaround, force the attach-method to be 'appliance' in this case.
Diffstat (limited to 'rescue')
-rw-r--r--rescue/virt-rescue.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/rescue/virt-rescue.c b/rescue/virt-rescue.c
index 6bfa6085..f9142e82 100644
--- a/rescue/virt-rescue.c
+++ b/rescue/virt-rescue.c
@@ -139,6 +139,7 @@ main (int argc, char *argv[])
int memsize = 0;
int smp = 0;
int suggest = 0;
+ char *attach_method;
g = guestfs_create ();
if (g == NULL) {
@@ -313,6 +314,21 @@ main (int argc, char *argv[])
/* Setting "direct mode" is required for the rescue appliance. */
guestfs_set_direct (g, 1);
+ /* The libvirt backend doesn't support direct mode. As a temporary
+ * workaround, force the appliance backend, but warn about it.
+ */
+ attach_method = guestfs_get_attach_method (g);
+ if (attach_method) {
+ if (STREQ (attach_method, "libvirt") ||
+ STRPREFIX (attach_method, "libvirt:")) {
+ fprintf (stderr, _("%s: warning: virt-rescue doesn't work with the libvirt backend\n"
+ "at the moment. As a workaround, forcing attach-method = 'appliance'.\n"),
+ program_name);
+ guestfs_set_attach_method (g, "appliance");
+ }
+ free (attach_method);
+ }
+
/* Set other features. */
if (memsize > 0)
guestfs_set_memsize (g, memsize);