[pve-devel] [PATCH qemu-server 2/4] snapshot: use explicitly configured vmstate storage
Fabian Grünbichler
f.gruenbichler at proxmox.com
Wed May 10 12:00:19 CEST 2017
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
PVE/QemuConfig.pm | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/PVE/QemuConfig.pm b/PVE/QemuConfig.pm
index a2bc4fc..1492480 100644
--- a/PVE/QemuConfig.pm
+++ b/PVE/QemuConfig.pm
@@ -107,28 +107,32 @@ sub __snapshot_save_vmstate {
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
- });
+ # first, use explicitly configured storage
+ my $target = $conf->{vmstatestorage};
if (!$target) {
- # now search local storage
+ # second, use shared storage where VM has at least one disk
PVE::QemuServer::foreach_writable_storage($conf, sub {
my ($sid) = @_;
my $scfg = PVE::Storage::storage_config($storecfg, $sid);
- return if $scfg->{shared};
+ return if !$scfg->{shared};
- $target = $sid if !$target || $scfg->{path}; # prefer file based storage;
+ $target = $sid if !$target || $scfg->{path}; # prefer file based storage
});
+
+ if (!$target) {
+ # third, use local storage where VM has at least one disk
+ 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;
+ });
+ }
}
+ # fall back to local storage
$target = 'local' if !$target;
my $driver_state_size = 500; # assume 32MB is enough to safe all driver state;
--
2.1.4
More information about the pve-devel
mailing list