[pve-devel] [PATCH] remove running from Storage and check it in QemuServer

Wolfgang Link w.link at proxmox.com
Thu Apr 30 09:47:02 CEST 2015


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.link at proxmox.com>
---
 PVE/Storage.pm                   | 4 ++--
 PVE/Storage/ISCSIDirectPlugin.pm | 2 +-
 PVE/Storage/LVMPlugin.pm         | 2 +-
 PVE/Storage/Plugin.pm            | 4 +---
 PVE/Storage/RBDPlugin.pm         | 4 +---
 PVE/Storage/SheepdogPlugin.pm    | 4 +---
 PVE/Storage/ZFSPoolPlugin.pm     | 2 +-
 7 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index b542ee6..92c7d14 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -162,13 +162,13 @@ sub volume_rollback_is_possible {
 }
 
 sub volume_snapshot {
-    my ($cfg, $volid, $snap, $running) = @_;
+    my ($cfg, $volid, $snap) = @_;
 
     my ($storeid, $volname) = parse_volume_id($volid, 1);
     if ($storeid) {
         my $scfg = storage_config($cfg, $storeid);
         my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
-        return $plugin->volume_snapshot($scfg, $storeid, $volname, $snap, $running);
+        return $plugin->volume_snapshot($scfg, $storeid, $volname, $snap);
     } elsif ($volid =~ m|^(/.+)$| && -e $volid) {
         die "snapshot file/device '$volid' is not possible\n";
     } else {
diff --git a/PVE/Storage/ISCSIDirectPlugin.pm b/PVE/Storage/ISCSIDirectPlugin.pm
index c957ade..763c482 100644
--- a/PVE/Storage/ISCSIDirectPlugin.pm
+++ b/PVE/Storage/ISCSIDirectPlugin.pm
@@ -205,7 +205,7 @@ sub volume_resize {
 }
 
 sub volume_snapshot {
-    my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
+    my ($class, $scfg, $storeid, $volname, $snap) = @_;
     die "volume snapshot is not possible on iscsi device";
 }
 
diff --git a/PVE/Storage/LVMPlugin.pm b/PVE/Storage/LVMPlugin.pm
index 1688bb5..19eb78c 100644
--- a/PVE/Storage/LVMPlugin.pm
+++ b/PVE/Storage/LVMPlugin.pm
@@ -456,7 +456,7 @@ sub volume_resize {
 }
 
 sub volume_snapshot {
-    my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
+    my ($class, $scfg, $storeid, $volname, $snap) = @_;
 
     die "lvm snapshot is not implemented";
 }
diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index 5b72b07..f119068 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -641,12 +641,10 @@ sub volume_resize {
 }
 
 sub volume_snapshot {
-    my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
+    my ($class, $scfg, $storeid, $volname, $snap) = @_;
 
     die "can't snapshot this image format\n" if $volname !~ m/\.(qcow2|qed)$/;
 
-    return 1 if $running;
-
     my $path = $class->filesystem_path($scfg, $volname);
 
     my $cmd = ['/usr/bin/qemu-img', 'snapshot','-c', $snap, $path];
diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index 2c45a68..878fa16 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -510,9 +510,7 @@ sub volume_resize {
 }
 
 sub volume_snapshot {
-    my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
-
-    return 1 if $running;
+    my ($class, $scfg, $storeid, $volname, $snap) = @_;
 
     my ($vtype, $name, $vmid) = $class->parse_volname($volname);
 
diff --git a/PVE/Storage/SheepdogPlugin.pm b/PVE/Storage/SheepdogPlugin.pm
index 3e2c126..e358f9e 100644
--- a/PVE/Storage/SheepdogPlugin.pm
+++ b/PVE/Storage/SheepdogPlugin.pm
@@ -389,9 +389,7 @@ sub volume_resize {
 }
 
 sub volume_snapshot {
-    my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
-
-    return 1 if $running;
+    my ($class, $scfg, $storeid, $volname, $snap) = @_;
 
     my ($vtype, $name, $vmid, $basename, $basevmid, $isBase) =
 	$class->parse_volname($volname);
diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 39fc348..1064869 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -415,7 +415,7 @@ sub volume_size_info {
 }
 
 sub volume_snapshot {
-    my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
+    my ($class, $scfg, $storeid, $volname, $snap) = @_;
 
     $class->zfs_request($scfg, undef, 'snapshot', "$scfg->{pool}/$volname\@$snap");
 }
-- 
2.1.4





More information about the pve-devel mailing list