diff --git a/scancore-agents/scan-lvm/scan-lvm b/scancore-agents/scan-lvm/scan-lvm index 7adfe2f8..2b0b4518 100755 --- a/scancore-agents/scan-lvm/scan-lvm +++ b/scancore-agents/scan-lvm/scan-lvm @@ -8,6 +8,10 @@ # 0 = Normal exit. # 1 = Startup failure (not running as root, no DB, bad file read, etc) # +# NOTE: +# - LVM created UUIDs before RFC 4122, so the internal UUIDs are incompatible with modern UUIDs. As such, +# they are treated as more of a "serial number" in this agent. +# # TODO: # - # @@ -125,16 +129,16 @@ sub find_changes_in_lvs { my ($anvil) = @_; - foreach my $scan_lvm_lv_uuid (keys %{$anvil->data->{lvm}{scan_lvm_lv_uuid}}) + foreach my $scan_lvm_lv_internal_uuid (keys %{$anvil->data->{lvm}{scan_lvm_lv_internal_uuid}}) { - my $scan_lvm_lv_name = $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{name}; - my $scan_lvm_lv_attributes = $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{attributes}; - my $scan_lvm_lv_on_vg = $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{on_vg}; - my $scan_lvm_lv_size = $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{size}; - my $scan_lvm_lv_path = $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{device_path}; - my $scan_lvm_lv_on_pvs = $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{on_pvs}; + my $scan_lvm_lv_name = $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{name}; + my $scan_lvm_lv_attributes = $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{attributes}; + my $scan_lvm_lv_on_vg = $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{on_vg}; + my $scan_lvm_lv_size = $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{size}; + my $scan_lvm_lv_path = $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{device_path}; + my $scan_lvm_lv_on_pvs = $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{on_pvs}; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { - scan_lvm_lv_uuid => $scan_lvm_lv_uuid, + scan_lvm_lv_internal_uuid => $scan_lvm_lv_internal_uuid, scan_lvm_lv_name => $scan_lvm_lv_name, scan_lvm_lv_attributes => $scan_lvm_lv_attributes, scan_lvm_lv_on_vg => $scan_lvm_lv_on_vg, @@ -144,16 +148,18 @@ sub find_changes_in_lvs }}); # Have we seen this before? - if (exists $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}) + if (exists $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}) { # Yup, anything changed? - my $old_scan_lvm_lv_name = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_name}; - my $old_scan_lvm_lv_attributes = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_attributes}; - my $old_scan_lvm_lv_on_vg = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_on_vg}; - my $old_scan_lvm_lv_size = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_size}; - my $old_scan_lvm_lv_path = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_path}; - my $old_scan_lvm_lv_on_pvs = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_on_pvs}; + my $scan_lvm_lv_uuid = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_uuid}; + my $old_scan_lvm_lv_name = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_name}; + my $old_scan_lvm_lv_attributes = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_attributes}; + my $old_scan_lvm_lv_on_vg = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_on_vg}; + my $old_scan_lvm_lv_size = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_size}; + my $old_scan_lvm_lv_path = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_path}; + my $old_scan_lvm_lv_on_pvs = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_on_pvs}; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + scan_lvm_lv_uuid => $scan_lvm_lv_uuid, old_scan_lvm_lv_name => $old_scan_lvm_lv_name, old_scan_lvm_lv_attributes => $old_scan_lvm_lv_attributes, old_scan_lvm_lv_on_vg => $old_scan_lvm_lv_on_vg, @@ -171,22 +177,22 @@ sub find_changes_in_lvs { # A lost LV is back my $variables = { - lv_uuid => $scan_lvm_lv_uuid, + lv_uuid => $scan_lvm_lv_internal_uuid, lv_name => $scan_lvm_lv_name, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0021", variables => $variables}); - $anvil->Alert->register({debug => 2, clear_alert => 1, alert_level => "warning", message => "scan_lvm_alert_0021", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0021", variables => $variables}); + $anvil->Alert->register({debug => 3, clear_alert => 1, alert_level => "warning", message => "scan_lvm_alert_0021", message_variables => $variables, set_by => $THIS_FILE}); } else { # LV name changed. my $variables = { - lv_uuid => $scan_lvm_lv_uuid, + lv_uuid => $scan_lvm_lv_internal_uuid, new_lv_name => $scan_lvm_lv_name, old_lv_name => $old_scan_lvm_lv_name, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0022", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0022", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0022", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0022", message_variables => $variables, set_by => $THIS_FILE}); } } if ($scan_lvm_lv_attributes ne $old_scan_lvm_lv_attributes) @@ -195,13 +201,13 @@ sub find_changes_in_lvs $update = 1; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { update => $update }}); my $variables = { - lv_uuid => $scan_lvm_lv_uuid, + lv_uuid => $scan_lvm_lv_internal_uuid, lv_name => $scan_lvm_lv_name, new_attributes => $scan_lvm_lv_attributes, old_attributes => $old_scan_lvm_lv_attributes, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0023", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0023", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0023", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0023", message_variables => $variables, set_by => $THIS_FILE}); } if ($scan_lvm_lv_on_vg ne $old_scan_lvm_lv_on_vg) { @@ -209,13 +215,13 @@ sub find_changes_in_lvs $update = 1; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { update => $update }}); my $variables = { - lv_uuid => $scan_lvm_lv_uuid, + lv_uuid => $scan_lvm_lv_internal_uuid, lv_name => $scan_lvm_lv_name, new_lv_on_vg => $scan_lvm_lv_on_vg, old_lv_on_vg => $old_scan_lvm_lv_on_vg, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0024", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "warning", message => "scan_lvm_alert_0024", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0024", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "warning", message => "scan_lvm_alert_0024", message_variables => $variables, set_by => $THIS_FILE}); } if ($scan_lvm_lv_size ne $old_scan_lvm_lv_size) { @@ -223,7 +229,7 @@ sub find_changes_in_lvs $update = 1; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { update => $update }}); my $variables = { - lv_uuid => $scan_lvm_lv_uuid, + lv_uuid => $scan_lvm_lv_internal_uuid, lv_name => $scan_lvm_lv_name, new_lv_size => $anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_lv_size}), new_lv_size_bytes => $anvil->Convert->add_commas({number => $scan_lvm_lv_size}), @@ -233,14 +239,14 @@ sub find_changes_in_lvs if ($scan_lvm_lv_size > $old_scan_lvm_lv_size) { # Grew, probably added a new PV - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0025", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0025", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0025", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0025", message_variables => $variables, set_by => $THIS_FILE}); } else { # Shrank, - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0026", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0026", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0026", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0026", message_variables => $variables, set_by => $THIS_FILE}); } } if ($scan_lvm_lv_path ne $old_scan_lvm_lv_path) @@ -249,26 +255,26 @@ sub find_changes_in_lvs $update = 1; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { update => $update }}); my $variables = { - lv_uuid => $scan_lvm_lv_uuid, + lv_uuid => $scan_lvm_lv_internal_uuid, lv_name => $scan_lvm_lv_name, new_lv_path => $scan_lvm_lv_path, old_lv_path => $old_scan_lvm_lv_path, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0027", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0027", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0027", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0027", message_variables => $variables, set_by => $THIS_FILE}); } if ($scan_lvm_lv_on_pvs ne $old_scan_lvm_lv_on_pvs) { $update = 1; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { update => $update }}); my $variables = { - lv_uuid => $scan_lvm_lv_uuid, + lv_uuid => $scan_lvm_lv_internal_uuid, lv_name => $scan_lvm_lv_name, new_lv_on_pvs => $scan_lvm_lv_path, old_lv_on_pvs => $old_scan_lvm_lv_path, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0028", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0028", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0028", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0028", message_variables => $variables, set_by => $THIS_FILE}); } $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { update => $update }}); @@ -293,13 +299,13 @@ WHERE } # Delete the loaded entry so we can check for missing PVs later. - delete $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}; + delete $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}; } else { # New VG my $variables = { - lv_uuid => $scan_lvm_lv_uuid, + lv_uuid => $scan_lvm_lv_internal_uuid, lv_name => $scan_lvm_lv_name, attributes => $scan_lvm_lv_attributes, lv_on_vg => $scan_lvm_lv_on_vg, @@ -308,14 +314,16 @@ WHERE lv_path => $scan_lvm_lv_path, lv_on_pvs => $scan_lvm_lv_on_pvs, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0029", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0029", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0029", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0029", message_variables => $variables, set_by => $THIS_FILE}); - my $query = " + my $scan_lvm_lv_uuid = $anvil->Get->uuid(); + my $query = " INSERT INTO scan_lvm_lvs ( - scan_lvm_lv_uuid, + scan_lvm_lv_uuid, + scan_lvm_lv_internal_uuid, scan_lvm_lv_host_uuid, scan_lvm_lv_name, scan_lvm_lv_on_vg, @@ -326,6 +334,7 @@ INSERT INTO modified_date ) VALUES ( ".$anvil->Database->quote($scan_lvm_lv_uuid).", + ".$anvil->Database->quote($scan_lvm_lv_internal_uuid).", ".$anvil->Database->quote($anvil->Get->host_uuid).", ".$anvil->Database->quote($scan_lvm_lv_name).", ".$anvil->Database->quote($scan_lvm_lv_on_vg).", @@ -341,19 +350,24 @@ INSERT INTO } # Any missing LVs? - foreach my $scan_lvm_lv_uuid (keys %{$anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}}) + foreach my $scan_lvm_lv_internal_uuid (keys %{$anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}}) { # This one is missing. - my $old_scan_lvm_lv_name = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_name}; + my $scan_lvm_lv_uuid = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_uuid}; + my $old_scan_lvm_lv_name = $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_name}; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + scan_lvm_lv_uuid => $scan_lvm_lv_uuid, + old_scan_lvm_lv_name => $old_scan_lvm_lv_name, + }}); next if $old_scan_lvm_lv_name eq "DELETED"; # Register an alert my $variables = { - lv_uuid => $scan_lvm_lv_uuid, + lv_uuid => $scan_lvm_lv_internal_uuid, lv_name => $old_scan_lvm_lv_name, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0031", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "warning", message => "scan_lvm_alert_0031", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0031", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "warning", message => "scan_lvm_alert_0031", message_variables => $variables, set_by => $THIS_FILE}); # Update it PV name to be 'DELTED' my $query = " @@ -376,32 +390,34 @@ sub find_changes_in_vgs { my ($anvil) = @_; - foreach my $scan_lvm_vg_uuid (keys %{$anvil->data->{lvm}{scan_lvm_vg_uuid}}) + foreach my $scan_lvm_vg_internal_uuid (keys %{$anvil->data->{lvm}{scan_lvm_vg_internal_uuid}}) { - my $scan_lvm_vg_name = $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{name}; - my $scan_lvm_vg_attributes = $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{attributes}; - my $scan_lvm_vg_extent_size = $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{extent_size}; - my $scan_lvm_vg_size = $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{size}; - my $scan_lvm_vg_free = $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{free_space}; + my $scan_lvm_vg_name = $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{name}; + my $scan_lvm_vg_attributes = $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{attributes}; + my $scan_lvm_vg_extent_size = $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{extent_size}; + my $scan_lvm_vg_size = $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{size}; + my $scan_lvm_vg_free = $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{free_space}; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { - scan_lvm_vg_uuid => $scan_lvm_vg_uuid, - scan_lvm_vg_name => $scan_lvm_vg_name, - scan_lvm_vg_attributes => $scan_lvm_vg_attributes, - scan_lvm_vg_extent_size => $anvil->Convert->add_commas({number => $scan_lvm_vg_extent_size})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_vg_extent_size}), - scan_lvm_vg_size => $anvil->Convert->add_commas({number => $scan_lvm_vg_size})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_vg_size}), - scan_lvm_vg_free => $anvil->Convert->add_commas({number => $scan_lvm_vg_free})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_vg_free}), + scan_lvm_vg_internal_uuid => $scan_lvm_vg_internal_uuid, + scan_lvm_vg_name => $scan_lvm_vg_name, + scan_lvm_vg_attributes => $scan_lvm_vg_attributes, + scan_lvm_vg_extent_size => $anvil->Convert->add_commas({number => $scan_lvm_vg_extent_size})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_vg_extent_size}), + scan_lvm_vg_size => $anvil->Convert->add_commas({number => $scan_lvm_vg_size})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_vg_size}), + scan_lvm_vg_free => $anvil->Convert->add_commas({number => $scan_lvm_vg_free})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_vg_free}), }}); # Have we seen this before? - if (exists $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}) + if (exists $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}) { # Yup, anything changed? - my $old_scan_lvm_vg_name = $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_name}; - my $old_scan_lvm_vg_attributes = $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_attributes}; - my $old_scan_lvm_vg_extent_size = $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_extent_size}; - my $old_scan_lvm_vg_size = $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_size}; - my $old_scan_lvm_vg_free = $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_free}; + my $scan_lvm_vg_uuid = $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_uuid}; + my $old_scan_lvm_vg_name = $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_name}; + my $old_scan_lvm_vg_attributes = $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_attributes}; + my $old_scan_lvm_vg_extent_size = $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_extent_size}; + my $old_scan_lvm_vg_size = $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_size}; + my $old_scan_lvm_vg_free = $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_free}; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + scan_lvm_vg_uuid => $scan_lvm_vg_uuid, old_scan_lvm_vg_name => $old_scan_lvm_vg_name, old_scan_lvm_vg_attributes => $old_scan_lvm_vg_attributes, old_scan_lvm_vg_extent_size => $anvil->Convert->add_commas({number => $old_scan_lvm_vg_extent_size})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $old_scan_lvm_vg_extent_size}),, @@ -418,22 +434,22 @@ sub find_changes_in_vgs { # A lost PV is back my $variables = { - vg_uuid => $scan_lvm_vg_uuid, + vg_uuid => $scan_lvm_vg_internal_uuid, vg_name => $scan_lvm_vg_name, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0011", variables => $variables}); - $anvil->Alert->register({debug => 2, clear_alert => 1, alert_level => "warning", message => "scan_lvm_alert_0011", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0011", variables => $variables}); + $anvil->Alert->register({debug => 3, clear_alert => 1, alert_level => "warning", message => "scan_lvm_alert_0011", message_variables => $variables, set_by => $THIS_FILE}); } else { # Device (name) changed... This can happen if the vg was renamed my $variables = { - vg_uuid => $scan_lvm_vg_uuid, + vg_uuid => $scan_lvm_vg_internal_uuid, new_vg_name => $scan_lvm_vg_name, old_vg_name => $old_scan_lvm_vg_name, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0012", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0012", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0012", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0012", message_variables => $variables, set_by => $THIS_FILE}); } } if ($scan_lvm_vg_attributes ne $old_scan_lvm_vg_attributes) @@ -442,13 +458,13 @@ sub find_changes_in_vgs $update = 1; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { update => $update }}); my $variables = { - vg_uuid => $scan_lvm_vg_uuid, + vg_uuid => $scan_lvm_vg_internal_uuid, vg_name => $scan_lvm_vg_name, new_attributes => $scan_lvm_vg_attributes, old_attributes => $old_scan_lvm_vg_attributes, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0013", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0013", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0013", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0013", message_variables => $variables, set_by => $THIS_FILE}); } if ($scan_lvm_vg_extent_size ne $old_scan_lvm_vg_extent_size) { @@ -456,15 +472,15 @@ sub find_changes_in_vgs $update = 1; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { update => $update }}); my $variables = { - vg_uuid => $scan_lvm_vg_uuid, + vg_uuid => $scan_lvm_vg_internal_uuid, vg_name => $scan_lvm_vg_name, new_vg_extent_size => $anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_vg_extent_size}), new_vg_extent_size_bytes => $anvil->Convert->add_commas({number => $scan_lvm_vg_extent_size}), old_vg_extent_size => $anvil->Convert->bytes_to_human_readable({'bytes' => $old_scan_lvm_vg_extent_size}), old_vg_extent_size_bytes => $anvil->Convert->add_commas({number => $old_scan_lvm_vg_extent_size}), }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0014", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "warning", message => "scan_lvm_alert_0014", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0014", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "warning", message => "scan_lvm_alert_0014", message_variables => $variables, set_by => $THIS_FILE}); } if ($scan_lvm_vg_size ne $old_scan_lvm_vg_size) { @@ -472,7 +488,7 @@ sub find_changes_in_vgs $update = 1; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { update => $update }}); my $variables = { - vg_uuid => $scan_lvm_vg_uuid, + vg_uuid => $scan_lvm_vg_internal_uuid, vg_name => $scan_lvm_vg_name, new_vg_size => $anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_vg_size}), new_vg_size_bytes => $anvil->Convert->add_commas({number => $scan_lvm_vg_size}), @@ -482,14 +498,14 @@ sub find_changes_in_vgs if ($scan_lvm_vg_size > $old_scan_lvm_vg_size) { # Grew, probably added a new PV - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0015", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0015", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0015", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0015", message_variables => $variables, set_by => $THIS_FILE}); } else { # Shrank, wat? - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0016", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "warning", message => "scan_lvm_alert_0016", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0016", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "warning", message => "scan_lvm_alert_0016", message_variables => $variables, set_by => $THIS_FILE}); } } if ($scan_lvm_vg_free ne $old_scan_lvm_vg_free) @@ -498,7 +514,7 @@ sub find_changes_in_vgs $update = 1; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { update => $update }}); my $variables = { - vg_uuid => $scan_lvm_vg_uuid, + vg_uuid => $scan_lvm_vg_internal_uuid, vg_name => $scan_lvm_vg_name, new_vg_free => $anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_vg_free}), new_vg_free_bytes => $anvil->Convert->add_commas({number => $scan_lvm_vg_free}), @@ -508,14 +524,14 @@ sub find_changes_in_vgs if ($scan_lvm_vg_free < $old_scan_lvm_vg_free) { # Likely a new LV was created or an existing one was extended. - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0017", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0017", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0017", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0017", message_variables => $variables, set_by => $THIS_FILE}); } else { # An old LV was probably removed. - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0018", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0018", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0018", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0018", message_variables => $variables, set_by => $THIS_FILE}); } } @@ -533,20 +549,20 @@ SET scan_lvm_vg_free = ".$anvil->Database->quote($scan_lvm_vg_free).", modified_date = ".$anvil->Database->quote($anvil->data->{sys}{database}{timestamp})." WHERE - scan_lvm_vg_uuid = ".$anvil->Database->quote($scan_lvm_vg_uuid)." + scan_lvm_vg_uuid = ".$anvil->Database->quote($scan_lvm_vg_uuid)." ;"; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }}); $anvil->Database->write({query => $query, source => $THIS_FILE, line => __LINE__}); } # Delete the loaded entry so we can check for missing PVs later. - delete $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}; + delete $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}; } else { # New VG my $variables = { - vg_uuid => $scan_lvm_vg_uuid, + vg_uuid => $scan_lvm_vg_internal_uuid, vg_name => $scan_lvm_vg_name, attributes => $scan_lvm_vg_attributes, extent_size => $anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_vg_extent_size}), @@ -556,14 +572,16 @@ WHERE vg_free => $anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_vg_free}), vg_free_bytes => $anvil->Convert->add_commas({number => $scan_lvm_vg_free}), }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0020", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0020", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0020", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0020", message_variables => $variables, set_by => $THIS_FILE}); - my $query = " + my $scan_lvm_vg_uuid = $anvil->Get->uuid(); + my $query = " INSERT INTO scan_lvm_vgs ( - scan_lvm_vg_uuid, + scan_lvm_vg_uuid, + scan_lvm_vg_internal_uuid, scan_lvm_vg_host_uuid, scan_lvm_vg_name, scan_lvm_vg_extent_size, @@ -573,6 +591,7 @@ INSERT INTO modified_date ) VALUES ( ".$anvil->Database->quote($scan_lvm_vg_uuid).", + ".$anvil->Database->quote($scan_lvm_vg_internal_uuid).", ".$anvil->Database->quote($anvil->Get->host_uuid).", ".$anvil->Database->quote($scan_lvm_vg_name).", ".$anvil->Database->quote($scan_lvm_vg_extent_size).", @@ -587,19 +606,24 @@ INSERT INTO } # Any missing VGs? - foreach my $scan_lvm_vg_uuid (keys %{$anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}}) + foreach my $scan_lvm_vg_internal_uuid (keys %{$anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}}) { # This one is missing. - my $old_scan_lvm_vg_name = $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_name}; + my $scan_lvm_vg_uuid = $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_uuid}; + my $old_scan_lvm_vg_name = $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_name}; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + scan_lvm_vg_uuid => $scan_lvm_vg_uuid, + old_scan_lvm_vg_name => $old_scan_lvm_vg_name, + }}); next if $old_scan_lvm_vg_name eq "DELETED"; # Register an alert my $variables = { - vg_uuid => $scan_lvm_vg_uuid, + vg_uuid => $scan_lvm_vg_internal_uuid, vg_name => $old_scan_lvm_vg_name, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0030", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "warning", message => "scan_lvm_alert_0030", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0030", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "warning", message => "scan_lvm_alert_0030", message_variables => $variables, set_by => $THIS_FILE}); # Update it PV name to be 'DELTED' my $query = " @@ -622,15 +646,15 @@ sub find_changes_in_pvs { my ($anvil) = @_; - foreach my $scan_lvm_pv_uuid (keys %{$anvil->data->{lvm}{scan_lvm_pv_uuid}}) + foreach my $scan_lvm_pv_internal_uuid (keys %{$anvil->data->{lvm}{scan_lvm_pv_internal_uuid}}) { - my $scan_lvm_pv_name = $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{name}; - my $scan_lvm_pv_used_by_vg = $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{used_by_vg}; - my $scan_lvm_pv_attributes = $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{attributes}; - my $scan_lvm_pv_size = $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{size}; - my $scan_lvm_pv_free = $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{free_space}; + my $scan_lvm_pv_name = $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{name}; + my $scan_lvm_pv_used_by_vg = $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{used_by_vg}; + my $scan_lvm_pv_attributes = $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{attributes}; + my $scan_lvm_pv_size = $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{size}; + my $scan_lvm_pv_free = $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{free_space}; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { - scan_lvm_pv_uuid => $scan_lvm_pv_uuid, + scan_lvm_pv_internal_uuid => $scan_lvm_pv_internal_uuid, scan_lvm_pv_name => $scan_lvm_pv_name, scan_lvm_pv_used_by_vg => $scan_lvm_pv_used_by_vg, scan_lvm_pv_attributes => $scan_lvm_pv_attributes, @@ -639,14 +663,15 @@ sub find_changes_in_pvs }}); # Have we seen this before? - if (exists $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}) + if (exists $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}) { # Yup, anything changed? - my $old_scan_lvm_pv_name = $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_name}; - my $old_scan_lvm_pv_used_by_vg = $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_used_by_vg}; - my $old_scan_lvm_pv_attributes = $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_attributes}; - my $old_scan_lvm_pv_size = $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_size}; - my $old_scan_lvm_pv_free = $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_free}; + my $scan_lvm_pv_uuid = $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_uuid}; + my $old_scan_lvm_pv_name = $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_name}; + my $old_scan_lvm_pv_used_by_vg = $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_used_by_vg}; + my $old_scan_lvm_pv_attributes = $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_attributes}; + my $old_scan_lvm_pv_size = $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_size}; + my $old_scan_lvm_pv_free = $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_free}; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { old_scan_lvm_pv_name => $old_scan_lvm_pv_name, old_scan_lvm_pv_used_by_vg => $old_scan_lvm_pv_used_by_vg, @@ -664,22 +689,22 @@ sub find_changes_in_pvs { # A lost PV is back my $variables = { - pv_uuid => $scan_lvm_pv_uuid, + pv_uuid => $scan_lvm_pv_internal_uuid, pv_name => $scan_lvm_pv_name, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0001", variables => $variables}); - $anvil->Alert->register({debug => 2, clear_alert => 1, alert_level => "warning", message => "scan_lvm_alert_0001", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0001", variables => $variables}); + $anvil->Alert->register({debug => 3, clear_alert => 1, alert_level => "warning", message => "scan_lvm_alert_0001", message_variables => $variables, set_by => $THIS_FILE}); } else { # Device (name) changed... This shouldn't normally happen. my $variables = { - pv_uuid => $scan_lvm_pv_uuid, + pv_uuid => $scan_lvm_pv_internal_uuid, new_pv_name => $scan_lvm_pv_name, old_pv_name => $old_scan_lvm_pv_name, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0002", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "warning", message => "scan_lvm_alert_0002", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0002", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "warning", message => "scan_lvm_alert_0002", message_variables => $variables, set_by => $THIS_FILE}); } } if ($scan_lvm_pv_used_by_vg ne $old_scan_lvm_pv_used_by_vg) @@ -691,24 +716,24 @@ sub find_changes_in_pvs { # Added to a VG my $variables = { - pv_uuid => $scan_lvm_pv_uuid, + pv_uuid => $scan_lvm_pv_internal_uuid, pv_name => $scan_lvm_pv_name, vg_name => $scan_lvm_pv_used_by_vg, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0004", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0004", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0004", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0004", message_variables => $variables, set_by => $THIS_FILE}); } else { # The VG was probably renamed. my $variables = { - pv_uuid => $scan_lvm_pv_uuid, + pv_uuid => $scan_lvm_pv_internal_uuid, pv_name => $scan_lvm_pv_name, new_vg_name => $scan_lvm_pv_used_by_vg, old_vg_name => $old_scan_lvm_pv_used_by_vg, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0005", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0005", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0005", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0005", message_variables => $variables, set_by => $THIS_FILE}); } } if ($scan_lvm_pv_attributes ne $old_scan_lvm_pv_attributes) @@ -717,13 +742,13 @@ sub find_changes_in_pvs $update = 1; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { update => $update }}); my $variables = { - pv_uuid => $scan_lvm_pv_uuid, + pv_uuid => $scan_lvm_pv_internal_uuid, pv_name => $scan_lvm_pv_name, new_attributes => $scan_lvm_pv_attributes, old_attributes => $old_scan_lvm_pv_attributes, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0006", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0006", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0006", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0006", message_variables => $variables, set_by => $THIS_FILE}); } if ($scan_lvm_pv_size ne $old_scan_lvm_pv_size) { @@ -731,7 +756,7 @@ sub find_changes_in_pvs $update = 1; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { update => $update }}); my $variables = { - pv_uuid => $scan_lvm_pv_uuid, + pv_uuid => $scan_lvm_pv_internal_uuid, pv_name => $scan_lvm_pv_name, new_pv_size => $anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_pv_size}), new_pv_size_bytes => $anvil->Convert->add_commas({number => $scan_lvm_pv_size}), @@ -741,14 +766,14 @@ sub find_changes_in_pvs if ($scan_lvm_pv_size > $old_scan_lvm_pv_size) { # Yup - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0007", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0007", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0007", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0007", message_variables => $variables, set_by => $THIS_FILE}); } else { # Uhhhh... We'll make this a warning as it shouldn't happen. - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0008", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "warning", message => "scan_lvm_alert_0008", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0008", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "warning", message => "scan_lvm_alert_0008", message_variables => $variables, set_by => $THIS_FILE}); } } if ($scan_lvm_pv_free ne $old_scan_lvm_pv_free) @@ -757,7 +782,7 @@ sub find_changes_in_pvs $update = 1; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { update => $update }}); my $variables = { - pv_uuid => $scan_lvm_pv_uuid, + pv_uuid => $scan_lvm_pv_internal_uuid, pv_name => $scan_lvm_pv_name, new_pv_free => $anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_pv_free}), new_pv_free_bytes => $anvil->Convert->add_commas({number => $scan_lvm_pv_free}), @@ -767,14 +792,14 @@ sub find_changes_in_pvs if ($scan_lvm_pv_free < $old_scan_lvm_pv_free) { # Yup - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0009", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0009", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0009", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0009", message_variables => $variables, set_by => $THIS_FILE}); } else { # Uhhhh... We'll make this a warning as it shouldn't happen. - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0010", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "warning", message => "scan_lvm_alert_0010", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0010", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "warning", message => "scan_lvm_alert_0010", message_variables => $variables, set_by => $THIS_FILE}); } } @@ -799,13 +824,13 @@ WHERE } # Delete the loaded entry so we can check for missing PVs later. - delete $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}; + delete $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}; } else { # New PV my $variables = { - pv_uuid => $scan_lvm_pv_uuid, + pv_uuid => $scan_lvm_pv_internal_uuid, pv_name => $scan_lvm_pv_name, vg_name => $scan_lvm_pv_used_by_vg ? $scan_lvm_pv_used_by_vg : "--", attributes => $scan_lvm_pv_attributes, @@ -814,14 +839,16 @@ WHERE pv_free => $anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_pv_free}), pv_free_bytes => $anvil->Convert->add_commas({number => $scan_lvm_pv_free}), }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0019", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "notice", message => "scan_lvm_alert_0019", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0019", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "notice", message => "scan_lvm_alert_0019", message_variables => $variables, set_by => $THIS_FILE}); - my $query = " + my $scan_lvm_pv_uuid = $anvil->Get->uuid(); + my $query = " INSERT INTO scan_lvm_pvs ( - scan_lvm_pv_uuid, + scan_lvm_pv_uuid, + scan_lvm_pv_internal_uuid, scan_lvm_pv_host_uuid, scan_lvm_pv_name, scan_lvm_pv_used_by_vg, @@ -831,6 +858,7 @@ INSERT INTO modified_date ) VALUES ( ".$anvil->Database->quote($scan_lvm_pv_uuid).", + ".$anvil->Database->quote($scan_lvm_pv_internal_uuid).", ".$anvil->Database->quote($anvil->Get->host_uuid).", ".$anvil->Database->quote($scan_lvm_pv_name).", ".$anvil->Database->quote($scan_lvm_pv_used_by_vg).", @@ -845,19 +873,24 @@ INSERT INTO } # Any missing PVs? - foreach my $scan_lvm_pv_uuid (keys %{$anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}}) + foreach my $scan_lvm_pv_internal_uuid (keys %{$anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}}) { # This one is missing. - my $old_scan_lvm_pv_name = $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_name}; + my $scan_lvm_pv_uuid = $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_uuid}; + my $old_scan_lvm_pv_name = $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_name}; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + scan_lvm_pv_uuid => $scan_lvm_pv_uuid, + old_scan_lvm_pv_name => $old_scan_lvm_pv_name, + }}); next if $old_scan_lvm_pv_name eq "DELETED"; # Register an alert my $variables = { - pv_uuid => $scan_lvm_pv_uuid, + pv_uuid => $scan_lvm_pv_internal_uuid, pv_name => $old_scan_lvm_pv_name, }; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "scan_lvm_alert_0003", variables => $variables}); - $anvil->Alert->register({debug => 2, alert_level => "warning", message => "scan_lvm_alert_0003", message_variables => $variables, set_by => $THIS_FILE}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_lvm_alert_0003", variables => $variables}); + $anvil->Alert->register({debug => 3, alert_level => "warning", message => "scan_lvm_alert_0003", message_variables => $variables, set_by => $THIS_FILE}); # Update it PV name to be 'DELTED' my $query = " @@ -885,6 +918,7 @@ sub read_last_scan my $query = " SELECT scan_lvm_pv_uuid, + scan_lvm_pv_internal_uuid, scan_lvm_pv_name, scan_lvm_pv_used_by_vg, scan_lvm_pv_attributes, @@ -907,25 +941,21 @@ WHERE { # We've got an entry in the 'scan_lvm_pv' table, so now we'll look for data in the node and # services tables. - my $scan_lvm_pv_uuid = $row->[0]; - my $scan_lvm_pv_name = $row->[1]; - $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_name} = $scan_lvm_pv_name; - $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_used_by_vg} = $row->[2]; - $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_attributes} = $row->[3]; - $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_size} = $row->[4]; - $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_free} = $row->[5]; + my $scan_lvm_pv_internal_uuid = $row->[1]; + my $scan_lvm_pv_name = $row->[2]; + $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_name} = $row->[0];; + $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_name} = $scan_lvm_pv_name; + $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_used_by_vg} = $row->[3]; + $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_attributes} = $row->[4]; + $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_size} = $row->[5]; + $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_free} = $row->[6]; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { - "sql::scan_lvm_pvs::scan_lvm_pv_uuid::${scan_lvm_pv_uuid}::scan_lvm_pv_name" => $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_name}, - "sql::scan_lvm_pvs::scan_lvm_pv_uuid::${scan_lvm_pv_uuid}::scan_lvm_pv_used_by_vg" => $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_used_by_vg}, - "sql::scan_lvm_pvs::scan_lvm_pv_uuid::${scan_lvm_pv_uuid}::scan_lvm_pv_attributes" => $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_attributes}, - "sql::scan_lvm_pvs::scan_lvm_pv_uuid::${scan_lvm_pv_uuid}::scan_lvm_pv_size" => $anvil->Convert->add_commas({number => $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_size}}), - "sql::scan_lvm_pvs::scan_lvm_pv_uuid::${scan_lvm_pv_uuid}::scan_lvm_pv_free" => $anvil->Convert->add_commas({number => $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_free}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{scan_lvm_pv_free}}), - }}); - - # Store the name to UUID lok up - $anvil->data->{sql}{scan_lvm_pvs}{$scan_lvm_pv_name}{scan_lvm_pv_uuid} = $scan_lvm_pv_uuid; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { - "sql::scan_lvm_pvs::${scan_lvm_pv_name}::scan_lvm_pv_uuid" => $anvil->data->{sql}{scan_lvm_pvs}{$scan_lvm_pv_name}{scan_lvm_pv_uuid}, + "sql::scan_lvm_pvs::scan_lvm_pv_internal_uuid::${scan_lvm_pv_internal_uuid}::scan_lvm_pv_uuid" => $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_uuid}, + "sql::scan_lvm_pvs::scan_lvm_pv_internal_uuid::${scan_lvm_pv_internal_uuid}::scan_lvm_pv_name" => $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_name}, + "sql::scan_lvm_pvs::scan_lvm_pv_internal_uuid::${scan_lvm_pv_internal_uuid}::scan_lvm_pv_used_by_vg" => $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_used_by_vg}, + "sql::scan_lvm_pvs::scan_lvm_pv_internal_uuid::${scan_lvm_pv_internal_uuid}::scan_lvm_pv_attributes" => $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_attributes}, + "sql::scan_lvm_pvs::scan_lvm_pv_internal_uuid::${scan_lvm_pv_internal_uuid}::scan_lvm_pv_size" => $anvil->Convert->add_commas({number => $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_size}}), + "sql::scan_lvm_pvs::scan_lvm_pv_internal_uuid::${scan_lvm_pv_internal_uuid}::scan_lvm_pv_free" => $anvil->Convert->add_commas({number => $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_free}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{sql}{scan_lvm_pvs}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{scan_lvm_pv_free}}), }}); } undef $count; @@ -935,6 +965,7 @@ WHERE $query = " SELECT scan_lvm_vg_uuid, + scan_lvm_vg_internal_uuid, scan_lvm_vg_name, scan_lvm_vg_attributes, scan_lvm_vg_extent_size, @@ -957,25 +988,21 @@ WHERE { # We've got an entry in the 'scan_lvm_vg' table, so now we'll look for data in the node and # services tables. - my $scan_lvm_vg_uuid = $row->[0]; - my $scan_lvm_vg_name = $row->[1]; - $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_name} = $scan_lvm_vg_name; - $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_attributes} = $row->[2]; - $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_extent_size} = $row->[3]; - $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_size} = $row->[4]; - $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_free} = $row->[5]; + my $scan_lvm_vg_internal_uuid = $row->[1]; + my $scan_lvm_vg_name = $row->[2]; + $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_uuid} = $row->[0]; + $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_name} = $scan_lvm_vg_name; + $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_attributes} = $row->[3]; + $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_extent_size} = $row->[4]; + $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_size} = $row->[5]; + $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_free} = $row->[6]; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { - "sql::scan_lvm_vgs::scan_lvm_vg_uuid::${scan_lvm_vg_uuid}::scan_lvm_vg_name" => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_name}, - "sql::scan_lvm_vgs::scan_lvm_vg_uuid::${scan_lvm_vg_uuid}::scan_lvm_vg_attributes" => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_attributes}, - "sql::scan_lvm_vgs::scan_lvm_vg_uuid::${scan_lvm_vg_uuid}::scan_lvm_vg_extent_size" => $anvil->Convert->add_commas({number => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_extent_size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_extent_size}}), - "sql::scan_lvm_vgs::scan_lvm_vg_uuid::${scan_lvm_vg_uuid}::scan_lvm_vg_size" => $anvil->Convert->add_commas({number => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_size}}), - "sql::scan_lvm_vgs::scan_lvm_vg_uuid::${scan_lvm_vg_uuid}::scan_lvm_vg_free" => $anvil->Convert->add_commas({number => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_free}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{scan_lvm_vg_free}}), - }}); - - # Store the name to UUID lok up - $anvil->data->{sql}{scan_lvm_vgs}{$scan_lvm_vg_name}{scan_lvm_vg_uuid} = $scan_lvm_vg_uuid; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { - "sql::scan_lvm_vgs::${scan_lvm_vg_name}::scan_lvm_vg_uuid" => $anvil->data->{sql}{scan_lvm_vgs}{$scan_lvm_vg_name}{scan_lvm_vg_uuid}, + "sql::scan_lvm_vgs::scan_lvm_vg_internal_uuid::${scan_lvm_vg_internal_uuid}::scan_lvm_vg_uuid" => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_uuid}, + "sql::scan_lvm_vgs::scan_lvm_vg_internal_uuid::${scan_lvm_vg_internal_uuid}::scan_lvm_vg_name" => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_name}, + "sql::scan_lvm_vgs::scan_lvm_vg_internal_uuid::${scan_lvm_vg_internal_uuid}::scan_lvm_vg_attributes" => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_attributes}, + "sql::scan_lvm_vgs::scan_lvm_vg_internal_uuid::${scan_lvm_vg_internal_uuid}::scan_lvm_vg_extent_size" => $anvil->Convert->add_commas({number => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_extent_size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_extent_size}}), + "sql::scan_lvm_vgs::scan_lvm_vg_internal_uuid::${scan_lvm_vg_internal_uuid}::scan_lvm_vg_size" => $anvil->Convert->add_commas({number => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_size}}), + "sql::scan_lvm_vgs::scan_lvm_vg_internal_uuid::${scan_lvm_vg_internal_uuid}::scan_lvm_vg_free" => $anvil->Convert->add_commas({number => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_free}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{sql}{scan_lvm_vgs}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_free}}), }}); } undef $count; @@ -985,6 +1012,7 @@ WHERE $query = " SELECT scan_lvm_lv_uuid, + scan_lvm_lv_internal_uuid, scan_lvm_lv_name, scan_lvm_lv_attributes, scan_lvm_lv_on_vg, @@ -1008,27 +1036,23 @@ WHERE { # We've got an entry in the 'scan_lvm_lv' table, so now we'll look for data in the node and # services tables. - my $scan_lvm_lv_uuid = $row->[0]; - my $scan_lvm_lv_name = $row->[1]; - $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_name} = $scan_lvm_lv_name; - $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_attributes} = $row->[2]; - $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_on_vg} = $row->[3]; - $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_size} = $row->[4]; - $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_path} = $row->[5]; - $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_on_pvs} = $row->[6]; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { - "sql::scan_lvm_lvs::scan_lvm_lv_uuid::${scan_lvm_lv_uuid}::scan_lvm_lv_name" => $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_name}, - "sql::scan_lvm_lvs::scan_lvm_lv_uuid::${scan_lvm_lv_uuid}::scan_lvm_lv_attributes" => $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_attributes}, - "sql::scan_lvm_lvs::scan_lvm_lv_uuid::${scan_lvm_lv_uuid}::scan_lvm_lv_on_vg" => $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_on_vg}, - "sql::scan_lvm_lvs::scan_lvm_lv_uuid::${scan_lvm_lv_uuid}::scan_lvm_lv_size" => $anvil->Convert->add_commas({number => $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_size}}), - "sql::scan_lvm_lvs::scan_lvm_lv_uuid::${scan_lvm_lv_uuid}::scan_lvm_lv_path" => $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_path}, - "sql::scan_lvm_lvs::scan_lvm_lv_uuid::${scan_lvm_lv_uuid}::scan_lvm_lv_on_pvs" => $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{scan_lvm_lv_on_pvs}, - }}); - - # Store the name to UUID lok up - $anvil->data->{sql}{scan_lvm_lvs}{$scan_lvm_lv_name}{scan_lvm_lv_uuid} = $scan_lvm_lv_uuid; + my $scan_lvm_lv_internal_uuid = $row->[1]; + my $scan_lvm_lv_name = $row->[2]; + $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_uuid} = $row->[0]; + $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_name} = $scan_lvm_lv_name; + $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_attributes} = $row->[3]; + $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_on_vg} = $row->[4]; + $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_size} = $row->[5]; + $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_path} = $row->[6]; + $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_on_pvs} = $row->[7]; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { - "sql::scan_lvm_lvs::${scan_lvm_lv_name}::scan_lvm_lv_uuid" => $anvil->data->{sql}{scan_lvm_lvs}{$scan_lvm_lv_name}{scan_lvm_lv_uuid}, + "sql::scan_lvm_lvs::scan_lvm_lv_internal_uuid::${scan_lvm_lv_internal_uuid}::scan_lvm_lv_uuid" => $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_uuid}, + "sql::scan_lvm_lvs::scan_lvm_lv_internal_uuid::${scan_lvm_lv_internal_uuid}::scan_lvm_lv_name" => $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_name}, + "sql::scan_lvm_lvs::scan_lvm_lv_internal_uuid::${scan_lvm_lv_internal_uuid}::scan_lvm_lv_attributes" => $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_attributes}, + "sql::scan_lvm_lvs::scan_lvm_lv_internal_uuid::${scan_lvm_lv_internal_uuid}::scan_lvm_lv_on_vg" => $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_on_vg}, + "sql::scan_lvm_lvs::scan_lvm_lv_internal_uuid::${scan_lvm_lv_internal_uuid}::scan_lvm_lv_size" => $anvil->Convert->add_commas({number => $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_size}}), + "sql::scan_lvm_lvs::scan_lvm_lv_internal_uuid::${scan_lvm_lv_internal_uuid}::scan_lvm_lv_path" => $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_path}, + "sql::scan_lvm_lvs::scan_lvm_lv_internal_uuid::${scan_lvm_lv_internal_uuid}::scan_lvm_lv_on_pvs" => $anvil->data->{sql}{scan_lvm_lvs}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{scan_lvm_lv_on_pvs}, }}); } undef $count; @@ -1063,18 +1087,18 @@ sub collect_pvs_data my $pvs_data = $json->decode($output); foreach my $hash_ref (@{$pvs_data->{report}->[0]->{pv}}) { - my $scan_lvm_pv_uuid = $hash_ref->{pv_uuid}; - $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{name} = $hash_ref->{pv_name}; - $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{used_by_vg} = $hash_ref->{vg_name}; - $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{attributes} = $hash_ref->{pv_attr}; # TODO: Parse this out - $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{size} = ($hash_ref->{pv_size} =~ /^(\d+)B/)[0]; - $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{free_space} = ($hash_ref->{pv_free} =~ /^(\d+)B/)[0]; + my $scan_lvm_pv_internal_uuid = $hash_ref->{pv_uuid}; + $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{name} = $hash_ref->{pv_name}; + $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{used_by_vg} = $hash_ref->{vg_name}; + $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{attributes} = $hash_ref->{pv_attr}; # TODO: Parse this out + $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{size} = ($hash_ref->{pv_size} =~ /^(\d+)B/)[0]; + $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{free_space} = ($hash_ref->{pv_free} =~ /^(\d+)B/)[0]; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { - "lvm::scan_lvm_pv_uuid::${scan_lvm_pv_uuid}::name" => $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{name}, - "lvm::scan_lvm_pv_uuid::${scan_lvm_pv_uuid}::used_by_vg" => $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{used_by_vg}, - "lvm::scan_lvm_pv_uuid::${scan_lvm_pv_uuid}::attributes" => $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{attributes}, - "lvm::scan_lvm_pv_uuid::${scan_lvm_pv_uuid}::size" => $anvil->Convert->add_commas({number => $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{size}}).")", - "lvm::scan_lvm_pv_uuid::${scan_lvm_pv_uuid}::free_space" => $anvil->Convert->add_commas({number => $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{free_space}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{lvm}{scan_lvm_pv_uuid}{$scan_lvm_pv_uuid}{free_space}}).")", + "lvm::scan_lvm_pv_internal_uuid::${scan_lvm_pv_internal_uuid}::name" => $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{name}, + "lvm::scan_lvm_pv_internal_uuid::${scan_lvm_pv_internal_uuid}::used_by_vg" => $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{used_by_vg}, + "lvm::scan_lvm_pv_internal_uuid::${scan_lvm_pv_internal_uuid}::attributes" => $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{attributes}, + "lvm::scan_lvm_pv_internal_uuid::${scan_lvm_pv_internal_uuid}::size" => $anvil->Convert->add_commas({number => $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{size}}).")", + "lvm::scan_lvm_pv_internal_uuid::${scan_lvm_pv_internal_uuid}::free_space" => $anvil->Convert->add_commas({number => $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{free_space}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{lvm}{scan_lvm_pv_internal_uuid}{$scan_lvm_pv_internal_uuid}{free_space}}).")", }}); } @@ -1095,18 +1119,18 @@ sub collect_vgs_data my $vgs_data = $json->decode($output); foreach my $hash_ref (@{$vgs_data->{report}->[0]->{vg}}) { - my $scan_lvm_vg_uuid = $hash_ref->{vg_uuid}; - $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{name} = $hash_ref->{vg_name}; - $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{attributes} = $hash_ref->{vg_attr}; - $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{extent_size} = ($hash_ref->{vg_extent_size} =~ /^(\d+)B/)[0]; - $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{size} = ($hash_ref->{vg_size} =~ /^(\d+)B/)[0]; - $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{free_space} = ($hash_ref->{vg_free} =~ /^(\d+)B/)[0]; + my $scan_lvm_vg_internal_uuid = $hash_ref->{vg_uuid}; + $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{name} = $hash_ref->{vg_name}; + $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{attributes} = $hash_ref->{vg_attr}; + $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{extent_size} = ($hash_ref->{vg_extent_size} =~ /^(\d+)B/)[0]; + $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{size} = ($hash_ref->{vg_size} =~ /^(\d+)B/)[0]; + $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{free_space} = ($hash_ref->{vg_free} =~ /^(\d+)B/)[0]; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { - "lvm::scan_lvm_vg_uuid::${scan_lvm_vg_uuid}::name" => $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{name}, - "lvm::scan_lvm_vg_uuid::${scan_lvm_vg_uuid}::attributes" => $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{attributes}, - "lvm::scan_lvm_vg_uuid::${scan_lvm_vg_uuid}::extent_size" => $anvil->Convert->add_commas({number => $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{extent_size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{extent_size}}), - "lvm::scan_lvm_vg_uuid::${scan_lvm_vg_uuid}::size" => $anvil->Convert->add_commas({number => $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{size}}), - "lvm::scan_lvm_vg_uuid::${scan_lvm_vg_uuid}::free_space" => $anvil->Convert->add_commas({number => $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{free_space}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{lvm}{scan_lvm_vg_uuid}{$scan_lvm_vg_uuid}{free_space}}), + "lvm::scan_lvm_vg_internal_uuid::${scan_lvm_vg_internal_uuid}::name" => $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{name}, + "lvm::scan_lvm_vg_internal_uuid::${scan_lvm_vg_internal_uuid}::attributes" => $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{attributes}, + "lvm::scan_lvm_vg_internal_uuid::${scan_lvm_vg_internal_uuid}::extent_size" => $anvil->Convert->add_commas({number => $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{extent_size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{extent_size}}), + "lvm::scan_lvm_vg_internal_uuid::${scan_lvm_vg_internal_uuid}::size" => $anvil->Convert->add_commas({number => $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{size}}), + "lvm::scan_lvm_vg_internal_uuid::${scan_lvm_vg_internal_uuid}::free_space" => $anvil->Convert->add_commas({number => $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{free_space}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{lvm}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{free_space}}), }}); } @@ -1127,33 +1151,33 @@ sub collect_lvs_data my $lvs_data = $json->decode($output); foreach my $hash_ref (@{$lvs_data->{report}->[0]->{lv}}) { - my $scan_lvm_lv_uuid = $hash_ref->{lv_uuid}; - my $on_pvs = $hash_ref->{devices}; - $on_pvs =~ s/\(\d+\)//g; + my $scan_lvm_lv_internal_uuid = $hash_ref->{lv_uuid}; + my $on_pvs = $hash_ref->{devices}; + $on_pvs =~ s/\(\d+\)//g; # In JSON format, there are 2+ hash references when there are 2+ PVs under an LV. So we # record all data on the first pass and append the additional PVs. - if (not exists $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}) + if (not exists $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}) { - $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{name} = $hash_ref->{lv_name}; - $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{attributes} = $hash_ref->{lv_attr}; - $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{on_vg} = $hash_ref->{vg_name}; - $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{device_path} = $hash_ref->{lv_path}; - $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{size} = ($hash_ref->{lv_size} =~ /^(\d+)B/)[0]; - $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{on_pvs} = $on_pvs; + $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{name} = $hash_ref->{lv_name}; + $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{attributes} = $hash_ref->{lv_attr}; + $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{on_vg} = $hash_ref->{vg_name}; + $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{device_path} = $hash_ref->{lv_path}; + $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{size} = ($hash_ref->{lv_size} =~ /^(\d+)B/)[0]; + $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{on_pvs} = $on_pvs; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { - "lvm::scan_lvm_lv_uuid::${scan_lvm_lv_uuid}::name" => $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{name}, - "lvm::scan_lvm_lv_uuid::${scan_lvm_lv_uuid}::attributes" => $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{attributes}, - "lvm::scan_lvm_lv_uuid::${scan_lvm_lv_uuid}::on_vg" => $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{on_vg}, - "lvm::scan_lvm_lv_uuid::${scan_lvm_lv_uuid}::device_path" => $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{device_path}, - "lvm::scan_lvm_lv_uuid::${scan_lvm_lv_uuid}::size" => $anvil->Convert->add_commas({number => $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{size}}), - "lvm::scan_lvm_lv_uuid::${scan_lvm_lv_uuid}::on_pvs" => $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{on_pvs}, + "lvm::scan_lvm_lv_internal_uuid::${scan_lvm_lv_internal_uuid}::name" => $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{name}, + "lvm::scan_lvm_lv_internal_uuid::${scan_lvm_lv_internal_uuid}::attributes" => $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{attributes}, + "lvm::scan_lvm_lv_internal_uuid::${scan_lvm_lv_internal_uuid}::on_vg" => $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{on_vg}, + "lvm::scan_lvm_lv_internal_uuid::${scan_lvm_lv_internal_uuid}::device_path" => $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{device_path}, + "lvm::scan_lvm_lv_internal_uuid::${scan_lvm_lv_internal_uuid}::size" => $anvil->Convert->add_commas({number => $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{size}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{size}}), + "lvm::scan_lvm_lv_internal_uuid::${scan_lvm_lv_internal_uuid}::on_pvs" => $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{on_pvs}, }}); } else { - $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{on_pvs} .= ",".$on_pvs; + $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{on_pvs} .= ",".$on_pvs; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { - "lvm::scan_lvm_lv_uuid::${scan_lvm_lv_uuid}::on_pvs" => $anvil->data->{lvm}{scan_lvm_lv_uuid}{$scan_lvm_lv_uuid}{on_pvs}, + "lvm::scan_lvm_lv_internal_uuid::${scan_lvm_lv_internal_uuid}::on_pvs" => $anvil->data->{lvm}{scan_lvm_lv_internal_uuid}{$scan_lvm_lv_internal_uuid}{on_pvs}, }}); } } diff --git a/scancore-agents/scan-lvm/scan-lvm.sql b/scancore-agents/scan-lvm/scan-lvm.sql index c51ac4dd..8c948f00 100644 --- a/scancore-agents/scan-lvm/scan-lvm.sql +++ b/scancore-agents/scan-lvm/scan-lvm.sql @@ -3,29 +3,31 @@ -- This table stores physical volume information CREATE TABLE scan_lvm_pvs ( - scan_lvm_pv_uuid uuid primary key, -- This comes from the PV itself. - scan_lvm_pv_host_uuid uuid not null, - scan_lvm_pv_name text not null, -- This is the name of the PV. - scan_lvm_pv_used_by_vg text not null, -- This is the name of the VG that uses this PV. If it's blank, then no VG uses it yet. - scan_lvm_pv_attributes text not null, -- This is the short 3-character attribute of the PV - scan_lvm_pv_size numeric not null, -- The size of the PV in bytes - scan_lvm_pv_free numeric not null, -- The free space, in bytes. - modified_date timestamp with time zone not null, + scan_lvm_pv_uuid uuid primary key, + scan_lvm_pv_host_uuid uuid not null, + scan_lvm_pv_internal_uuid text not null, -- This comes from the PV itself. This is not a valid UUID format, so we use it more as a "serial number" + scan_lvm_pv_name text not null, -- This is the name of the PV. + scan_lvm_pv_used_by_vg text not null, -- This is the name of the VG that uses this PV. If it's blank, then no VG uses it yet. + scan_lvm_pv_attributes text not null, -- This is the short 3-character attribute of the PV + scan_lvm_pv_size numeric not null, -- The size of the PV in bytes + scan_lvm_pv_free numeric not null, -- The free space, in bytes. + modified_date timestamp with time zone not null, FOREIGN KEY(scan_lvm_pv_host_uuid) REFERENCES hosts(host_uuid) ); ALTER TABLE scan_lvm_pvs OWNER TO admin; CREATE TABLE history.scan_lvm_pvs ( - history_id bigserial, - scan_lvm_pv_uuid uuid, - scan_lvm_pv_host_uuid uuid, - scan_lvm_pv_name text, - scan_lvm_pv_used_by_vg text, - scan_lvm_pv_attributes text, - scan_lvm_pv_size numeric, - scan_lvm_pv_free numeric, - modified_date timestamp with time zone not null + history_id bigserial, + scan_lvm_pv_uuid uuid, + scan_lvm_pv_host_uuid uuid, + scan_lvm_pv_internal_uuid text, + scan_lvm_pv_name text, + scan_lvm_pv_used_by_vg text, + scan_lvm_pv_attributes text, + scan_lvm_pv_size numeric, + scan_lvm_pv_free numeric, + modified_date timestamp with time zone not null ); ALTER TABLE history.scan_lvm_pvs OWNER TO admin; @@ -38,6 +40,7 @@ BEGIN INSERT INTO history.scan_lvm_pvs (scan_lvm_pv_uuid, scan_lvm_pv_host_uuid, + scan_lvm_pv_internal_uuid, scan_lvm_pv_name, scan_lvm_pv_used_by_vg, scan_lvm_pv_attributes, @@ -47,6 +50,7 @@ BEGIN VALUES (history_scan_lvm_pvs.scan_lvm_pv_uuid, history_scan_lvm_pvs.scan_lvm_pv_host_uuid, + history_scan_lvm_pvs.scan_lvm_pv_internal_uuid, history_scan_lvm_pvs.scan_lvm_pv_name, history_scan_lvm_pvs.scan_lvm_pv_used_by_vg, history_scan_lvm_pvs.scan_lvm_pv_attributes, @@ -66,29 +70,31 @@ CREATE TRIGGER trigger_scan_lvm_pvs -- This table stores volume group information CREATE TABLE scan_lvm_vgs ( - scan_lvm_vg_uuid uuid primary key, -- This comes from the VG itself. - scan_lvm_vg_host_uuid uuid not null, - scan_lvm_vg_name text not null, -- This is the name of the VG. - scan_lvm_vg_attributes text not null, -- This is the short 6-character attribute of the VG - scan_lvm_vg_extent_size numeric not null, -- The size of each physical extent, in bytes. - scan_lvm_vg_size numeric not null, -- The size of the VG, in bytes. - scan_lvm_vg_free numeric not null, -- The free space in the VG, in bytes. - modified_date timestamp with time zone not null, + scan_lvm_vg_uuid uuid primary key, + scan_lvm_vg_host_uuid uuid not null, + scan_lvm_vg_internal_uuid text not null, -- This comes from the VG itself. This is not a valid UUID format, so we use it more as a "serial number" + scan_lvm_vg_name text not null, -- This is the name of the VG. + scan_lvm_vg_attributes text not null, -- This is the short 6-character attribute of the VG + scan_lvm_vg_extent_size numeric not null, -- The size of each physical extent, in bytes. + scan_lvm_vg_size numeric not null, -- The size of the VG, in bytes. + scan_lvm_vg_free numeric not null, -- The free space in the VG, in bytes. + modified_date timestamp with time zone not null, FOREIGN KEY(scan_lvm_vg_host_uuid) REFERENCES hosts(host_uuid) ); ALTER TABLE scan_lvm_vgs OWNER TO admin; CREATE TABLE history.scan_lvm_vgs ( - history_id bigserial, - scan_lvm_vg_uuid uuid, - scan_lvm_vg_host_uuid uuid, - scan_lvm_vg_name text, - scan_lvm_vg_attributes text, - scan_lvm_vg_extent_size numeric, - scan_lvm_vg_size numeric, - scan_lvm_vg_free numeric, - modified_date timestamp with time zone not null + history_id bigserial, + scan_lvm_vg_uuid uuid, + scan_lvm_vg_host_uuid uuid, + scan_lvm_vg_internal_uuid text, + scan_lvm_vg_name text, + scan_lvm_vg_attributes text, + scan_lvm_vg_extent_size numeric, + scan_lvm_vg_size numeric, + scan_lvm_vg_free numeric, + modified_date timestamp with time zone not null ); ALTER TABLE history.scan_lvm_vgs OWNER TO admin; @@ -101,6 +107,7 @@ BEGIN INSERT INTO history.scan_lvm_vgs (scan_lvm_vg_uuid, scan_lvm_vg_host_uuid, + scan_lvm_vg_internal_uuid, scan_lvm_vg_name, scan_lvm_vg_attributes, scan_lvm_vg_extent_size, @@ -110,6 +117,7 @@ BEGIN VALUES (history_scan_lvm_vgs.scan_lvm_vg_uuid, history_scan_lvm_vgs.scan_lvm_vg_host_uuid, + history_scan_lvm_vgs.scan_lvm_vg_internal_uuid, history_scan_lvm_vgs.scan_lvm_vg_name, history_scan_lvm_vgs.scan_lvm_vg_attributes, history_scan_lvm_vgs.scan_lvm_vg_extent_size, @@ -129,31 +137,33 @@ CREATE TRIGGER trigger_scan_lvm_vgs --lvs - lv_name,lv_uuid,lv_attr,vg_name,lv_size,lv_path,devices CREATE TABLE scan_lvm_lvs ( - scan_lvm_lv_uuid uuid primary key, -- This comes from the VG itself. - scan_lvm_lv_host_uuid uuid not null, - scan_lvm_lv_name text not null, -- This is the name of the VG. - scan_lvm_lv_attributes text not null, -- This is the short 9-character attribute of the LV - scan_lvm_lv_on_vg text not null, -- This is the name of the volume group this LV is on - scan_lvm_lv_size numeric not null, -- The size of the VG, in bytes. - scan_lvm_lv_path text not null, -- The device path to this LV - scan_lvm_lv_on_pvs text not null, -- This is a comma-separated list of PVs this LV spans over. - modified_date timestamp with time zone not null, + scan_lvm_lv_uuid uuid primary key, + scan_lvm_lv_host_uuid uuid not null, + scan_lvm_lv_internal_uuid text not null, -- This comes from the LV itself. This is not a valid UUID format, so we use it more as a "serial number" + scan_lvm_lv_name text not null, -- This is the name of the VG. + scan_lvm_lv_attributes text not null, -- This is the short 9-character attribute of the LV + scan_lvm_lv_on_vg text not null, -- This is the name of the volume group this LV is on + scan_lvm_lv_size numeric not null, -- The size of the VG, in bytes. + scan_lvm_lv_path text not null, -- The device path to this LV + scan_lvm_lv_on_pvs text not null, -- This is a comma-separated list of PVs this LV spans over. + modified_date timestamp with time zone not null, FOREIGN KEY(scan_lvm_lv_host_uuid) REFERENCES hosts(host_uuid) ); ALTER TABLE scan_lvm_lvs OWNER TO admin; CREATE TABLE history.scan_lvm_lvs ( - history_id bigserial, - scan_lvm_lv_uuid uuid, - scan_lvm_lv_host_uuid uuid, - scan_lvm_lv_name text, - scan_lvm_lv_attributes text, - scan_lvm_lv_on_vg text, - scan_lvm_lv_size numeric, - scan_lvm_lv_path text, - scan_lvm_lv_on_pvs text, - modified_date timestamp with time zone not null + history_id bigserial, + scan_lvm_lv_uuid uuid, + scan_lvm_lv_host_uuid uuid, + scan_lvm_lv_internal_uuid text, + scan_lvm_lv_name text, + scan_lvm_lv_attributes text, + scan_lvm_lv_on_vg text, + scan_lvm_lv_size numeric, + scan_lvm_lv_path text, + scan_lvm_lv_on_pvs text, + modified_date timestamp with time zone not null ); ALTER TABLE history.scan_lvm_lvs OWNER TO admin; @@ -166,6 +176,7 @@ BEGIN INSERT INTO history.scan_lvm_lvs (scan_lvm_lv_uuid, scan_lvm_lv_host_uuid, + scan_lvm_lv_internal_uuid, scan_lvm_lv_name, scan_lvm_lv_attributes, scan_lvm_lv_on_vg, @@ -176,6 +187,7 @@ BEGIN VALUES (history_scan_lvm_lvs.scan_lvm_lv_uuid, history_scan_lvm_lvs.scan_lvm_lv_host_uuid, + history_scan_lvm_lvs.scan_lvm_lv_internal_uuid, history_scan_lvm_lvs.scan_lvm_lv_name, history_scan_lvm_lvs.scan_lvm_lv_attributes, history_scan_lvm_lvs.scan_lvm_lv_on_vg, diff --git a/scancore-agents/scan-lvm/scan-lvm.xml b/scancore-agents/scan-lvm/scan-lvm.xml index 1d982deb..2a12aced 100644 --- a/scancore-agents/scan-lvm/scan-lvm.xml +++ b/scancore-agents/scan-lvm/scan-lvm.xml @@ -20,10 +20,12 @@ NOTE: All string keys MUST be prefixed with the agent name! ie: 'scan_lvm_log_00 The physical volume: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) has been assigned to the volume group: [#!variable!vg_name!#]. The physical volume: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) has been assigned to the volume group: [#!variable!new_vg_name!#]. It used to be assigned to: [#!variable!old_vg_name!#]. Did the volume group name change? If so, then this is not a concern. The physical volume: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) attribute bits have changed from: [#!variable!old_attributes!#] to: [#!variable!new_attributes!#]. +==== The attribute bits are: 1 - (d)uplicate, (a)llocatable, (u)sed 2 - e(x)ported 3 - (m)issing +==== The physical volume: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) has increased in size from: [#!variable!old_pv_size!#] (#!variable!old_pv_size_bytes!# bytes) to: [#!variable!new_pv_size!#] (#!variable!new_pv_size_bytes!# bytes). This is the expected if you grew the disk. The physical volume: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) has decreased in size from: [#!variable!old_pv_size!#] (#!variable!old_pv_size_bytes!# bytes) to: [#!variable!new_pv_size!#] (#!variable!new_pv_size_bytes!# bytes). @@ -32,6 +34,7 @@ The attribute bits are: The volume group: [#!variable!vg_name!#] (UUID: [#!variable!vg_uuid!#]) has returned. This is normal if the VG is on a removable medium like a USB disk. The volume group: [#!variable!old_vg_name!#] (UUID: [#!variable!vg_uuid!#]) has changed to: [#!variable!new_vg_name!#]. The volume group: [#!variable!vg_name!#] (UUID: [#!variable!vg_uuid!#]) attribute bits have changed from: [#!variable!old_attributes!#] to: [#!variable!new_attributes!#]. +==== The attribute bits are: 1 - Permissions: (w)riteable, (r)ead-only 2 - Resi(z)eable @@ -39,6 +42,7 @@ The attribute bits are: 4 - (p)artial: one or more physical volumes belonging to the volume group are missing from the system 5 - Allocation policy: (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere 6 - (c)lustered, (s)hared +==== The volume group: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) extent size has changed from: [#!variable!old_vg_extent_size!#] (#!variable!old_vg_extent_size_bytes!# bytes) to: [#!variable!new_pv_size!#] (#!variable!new_pv_size_bytes!# bytes). This should never happen... The volume group: [#!variable!vg_name!#] (UUID: [#!variable!vg_uuid!#]) has increased in size from: [#!variable!old_vg_size!#] (#!variable!old_vg_size_bytes!# bytes) to: [#!variable!new_vg_size!#] (#!variable!new_vg_size_bytes!# bytes). This is the expected if you added a PV to this VG. @@ -50,18 +54,19 @@ Assigned to VG: [#!variable!vg_name!#] Attribute bits: [#!variable!attributes!#] PV Size: ...... [#!variable!pv_size!#] (#!variable!pv_size_bytes!# bytes) Free Space: ... [#!variable!pv_free!#] (#!variable!pv_free_bytes!# bytes) - +==== The attribute bits are: 1 - (d)uplicate, (a)llocatable, (u)sed 2 - e(x)ported 3 - (m)issing +==== The new volume group: [#!variable!vg_name!#] (UUID: [#!variable!vg_uuid!#]) has been found. Attribute bits: [#!variable!attributes!#] VG Size: ...... [#!variable!vg_size!#] (#!variable!vg_size_bytes!# bytes) Free Space: ... [#!variable!vg_free!#] (#!variable!vg_free_bytes!# bytes) Extent Size: .. [#!variable!extent_size!#] (#!variable!extent_size_bytes!# bytes) - +==== The attribute bits are: 1 - Permissions: (w)riteable, (r)ead-only 2 - Resi(z)eable @@ -69,10 +74,12 @@ The attribute bits are: 4 - (p)artial: one or more physical volumes belonging to the volume group are missing from the system 5 - Allocation policy: (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere 6 - (c)lustered, (s)hared +==== The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) has returned. This is normal if the LV is on a removable medium like a USB disk. The logical volume: [#!variable!old_lv_name!#] (UUID: [#!variable!lv_uuid!#]) has changed to: [#!variable!new_lv_name!#]. The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) attribute bits have changed from: [#!variable!old_attributes!#] to: [#!variable!new_attributes!#]. +==== The attribute bits are: 1 - Volume type: * (C)ache, @@ -133,19 +140,20 @@ The attribute bits are: * (v)irtual. 8 - Newly-allocated data blocks are overwritten with blocks of (z)eroes before use. 9 - Volume Health, where there are currently three groups of attributes identified: +==== The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) is on a volume group that has changed its name from: [#!variable!old_lv_on_vg!#] to: [#!variable!new_lv_on_vg!#]. The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) has increased in size from: [#!variable!old_lv_size!#] (#!variable!old_lv_size_bytes!# bytes) to: [#!variable!new_lv_size!#] (#!variable!new_lv_size_bytes!# bytes). This is expected when an LV is extended. The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) has decreased in size from: [#!variable!old_lv_size!#] (#!variable!old_lv_size_bytes!# bytes) to: [#!variable!new_lv_size!#] (#!variable!new_lv_size_bytes!# bytes). This is expected when an LV is shrunk. The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) device path has changed from: [#!variable!old_lv_path!#] to: [#!variable!new_lv_path!#]. The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) list of physical volumes is spans has changed from: [#!variable!old_lv_on_pvs!#] to: [#!variable!new_lv_on_pvs!#]. - The new logical volume: [#!variable!vg_name!#] (UUID: [#!variable!vg_uuid!#]) has been found. + The new logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) has been found. Attribute bits: [#!variable!attributes!#] LV on VG: ..... [#!variable!lv_on_vg!#] -LV Size: ...... [#!variable!vg_size!#] (#!variable!vg_size_bytes!# bytes) -Device path: .. [#!variable!lv_on_vg!#] +LV Size: ...... [#!variable!lv_size!#] (#!variable!lv_size_bytes!# bytes) +Device path: .. [#!variable!lv_path!#] Using PV(s): .. [#!variable!lv_on_pvs!#] - +==== The attribute bits are: 1 - Volume type: * (C)ache, @@ -206,6 +214,7 @@ The attribute bits are: * (v)irtual. 8 - Newly-allocated data blocks are overwritten with blocks of (z)eroes before use. 9 - Volume Health, where there are currently three groups of attributes identified: +==== The volume group: [#!variable!vg_name!#] (UUID: [#!variable!vg_uuid!#]) has vanished! If this is a removable device, like a USB drive, this is OK. Otherwise, it could be the sign of a disk failure. The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) has been lost. This is normal if the LV is on a removable medium like a USB disk. Otherwise, it could be the sign of a disk failure.