]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage/ISCSIPlugin.pm
path: corretly implement path to snapshots
[pve-storage.git] / PVE / Storage / ISCSIPlugin.pm
index 8da7ec58fcb61f65c6d4d766cc6ab8d7a926d001..7614bf093449a6daa8d1a321e99cdfc1f52826bb 100644 (file)
@@ -41,16 +41,20 @@ sub iscsi_session_list {
 
     my $res = {};
 
-    run_command($cmd, outfunc => sub {
-       my $line = shift;
-
-       if ($line =~ m/^tcp:\s+\[(\S+)\]\s+\S+\s+(\S+)\s*$/) {
-           my ($session, $target) = ($1, $2);
-           # there can be several sessions per target (multipath)
-           push @{$res->{$target}}, $session;
-
-       }
-    });
+    eval {
+       run_command($cmd, errmsg => 'iscsi session scan failed', outfunc => sub {
+           my $line = shift;
+           
+           if ($line =~ m/^tcp:\s+\[(\S+)\]\s+\S+\s+(\S+)\s*$/) {
+               my ($session, $target) = ($1, $2);
+               # there can be several sessions per target (multipath)
+               push @{$res->{$target}}, $session;   
+           }
+       });
+    };
+    if (my $err = $@) {
+       die $err if $err !~ m/: No active sessions.$/i;
+    }
 
     return $res;
 }
@@ -267,14 +271,16 @@ sub parse_volname {
     my ($class, $volname) = @_;
 
     if ($volname =~ m!^\d+\.\d+\.\d+\.(\S+)$!) {
-       return ('images', $1, undef);
+       return ('images', $1, undef, undef, undef, undef, 'raw');
     }
 
     die "unable to parse iscsi volume name '$volname'\n";
 }
 
-sub path {
-    my ($class, $scfg, $volname) = @_;
+sub filesystem_path {
+    my ($class, $scfg, $volname, $snapname) = @_;
+
+    die "snapshot is not possible on iscsi storage\n" if defined($snapname);
 
     my ($vtype, $name, $vmid) = $class->parse_volname($volname);
     
@@ -290,7 +296,7 @@ sub create_base {
 }
 
 sub clone_image {
-    my ($class, $scfg, $storeid, $volname, $vmid) = @_;
+    my ($class, $scfg, $storeid, $volname, $vmid, $snap) = @_;
 
     die "can't clone images in iscsi storage\n";
 }