Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit 2e36adf83ce4a9cbccd313d6f3a88b5c5973ce44 1 parent 6fdf1f4
@rwmjones rwmjones authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 rescue/virt-rescue.c
View
16 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);
Please sign in to comment.
Something went wrong with that request. Please try again.