seem to be ok !
BTW, I wonder if we could replace qmp "snapshot-drive" (from internal-snapshot-async.patch) by upstream qemu qmp method blockdev-snapshot-internal-sync http://git.qemu.org/?p=qemu.git;a=blob_plain;f=qmp-commands.hx;hb=HEAD One advantage is that multiple drive can be snapshotted in a transaction. from history we have done this snapshot-drive because no method existed at this time. I think we just need to keep savevm_start, savevm_stop from internal-snapshot-async.patch, to be able to save the vmstate to external file/volume. blockdev-snapshot-internal-sync ------------------------------- Synchronously take an internal snapshot of a block device when the format of image used supports it. If the name is an empty string, or a snapshot with name already exists, the operation will fail. Arguments: - "device": device name to snapshot (json-string) - "name": name of the new snapshot (json-string) Example: -> { "execute": "blockdev-snapshot-internal-sync", "arguments": { "device": "ide-hd0", "name": "snapshot0" } } <- { "return": {} } EQMP { .name = "blockdev-snapshot-delete-internal-sync", .args_type = "device:B,id:s?,name:s?", .mhandler.cmd_new = qmp_marshal_input_blockdev_snapshot_delete_internal_sync, }, SQMP blockdev-snapshot-delete-internal-sync -------------------------------------- Synchronously delete an internal snapshot of a block device when the format of image used supports it. The snapshot is identified by name or id or both. One of name or id is required. If the snapshot is not found, the operation will fail. Arguments: - "device": device name (json-string) - "id": ID of the snapshot (json-string, optional) - "name": name of the snapshot (json-string, optional) Example: -> { "execute": "blockdev-snapshot-delete-internal-sync", "arguments": { "device": "ide-hd0", "name": "snapshot0" } } <- { "return": { "id": "1", "name": "snapshot0", "vm-state-size": 0, "date-sec": 1000012, "date-nsec": 10, "vm-clock-sec": 100, "vm-clock-nsec": 20 } } ----- Mail original ----- De: "Wolfgang Link" <w.l...@proxmox.com> À: "pve-devel" <pve-devel@pve.proxmox.com> Envoyé: Mercredi 6 Mai 2015 09:57:34 Objet: [pve-devel] [PATCH] remove running from Storage and check it in QemuServer It is better to check if a VM is running in QemuServer then in Storage. for the Storage there is no difference if it is running or not. Signed-off-by: Wolfgang Link <w.l...@proxmox.com> --- PVE/QemuServer.pm | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 708b208..9a4e2ee 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -31,6 +31,8 @@ use PVE::QMPClient; use PVE::RPCEnvironment; use Time::HiRes qw(gettimeofday); +my $qemu_snap_storage = {rbd => 1, sheepdog => 1}; + my $cpuinfo = PVE::ProcFSTools::read_cpuinfo(); # Note about locking: we use flock on the config file protect @@ -3777,12 +3779,11 @@ sub qemu_volume_snapshot { my $running = check_running($vmid); - return if !PVE::Storage::volume_snapshot($storecfg, $volid, $snap, $running); - - return if !$running; - - vm_mon_cmd($vmid, "snapshot-drive", device => $deviceid, name => $snap); - + if ($running && do_snapshots_with_qemu($storecfg, $volid)){ + vm_mon_cmd($vmid, "snapshot-drive", device => $deviceid, name => $snap); + } else { + PVE::Storage::volume_snapshot($storecfg, $volid, $snap); + } } sub qemu_volume_snapshot_delete { @@ -5772,6 +5773,22 @@ my $savevm_wait = sub { } }; +sub do_snapshots_with_qemu { + my ($storecfg, $volid) = @_; + + my $storage_name = PVE::Storage::parse_volume_id($volid); + + if ($qemu_snap_storage->{$storecfg->{ids}->{$storage_name}->{type}} ){ + return 1; + } + + if ($volid =~ m/\.(qcow2|qed)$/){ + return 1; + } + + return undef; +} + sub snapshot_create { my ($vmid, $snapname, $save_vmstate, $comment) = @_; -- 2.1.4 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel