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;
}
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);
}
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";
}