diff --git a/Anvil/Tools/Storage.pm b/Anvil/Tools/Storage.pm index 4dee36cc..8ca64f9e 100644 --- a/Anvil/Tools/Storage.pm +++ b/Anvil/Tools/Storage.pm @@ -3282,7 +3282,7 @@ sub manage_lvm_conf os_type => $os_type, os_arch => $os_arch, }}); - if ($os_type !~ /\D8/) + if (($os_type ne "rhel8") && ($os_type ne "centos-stream8")) { # Not EL8, return return(0); diff --git a/scancore-agents/scan-drbd/scan-drbd b/scancore-agents/scan-drbd/scan-drbd index ba7592a6..80ec7d84 100755 --- a/scancore-agents/scan-drbd/scan-drbd +++ b/scancore-agents/scan-drbd/scan-drbd @@ -88,7 +88,7 @@ if ($anvil->DRBD->gather_data({debug => 2})) } # Make sure that lvm.conf's filter of DRBD devices is in place. -$problem = $anvil->Storage->manage_lvm_conf(); +$problem = $anvil->Storage->manage_lvm_conf({debug => 2}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { problem => $problem }}); # TODO: Remove this eventually. diff --git a/scancore-agents/scan-lvm/scan-lvm b/scancore-agents/scan-lvm/scan-lvm index 279fac3e..86f8bb6a 100755 --- a/scancore-agents/scan-lvm/scan-lvm +++ b/scancore-agents/scan-lvm/scan-lvm @@ -1261,6 +1261,26 @@ sub collect_pvs_data return_code => $return_code, }}); + # If there's an old filter in lvm.conf, it will generate an error that breaks the JSON formatting. + # See: https://issues.redhat.com/browse/RHEL-29680 + if ($output =~ /remove the lvm.conf filter/gs) + { + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_log_0002"}); + my $new_output = ""; + foreach my $line (split/\n/, $output) + { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { line => $line }}); + if ($line =~ /remove the lvm.conf filter/) + { + next; + } + $new_output .= $line."\n"; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { new_output => $new_output }}); + } + $output = $new_output; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { output => $output }}); + } + my $json = JSON->new->allow_nonref; my $pvs_data = $json->decode($output); my $default_sector_size = 512; @@ -1364,6 +1384,26 @@ sub collect_vgs_data return_code => $return_code, }}); + # If there's an old filter in lvm.conf, it will generate an error that breaks the JSON formatting. + # See: https://issues.redhat.com/browse/RHEL-29680 + if ($output =~ /remove the lvm.conf filter/gs) + { + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_log_0002"}); + my $new_output = ""; + foreach my $line (split/\n/, $output) + { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { line => $line }}); + if ($line =~ /remove the lvm.conf filter/) + { + next; + } + $new_output .= $line."\n"; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { new_output => $new_output }}); + } + $output = $new_output; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { output => $output }}); + } + my $json = JSON->new->allow_nonref; my $vgs_data = $json->decode($output); foreach my $hash_ref (@{$vgs_data->{report}->[0]->{vg}}) @@ -1408,6 +1448,26 @@ sub collect_lvs_data return_code => $return_code, }}); + # If there's an old filter in lvm.conf, it will generate an error that breaks the JSON formatting. + # See: https://issues.redhat.com/browse/RHEL-29680 + if ($output =~ /remove the lvm.conf filter/gs) + { + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_log_0002"}); + my $new_output = ""; + foreach my $line (split/\n/, $output) + { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { line => $line }}); + if ($line =~ /remove the lvm.conf filter/) + { + next; + } + $new_output .= $line."\n"; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { new_output => $new_output }}); + } + $output = $new_output; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { output => $output }}); + } + my $json = JSON->new->allow_nonref; my $lvs_data = $json->decode($output); foreach my $hash_ref (@{$lvs_data->{report}->[0]->{lv}}) diff --git a/scancore-agents/scan-lvm/scan-lvm.xml b/scancore-agents/scan-lvm/scan-lvm.xml index 45001484..c2f70e60 100644 --- a/scancore-agents/scan-lvm/scan-lvm.xml +++ b/scancore-agents/scan-lvm/scan-lvm.xml @@ -226,6 +226,7 @@ The attribute bits are: Starting: [#!variable!program!#]. + [ NOTE ] - Please update lvm.conf to remove the filter: filter = [ "r|/dev/drbd*|" ] [ Warning ] - Failed to find the sector size for: [#!variable!device!#] This should be in the path: [#!variable!sector_path!#]. Assuming the sector size of: [#!variable!sector_size!#], but this could be incorrect.