[pve-devel] perhaps a bug in QemuConfig.pm?

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Jun 6 14:08:00 CEST 2017


On Tue, Jun 06, 2017 at 01:52:00PM +0200, datanom.net wrote:
> Hi all,
> 
> When creating a live snapshot this function is called:
> sub __snapshot_save_vmstate {
>     my ($class, $vmid, $conf, $snapname, $storecfg) = @_;
> 
>     my $snap = $conf->{snapshots}->{$snapname};
> 
>     my $target;
> 
>     # search shared storage first
>     PVE::QemuServer::foreach_writable_storage($conf, sub {
> 	my ($sid) = @_;
> 	my $scfg = PVE::Storage::storage_config($storecfg, $sid);
> 	return if !$scfg->{shared};
> 
> 	$target = $sid if !$target || $scfg->{path}; # prefer file based storage
>     });
> 
>     if (!$target) {
> 	# now search local storage
> 	PVE::QemuServer::foreach_writable_storage($conf, sub {
> 	    my ($sid) = @_;
> 	    my $scfg = PVE::Storage::storage_config($storecfg, $sid);
> 	    return if $scfg->{shared};
> 
> 	    $target = $sid if !$target || $scfg->{path}; # prefer file based
> storage;
> 	});
>     }
> 
>     $target = 'local' if !$target;
> [....]
> 
> It doesn't seem obvious to me why we prefer shared storage over local
> storage?

because when migrating, a shared vmstate disk does not have to be copied
around, while a local one does. note that there is a proposed patch set
which adds a static vmstatestorage to the VM configuration, to give more
control over the selection.

> Above assumes that we are able to store two snapshots for each VM/CT we are
> making a live snapshot for on the share storage.

I am not sure I understand the question here? what is "two snapshots"
supposed to mean?

the above code just selects a storage and allocates space for the memory
dump of the VM there, it is not directly related to the volume snapshots
which are created for each volume used by the VM (other than the fact
that both operations are part of the "do a snapshot including memory
state" operation).

e.g., if you have a VM with two disks A and B, if you create a "normal"
snapshot without RAM A and B get snapshotted. if you create a snapshot
with RAM A and B get snapshotted, and the RAM is dumped into a vmstate
volume on some storage X (with the above selection "algorithm").




More information about the pve-devel mailing list