[pve-devel] [PATCH container] implement is_shared_only check
Dominik Csapak
d.csapak at proxmox.com
Thu Dec 1 17:21:38 CET 2016
this iterates all mountpoints and checks if they are on a shared
storage, or marked as 'shared'
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/PVE/LXC/Config.pm | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index d4d973b..ba5c9ac 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -75,6 +75,31 @@ sub has_feature {
return $err ? 0 : 1;
}
+sub is_shared_only {
+ my ($class, $conf, $scfg) = @_;
+
+ my $issharedonly = 1;
+ $class->foreach_mountpoint($conf, sub {
+ my ($ms, $mountpoint) = @_;
+
+ # exit early
+ return if !$issharedonly;
+
+ if ($mountpoint->{type} ne 'volume') {
+ $issharedonly = 0 if !$mountpoint->{shared};
+ return;
+ }
+
+ my $sid = PVE::Storage::parse_volume_id($mountpoint->{volume});
+ my $storage = PVE::Storage::storage_config($scfg, $sid);
+ if (!$storage->{shared}) {
+ $issharedonly = 0;
+ }
+ });
+
+ return $issharedonly;
+}
+
sub __snapshot_save_vmstate {
my ($class, $vmid, $conf, $snapname, $storecfg) = @_;
die "implement me - snapshot_save_vmstate\n";
--
2.1.4
More information about the pve-devel
mailing list