Revision 51ef6727 qemu-img.c

b/qemu-img.c
646 646
    BlockDriverInfo bdi;
647 647
    QEMUOptionParameter *param = NULL, *create_options = NULL;
648 648
    char *options = NULL;
649
    const char *snapshot_name = NULL;
649 650

  
650 651
    fmt = NULL;
651 652
    out_fmt = "raw";
652 653
    out_baseimg = NULL;
653 654
    flags = 0;
654 655
    for(;;) {
655
        c = getopt(argc, argv, "f:O:B:hce6o:");
656
        c = getopt(argc, argv, "f:O:B:s:hce6o:");
656 657
        if (c == -1)
657 658
            break;
658 659
        switch(c) {
......
680 681
        case 'o':
681 682
            options = optarg;
682 683
            break;
684
        case 's':
685
            snapshot_name = optarg;
686
            break;
683 687
        }
684 688
    }
685 689

  
......
711 715
        total_sectors += bs_sectors;
712 716
    }
713 717

  
718
    if (snapshot_name != NULL) {
719
        if (bs_n > 1) {
720
            error("No support for concatenating multiple snapshot\n");
721
            ret = -1;
722
            goto out;
723
        }
724
        if (bdrv_snapshot_load_tmp(bs[0], snapshot_name) < 0) {
725
            error("Failed to load snapshot\n");
726
            ret = -1;
727
            goto out;
728
        }
729
    }
730

  
714 731
    /* Find driver and parse its options */
715 732
    drv = bdrv_find_format(out_fmt);
716 733
    if (!drv) {

Also available in: Unified diff