summaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 578b8ebe8c..d4a3b4ebcf 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -646,13 +646,14 @@ static int img_convert(int argc, char **argv)
BlockDriverInfo bdi;
QEMUOptionParameter *param = NULL, *create_options = NULL;
char *options = NULL;
+ const char *snapshot_name = NULL;
fmt = NULL;
out_fmt = "raw";
out_baseimg = NULL;
flags = 0;
for(;;) {
- c = getopt(argc, argv, "f:O:B:hce6o:");
+ c = getopt(argc, argv, "f:O:B:s:hce6o:");
if (c == -1)
break;
switch(c) {
@@ -680,6 +681,9 @@ static int img_convert(int argc, char **argv)
case 'o':
options = optarg;
break;
+ case 's':
+ snapshot_name = optarg;
+ break;
}
}
@@ -711,6 +715,19 @@ static int img_convert(int argc, char **argv)
total_sectors += bs_sectors;
}
+ if (snapshot_name != NULL) {
+ if (bs_n > 1) {
+ error("No support for concatenating multiple snapshot\n");
+ ret = -1;
+ goto out;
+ }
+ if (bdrv_snapshot_load_tmp(bs[0], snapshot_name) < 0) {
+ error("Failed to load snapshot\n");
+ ret = -1;
+ goto out;
+ }
+ }
+
/* Find driver and parse its options */
drv = bdrv_find_format(out_fmt);
if (!drv) {