summaryrefslogtreecommitdiffstats
path: root/fish
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-01-28 19:25:02 +0000
committerRichard W.M. Jones <rjones@redhat.com>2011-02-03 18:50:45 +0000
commita20e5c00c35490fa29668630113a01240a69b701 (patch)
tree18b2ae239bc64d2a5f48aea73242057de1552845 /fish
parent2020eded8a3f381c722abe001be8000723ff2418 (diff)
downloadlibguestfs-a20e5c00c35490fa29668630113a01240a69b701.tar.gz
libguestfs-a20e5c00c35490fa29668630113a01240a69b701.tar.xz
libguestfs-a20e5c00c35490fa29668630113a01240a69b701.zip
fish: Add guestfish --live, guestmount --live options.
The other programs have the variable, but the flag is not enabled either because it doesn't make sense or because the implications are not well understood.
Diffstat (limited to 'fish')
-rw-r--r--fish/fish.c5
-rw-r--r--fish/guestfish.pod5
-rw-r--r--fish/inspect.c6
-rw-r--r--fish/options.h1
-rw-r--r--fish/virt.c4
5 files changed, 21 insertions, 0 deletions
diff --git a/fish/fish.c b/fish/fish.c
index eb7c8fe8..b62c0988 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -74,6 +74,7 @@ static int override_progress_bars = -1;
guestfs_h *g;
int read_only = 0;
+int live = 0;
int quit = 0;
int verbose = 0;
int remote_control_listen = 0;
@@ -124,6 +125,7 @@ usage (int status)
" -i|--inspector Automatically mount filesystems\n"
" --keys-from-stdin Read passphrases from stdin\n"
" --listen Listen for remote commands\n"
+ " --live Connect to a live virtual machine\n"
" -m|--mount dev[:mnt] Mount dev on mnt (if omitted, /)\n"
" -n|--no-sync Don't autosync\n"
" -N|--new type Create prepared disk (test1.img, ...)\n"
@@ -173,6 +175,7 @@ main (int argc, char *argv[])
{ "inspector", 0, 0, 'i' },
{ "keys-from-stdin", 0, 0, 0 },
{ "listen", 0, 0, 0 },
+ { "live", 0, 0, 0 },
{ "mount", 1, 0, 'm' },
{ "new", 1, 0, 'N' },
{ "no-dest-paths", 0, 0, 'D' },
@@ -277,6 +280,8 @@ main (int argc, char *argv[])
format = optarg;
} else if (STREQ (long_options[option_index].name, "csh")) {
remote_control_csh = 1;
+ } else if (STREQ (long_options[option_index].name, "live")) {
+ live = 1;
} else {
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
program_name, long_options[option_index].name, option_index);
diff --git a/fish/guestfish.pod b/fish/guestfish.pod
index 0f318f04..abf6d7ac 100644
--- a/fish/guestfish.pod
+++ b/fish/guestfish.pod
@@ -294,6 +294,11 @@ to try to read passphrases from the user by opening C</dev/tty>.
Fork into the background and listen for remote commands. See section
L</REMOTE CONTROL GUESTFISH OVER A SOCKET> below.
+=item B<--live>
+
+Connect to a live virtual machine.
+(Experimental, see L<guestfs(3)/ATTACHING TO RUNNING DAEMONS>).
+
=item B<-m dev[:mountpoint]>
=item B<--mount dev[:mountpoint]>
diff --git a/fish/inspect.c b/fish/inspect.c
index 713501e9..5e1948cd 100644
--- a/fish/inspect.c
+++ b/fish/inspect.c
@@ -73,6 +73,12 @@ compare_keys (const void *p1, const void *p2)
void
inspect_mount (void)
{
+ if (live) {
+ fprintf (stderr, _("%s: don't use --live and -i options together\n"),
+ program_name);
+ exit (EXIT_FAILURE);
+ }
+
inspect_do_decrypt ();
char **roots = guestfs_inspect_os (g);
diff --git a/fish/options.h b/fish/options.h
index 728df04a..b755d906 100644
--- a/fish/options.h
+++ b/fish/options.h
@@ -67,6 +67,7 @@
/* Provided by guestfish or guestmount. */
extern guestfs_h *g;
extern int read_only;
+extern int live;
extern int verbose;
extern int inspector;
extern int keys_from_stdin;
diff --git a/fish/virt.c b/fish/virt.c
index 13a6d127..b14cee2b 100644
--- a/fish/virt.c
+++ b/fish/virt.c
@@ -43,6 +43,10 @@ add_libvirt_drives (const char *guest)
optargs.bitmask |= GUESTFS_ADD_DOMAIN_READONLY_BITMASK;
optargs.readonly = 1;
}
+ if (live) {
+ optargs.bitmask |= GUESTFS_ADD_DOMAIN_LIVE_BITMASK;
+ optargs.live = 1;
+ }
return guestfs_add_domain_argv (g, guest, &optargs);
}