fix(emc/celerra): filesystems mode - correct used value (#3137)

Fix a bug beetwin Real FS size and Max_Size (it's correct %used)
This commit is contained in:
Le-Syl21 2021-09-23 17:02:10 +02:00 committed by GitHub
parent 0c7b13c439
commit 86dd6c761d
1 changed files with 18 additions and 13 deletions

View File

@ -113,7 +113,7 @@ sub manage_selection {
my ($self, %options) = @_; my ($self, %options) = @_;
my ($stdout) = $options{custom}->execute_command( my ($stdout) = $options{custom}->execute_command(
command => 'NAS_DB=/nas /nas/bin/nas_fs -query:inuse==y:type=uxfs:IsRoot=False:RWServersNumeric==1 -fields:RWservers,rwvdms,StoragePoolName,Name,PctUsed,MaxSize -format:%L,%L,%s,%s,%d,%d----', command => 'NAS_DB=/nas /nas/bin/nas_fs -query:"inuse==y:type=uxfs:IsRoot=False:RWServersNumeric==1" -fields:"RWservers,rwvdms,StoragePoolName,Name,UsedCapacity,Size,AutoExtend,MaxSize" -format:"%L,%L,%s,%s,%d,%d,%s,%d----"',
command_options => '2>&1', command_options => '2>&1',
); );
@ -122,7 +122,7 @@ sub manage_selection {
$self->{pools} = {}; $self->{pools} = {};
foreach my $entry (split(/----/, $stdout)) { foreach my $entry (split(/----/, $stdout)) {
my ($servers, $vdms, $pool_name, $fs_name, $prct_used, $size) = split(/,/, $entry); my ($servers, $vdms, $pool_name, $fs_name, $used, $realsize, $autoextend, $maxsize) = split(/,/, $entry);
if (defined($self->{option_results}->{filter_pool_name}) && $self->{option_results}->{filter_pool_name} ne '' && if (defined($self->{option_results}->{filter_pool_name}) && $self->{option_results}->{filter_pool_name} ne '' &&
$pool_name !~ /$self->{option_results}->{filter_pool_name}/) { $pool_name !~ /$self->{option_results}->{filter_pool_name}/) {
$self->{output}->output_add(long_msg => "skipping filesystem '" . $fs_name . "': no matching filter.", debug => 1); $self->{output}->output_add(long_msg => "skipping filesystem '" . $fs_name . "': no matching filter.", debug => 1);
@ -141,15 +141,20 @@ sub manage_selection {
}; };
} }
$size *= 1024 * 1024; my $size;
my $used_space = int($prct_used * $size / 100); if ($autoextend eq 'True' && $maxsize >= $realsize) {
$size = $maxsize*1024*1024;
}else{
$size = $realsize*1024*1024;
}
my $used_space = $used/2*1024;
$self->{pools}->{$pool_name}->{fs}->{$fs_name} = { $self->{pools}->{$pool_name}->{fs}->{$fs_name} = {
name => $fs_name, name => $fs_name,
total_space => $size, total_space => $size,
used_space => $used_space, used_space => $used_space,
free_space => $size - $used_space, free_space => $size - $used_space,
prct_used_space => $prct_used, prct_used_space => $used_space*100/$size,
prct_free_space => 100 - $prct_used prct_free_space => 100 - $used_space*100/$size
}; };
} }
} }
@ -162,7 +167,7 @@ __END__
Check filesystems. Check filesystems.
Command used: NAS_DB=/nas /nas/bin/nas_fs -query:inuse==y:type=uxfs:IsRoot=False:RWServersNumeric==1 -fields:RWservers,rwvdms,StoragePoolName,Name,PctUsed,MaxSize -format:%L,%L,%s,%s,%d,%d---- 2>&1 Command used: NAS_DB=/nas /nas/bin/nas_fs -query:"inuse==y:type=uxfs:IsRoot=False:RWServersNumeric==1" -fields:"RWservers,rwvdms,StoragePoolName,Name,UsedCapacity,Size,AutoExtend,MaxSize" -format:"%L,%L,%s,%s,%d,%d,%s,%d----" 2>&1
=over 8 =over 8