[pve-devel] create snapshots

Dietmar Maurer dietmar at proxmox.com
Fri Aug 31 12:51:04 CEST 2012

I just looked at savevm, and that is relatively simple code:

qemu-kvm/savevm.c: do_savevm()

1.)    check if all disk support snapshots (call bdrv_can_snapshot())

2.)    vm_stop(RUN_STATE_SAVE_VM)

3.)    Delete old snapshots of the same name

4.)    save the VM state

5.)    create the snapshots (call bdrv_snapshot_create())

6.)    resstart vm

For me, the interesting part is point 5, the call to bdrv_snapshot_create(),
which is defined in qemu-kvm/block.c:

int bdrv_snapshot_create(BlockDriverState *bs,
                         QEMUSnapshotInfo *sn_info)
    BlockDriver *drv = bs->drv;
    if (!drv)
        return -ENOMEDIUM;
    if (drv->bdrv_snapshot_create)
        return drv->bdrv_snapshot_create(bs, sn_info);
    if (bs->file)
        return bdrv_snapshot_create(bs->file, sn_info);
    return -ENOTSUP;

I wonder it is would be safe to call an external script to create the snapshot there?
Or is there still some data in the qemu block driver cache, or the host cache?

I guess I should ask that on the qemu-devel list instead?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pve.proxmox.com/pipermail/pve-devel/attachments/20120831/4f138b98/attachment.html>

More information about the pve-devel mailing list