summaryrefslogtreecommitdiffstats
path: root/qemu-nbd.c
diff options
context:
space:
mode:
authorPeter Maydell2019-01-15 15:19:18 +0100
committerPeter Maydell2019-01-15 15:19:18 +0100
commit44ba6010635641a538c9b9b1f377dfa288751906 (patch)
tree080c6791a68fe518db0b523090c012eea98c321b /qemu-nbd.c
parentMerge remote-tracking branch 'remotes/stsquad/tags/pull-misc-gitdm-next-14011... (diff)
parentqemu-nbd: Add --bitmap=NAME option (diff)
downloadqemu-44ba6010635641a538c9b9b1f377dfa288751906.tar.gz
qemu-44ba6010635641a538c9b9b1f377dfa288751906.tar.xz
qemu-44ba6010635641a538c9b9b1f377dfa288751906.zip
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-01-14' into staging
nbd patches for 2019-01-14 Promote bitmap/NBD interfaces to stable for use in incremental backups. Add 'qemu-nbd --bitmap'. - John Snow: 0/11 bitmaps: remove x- prefix from QMP api - Philippe Mathieu-Daudé: qemu-nbd: Rename 'exp' variable clashing with math::exp() symbol - Eric Blake: 0/8 Promote x-nbd-server-add-bitmap to stable # gpg: Signature made Mon 14 Jan 2019 16:13:45 GMT # gpg: using RSA key A7A16B4A2527436A # gpg: Good signature from "Eric Blake <eblake@redhat.com>" # gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" # gpg: aka "[jpeg image of size 6874]" # Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A * remotes/ericb/tags/pull-nbd-2019-01-14: qemu-nbd: Add --bitmap=NAME option nbd: Merge nbd_export_bitmap into nbd_export_new nbd: Remove x-nbd-server-add-bitmap nbd: Allow bitmap export during QMP nbd-server-add nbd: Merge nbd_export_set_name into nbd_export_new nbd: Only require disabled bitmap for read-only exports nbd: Forbid nbd-server-stop when server is not running nbd: Add some error case testing to iotests 223 qemu-nbd: Rename 'exp' variable clashing with math::exp() symbol iotests: add iotest 236 for testing bitmap merge iotests: implement pretty-print for log and qmp_log iotests: change qmp_log filters to expect QMP objects only iotests: remove default filters from qmp_log iotests: add qmp recursive sorting function iotests: add filter_generated_node_ids iotests.py: don't abort if IMGKEYSECRET is undefined block: remove 'x' prefix from experimental bitmap APIs blockdev: n-ary bitmap merge block/dirty-bitmap: remove assertion from restore blockdev: abort transactions in reverse order Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qemu-nbd.c')
-rw-r--r--qemu-nbd.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 2807e13239..51b55f2e06 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -61,7 +61,7 @@
#define MBR_SIZE 512
-static NBDExport *exp;
+static NBDExport *export;
static int verbose;
static char *srcpath;
static SocketAddress *saddr;
@@ -95,6 +95,7 @@ static void usage(const char *name)
"Exposing part of the image:\n"
" -o, --offset=OFFSET offset into the image\n"
" -P, --partition=NUM only expose partition NUM\n"
+" -B, --bitmap=NAME expose a persistent dirty bitmap\n"
"\n"
"General purpose options:\n"
" --object type,id=ID,... define an object such as 'secret' for providing\n"
@@ -335,7 +336,7 @@ static int nbd_can_accept(void)
return state == RUNNING && nb_fds < shared;
}
-static void nbd_export_closed(NBDExport *exp)
+static void nbd_export_closed(NBDExport *export)
{
assert(state == TERMINATING);
state = TERMINATED;
@@ -509,7 +510,7 @@ int main(int argc, char **argv)
off_t fd_size;
QemuOpts *sn_opts = NULL;
const char *sn_id_or_name = NULL;
- const char *sopt = "hVb:o:p:rsnP:c:dvk:e:f:tl:x:T:D:";
+ const char *sopt = "hVb:o:p:rsnP:c:dvk:e:f:tl:x:T:D:B:";
struct option lopt[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
@@ -519,6 +520,7 @@ int main(int argc, char **argv)
{ "offset", required_argument, NULL, 'o' },
{ "read-only", no_argument, NULL, 'r' },
{ "partition", required_argument, NULL, 'P' },
+ { "bitmap", required_argument, NULL, 'B' },
{ "connect", required_argument, NULL, 'c' },
{ "disconnect", no_argument, NULL, 'd' },
{ "snapshot", no_argument, NULL, 's' },
@@ -558,6 +560,7 @@ int main(int argc, char **argv)
QDict *options = NULL;
const char *export_name = ""; /* Default export name */
const char *export_description = NULL;
+ const char *bitmap = NULL;
const char *tlscredsid = NULL;
bool imageOpts = false;
bool writethrough = true;
@@ -695,6 +698,9 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
break;
+ case 'B':
+ bitmap = optarg;
+ break;
case 'k':
sockpath = optarg;
if (sockpath[0] != '/') {
@@ -1015,10 +1021,10 @@ int main(int argc, char **argv)
}
}
- exp = nbd_export_new(bs, dev_offset, fd_size, nbdflags, nbd_export_closed,
- writethrough, NULL, &error_fatal);
- nbd_export_set_name(exp, export_name);
- nbd_export_set_description(exp, export_description);
+ export = nbd_export_new(bs, dev_offset, fd_size, export_name,
+ export_description, bitmap, nbdflags,
+ nbd_export_closed, writethrough, NULL,
+ &error_fatal);
if (device) {
#if HAVE_NBD_DEVICE
@@ -1055,9 +1061,9 @@ int main(int argc, char **argv)
main_loop_wait(false);
if (state == TERMINATE) {
state = TERMINATING;
- nbd_export_close(exp);
- nbd_export_put(exp);
- exp = NULL;
+ nbd_export_close(export);
+ nbd_export_put(export);
+ export = NULL;
}
} while (state != TERMINATED);