Message ID | 1374069835-14287-4-git-send-email-xiawenc@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
On Wed, Jul 17, 2013 at 10:03:54PM +0800, Wenchao Xia wrote: > Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> > --- > qemu-nbd.c | 2 ++ > qemu-nbd.texi | 3 +++ > 2 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/qemu-nbd.c b/qemu-nbd.c > index 46be2b2..8eeee33 100644 > --- a/qemu-nbd.c > +++ b/qemu-nbd.c > @@ -80,6 +80,8 @@ static void usage(const char *name) > "Block device options:\n" > " -r, --read-only export read-only\n" > " -s, --snapshot use snapshot file\n" > +" -l, --snapshot-load temporarily load an internal snapshot and export it as\n" > +" an read-only device, format is 'id=[ID],name=[NAME]'\n" Does it really export it read-only? I think you'll get an error unless you pass qemu-nbd --read-only.
于 2013-7-26 16:11, Stefan Hajnoczi 写道: > On Wed, Jul 17, 2013 at 10:03:54PM +0800, Wenchao Xia wrote: >> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> >> --- >> qemu-nbd.c | 2 ++ >> qemu-nbd.texi | 3 +++ >> 2 files changed, 5 insertions(+), 0 deletions(-) >> >> diff --git a/qemu-nbd.c b/qemu-nbd.c >> index 46be2b2..8eeee33 100644 >> --- a/qemu-nbd.c >> +++ b/qemu-nbd.c >> @@ -80,6 +80,8 @@ static void usage(const char *name) >> "Block device options:\n" >> " -r, --read-only export read-only\n" >> " -s, --snapshot use snapshot file\n" >> +" -l, --snapshot-load temporarily load an internal snapshot and export it as\n" >> +" an read-only device, format is 'id=[ID],name=[NAME]'\n" > > Does it really export it read-only? I think you'll get an error unless > you pass qemu-nbd --read-only. > I think so. In patch 2: + case 'l': + sn_param = parse_option_parameters(optarg, + snapshot_options, sn_param); + if (!sn_param) { + errx(EXIT_FAILURE, + "Invalid snapshot-load options '%s'", optarg); + } case 'r': nbdflags |= NBD_FLAG_READ_ONLY; flags &= ~BDRV_O_RDWR; when "l" is set, readonly will also be set.
On Mon, Jul 29, 2013 at 09:57:32AM +0800, Wenchao Xia wrote: > 于 2013-7-26 16:11, Stefan Hajnoczi 写道: > > On Wed, Jul 17, 2013 at 10:03:54PM +0800, Wenchao Xia wrote: > >> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> > >> --- > >> qemu-nbd.c | 2 ++ > >> qemu-nbd.texi | 3 +++ > >> 2 files changed, 5 insertions(+), 0 deletions(-) > >> > >> diff --git a/qemu-nbd.c b/qemu-nbd.c > >> index 46be2b2..8eeee33 100644 > >> --- a/qemu-nbd.c > >> +++ b/qemu-nbd.c > >> @@ -80,6 +80,8 @@ static void usage(const char *name) > >> "Block device options:\n" > >> " -r, --read-only export read-only\n" > >> " -s, --snapshot use snapshot file\n" > >> +" -l, --snapshot-load temporarily load an internal snapshot and export it as\n" > >> +" an read-only device, format is 'id=[ID],name=[NAME]'\n" > > > > Does it really export it read-only? I think you'll get an error unless > > you pass qemu-nbd --read-only. > > > I think so. In patch 2: > > + case 'l': > + sn_param = parse_option_parameters(optarg, > + snapshot_options, sn_param); > + if (!sn_param) { > + errx(EXIT_FAILURE, > + "Invalid snapshot-load options '%s'", optarg); > + } > case 'r': > nbdflags |= NBD_FLAG_READ_ONLY; > flags &= ~BDRV_O_RDWR; > > when "l" is set, readonly will also be set. I missed that, please add a /* fall through */ comment to make readers aware. Stefan
diff --git a/qemu-nbd.c b/qemu-nbd.c index 46be2b2..8eeee33 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -80,6 +80,8 @@ static void usage(const char *name) "Block device options:\n" " -r, --read-only export read-only\n" " -s, --snapshot use snapshot file\n" +" -l, --snapshot-load temporarily load an internal snapshot and export it as\n" +" an read-only device, format is 'id=[ID],name=[NAME]'\n" " -n, --nocache disable host cache\n" " --cache=MODE set cache mode (none, writeback, ...)\n" #ifdef CONFIG_LINUX_AIO diff --git a/qemu-nbd.texi b/qemu-nbd.texi index 6055ec6..86e8e1b 100644 --- a/qemu-nbd.texi +++ b/qemu-nbd.texi @@ -28,6 +28,9 @@ Export QEMU disk image using NBD protocol. only expose partition @var{num} @item -s, --snapshot use snapshot file +@item -l, --snapshot-load + temporarily load an internal snapshot and export it as + an read-only device, format is 'id=[ID],name=[NAME]' @item -n, --nocache @itemx --cache=@var{cache} set cache mode to be used with the file. See the documentation of
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> --- qemu-nbd.c | 2 ++ qemu-nbd.texi | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-)