[PATCH] fish: Add --rw option (does nothing yet).
This patch is meant for discussion of the issues involved. I'd like to change the default for guestfish -a / -m command line options to open read-only. This creates less opportunity to corrupt disk images by opening them for write while another VM might be using them. With this patch you can specify: guestfish --rw ... which in itself does nothing since the default is currently read/write anyway. But it allows us in future to add a configuration file that controls the default ("default" being the case where you use guestfish or guestmount with neither --ro nor --rw options). We can then change the configuration file in 1.8 to make read-only the default. By backporting this patch to the other stable branches we can start introducing scripts that use 'guestfish --rw' in readiness for a future change to the default. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
On 11/08/2010 12:02 PM, Richard W.M. Jones wrote:
From 2c4a7ef92a4583a1217213573ad406eb5d745990 Mon Sep 17 00:00:00 2001 From: Richard W.M. Jones<rjones@redhat.com> Date: Fri, 5 Nov 2010 18:36:02 +0000 Subject: [PATCH] fish: Add --rw option (does nothing yet).
This adds the guestfish --rw option, intended in future to be required for writing to disk images.
At the moment this does not change the default and so does nothing. This patch is intended for backporting to the stable branches so that we can start to introduce scripts which use 'guestfish --rw'. --- fish/fish.c | 7 ++++++- fish/guestfish.pod | 46 ++++++++++++++++++++++++++++++++++++++++------ fish/options.h | 7 +++++++ fuse/guestmount.c | 7 ++++++- fuse/guestmount.pod | 7 +++++++ 5 files changed, 66 insertions(+), 8 deletions(-)
--- a/fish/options.h +++ b/fish/options.h @@ -185,6 +185,13 @@ extern int add_libvirt_drives (const char *guest); exit (EXIT_SUCCESS); \ }
+#define OPTION_w \ + if (read_only) { \ + fprintf (stderr, _("%s: cannot mix --ro and --rw options\n"), \ + program_name); \ + exit (EXIT_FAILURE); \ + } +
This will display an error if the user does: guestfish --ro --rw but not: guestfish --rw --ro
#define OPTION_x \ guestfs_set_trace (g, 1)
Otherwise, it looks fine. Matt -- Matthew Booth, RHCA, RHCSS Red Hat Engineering, Virtualisation Team GPG ID: D33C3490 GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
On Mon, Nov 08, 2010 at 12:39:48PM +0000, Matthew Booth wrote:
On 11/08/2010 12:02 PM, Richard W.M. Jones wrote:
From 2c4a7ef92a4583a1217213573ad406eb5d745990 Mon Sep 17 00:00:00 2001 From: Richard W.M. Jones<rjones@redhat.com> Date: Fri, 5 Nov 2010 18:36:02 +0000 Subject: [PATCH] fish: Add --rw option (does nothing yet).
This adds the guestfish --rw option, intended in future to be required for writing to disk images.
At the moment this does not change the default and so does nothing. This patch is intended for backporting to the stable branches so that we can start to introduce scripts which use 'guestfish --rw'. --- fish/fish.c | 7 ++++++- fish/guestfish.pod | 46 ++++++++++++++++++++++++++++++++++++++++------ fish/options.h | 7 +++++++ fuse/guestmount.c | 7 ++++++- fuse/guestmount.pod | 7 +++++++ 5 files changed, 66 insertions(+), 8 deletions(-)
--- a/fish/options.h +++ b/fish/options.h @@ -185,6 +185,13 @@ extern int add_libvirt_drives (const char *guest); exit (EXIT_SUCCESS); \ }
+#define OPTION_w \ + if (read_only) { \ + fprintf (stderr, _("%s: cannot mix --ro and --rw options\n"), \ + program_name); \ + exit (EXIT_FAILURE); \ + } +
This will display an error if the user does:
guestfish --ro --rw
but not:
guestfish --rw --ro
Yeah, I knew that when I was writing it ... The alternative is a bit more invasive unfortunately. Eventually we need to refactor this argument sharing code since it's a bit of a macro-hack at the moment. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
participants (2)
-
Matthew Booth -
Richard W.M. Jones