cleanup white space errors
This commit is contained in:
@ -11,11 +11,9 @@ use PVE::JSONSchema qw(get_standard_option);
|
||||
|
||||
use base qw(PVE::Storage::Plugin);
|
||||
|
||||
|
||||
sub iscsi_ls {
|
||||
my ($scfg, $storeid) = @_;
|
||||
|
||||
|
||||
my $portal = $scfg->{portal};
|
||||
my $cmd = ['/usr/bin/iscsi-ls', '-s', 'iscsi://'.$portal ];
|
||||
my $list = {};
|
||||
@ -50,7 +48,6 @@ sub iscsi_ls{
|
||||
my $err = $@;
|
||||
die $err if $err && $err !~ m/TESTUNITREADY failed with SENSE KEY/ ;
|
||||
return $list;
|
||||
|
||||
}
|
||||
|
||||
# Configuration
|
||||
@ -75,7 +72,6 @@ sub options {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
# Storage implementation
|
||||
|
||||
sub parse_volname {
|
||||
@ -185,5 +181,4 @@ sub deactivate_volume {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
@ -13,8 +13,6 @@ use PVE::JSONSchema qw(get_standard_option);
|
||||
|
||||
use base qw(PVE::Storage::Plugin);
|
||||
|
||||
|
||||
|
||||
sub nexenta_request {
|
||||
my ($scfg, $json) = @_;
|
||||
|
||||
@ -30,7 +28,6 @@ sub nexenta_request {
|
||||
my $res = $ua->request($req);
|
||||
if (!$res->is_success) {
|
||||
die $res->content;
|
||||
|
||||
}
|
||||
my $obj = from_json($res->content);
|
||||
print $obj->{error}->{message} if $obj->{error}->{message};
|
||||
@ -39,37 +36,30 @@ sub nexenta_request {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
sub nexenta_list_lun_mapping_entries {
|
||||
my ($zvol, $scfg) = @_;
|
||||
|
||||
|
||||
my $json = '{"method": "list_lun_mapping_entries","object" : "scsidisk","params": ["'.$scfg->{pool}.'/'.$zvol.'"]}';
|
||||
my $map = nexenta_request($scfg,$json);
|
||||
return $map if $map;
|
||||
return undef;
|
||||
|
||||
}
|
||||
|
||||
sub nexenta_add_lun_mapping_entry {
|
||||
my ($zvol, $scfg) = @_;
|
||||
|
||||
|
||||
my $json = '{"method": "add_lun_mapping_entry","object" : "scsidisk","params": ["'.$scfg->{pool}.'/'.$zvol.'",{"target_group": "All"}]}';
|
||||
|
||||
return undef if !nexenta_request($scfg, $json);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub nexenta_delete_lu {
|
||||
my ($zvol, $scfg) = @_;
|
||||
|
||||
my $json = '{"method": "delete_lu","object" : "scsidisk","params": ["'.$scfg->{pool}.'/'.$zvol.'"]}';
|
||||
return undef if !nexenta_request($scfg, $json);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
sub nexenta_create_lu {
|
||||
@ -79,13 +69,11 @@ sub nexenta_create_lu {
|
||||
|
||||
return undef if !nexenta_request($scfg, $json);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
sub nexenta_create_zvol {
|
||||
my ($zvol, $size, $scfg) = @_;
|
||||
|
||||
|
||||
my $blocksize = $scfg->{blocksize};
|
||||
my $nexentapool = $scfg->{pool};
|
||||
|
||||
@ -93,23 +81,20 @@ sub nexenta_create_zvol {
|
||||
|
||||
return undef if !nexenta_request($scfg, $json);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
sub nexenta_delete_zvol {
|
||||
my ($zvol, $scfg) = @_;
|
||||
|
||||
sleep 5;
|
||||
my $json = '{"method": "destroy","object" : "zvol","params": ["'.$scfg->{pool}.'/'.$zvol.'", ""]}';
|
||||
return undef if !nexenta_request($scfg, $json);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub nexenta_list_zvol {
|
||||
my ($scfg) = @_;
|
||||
|
||||
|
||||
|
||||
my $json = '{"method": "get_names","object" : "zvol","params": [""]}';
|
||||
my $volumes = {};
|
||||
|
||||
@ -137,17 +122,11 @@ sub nexenta_list_zvol {
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $list;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# Configuration
|
||||
|
||||
|
||||
sub type {
|
||||
return 'nexenta';
|
||||
}
|
||||
@ -158,10 +137,8 @@ sub plugindata {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
sub properties {
|
||||
return {
|
||||
|
||||
login => {
|
||||
description => "login",
|
||||
type => 'string',
|
||||
@ -174,7 +151,6 @@ sub properties {
|
||||
description => "block size",
|
||||
type => 'string',
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@ -195,7 +171,6 @@ sub options {
|
||||
sub parse_volname {
|
||||
my ($class, $volname) = @_;
|
||||
|
||||
|
||||
if ($volname =~ m/^(vm-(\d+)-\S+)$/) {
|
||||
return ('images', $1, $2);
|
||||
}
|
||||
@ -216,7 +191,6 @@ sub path {
|
||||
die "could not find lun number" if !$map;
|
||||
my $lun = @$map[0]->{lun};
|
||||
|
||||
|
||||
my $path = "iscsi://$portal/$target/$lun";
|
||||
|
||||
return ($path, $vmid, $vtype);
|
||||
@ -231,12 +205,9 @@ sub alloc_image {
|
||||
die "illegal name '$name' - sould be 'vm-$vmid-*'\n"
|
||||
if $name && $name !~ m/^vm-$vmid-/;
|
||||
|
||||
|
||||
|
||||
my $nexentapool = $scfg->{'pool'};
|
||||
|
||||
if (!$name) {
|
||||
|
||||
my $volumes = nexenta_list_zvol($scfg);
|
||||
die "unable de get zvol list" if !$volumes;
|
||||
|
||||
@ -340,5 +311,4 @@ sub deactivate_volume {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user