@ -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 $scan_lvm_lv_uuid = $anvil->Get->uuid();
my $query = "
INSERT INTO
scan_lvm_lvs
(
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,15 +390,15 @@ 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_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}),
@ -393,15 +407,17 @@ sub find_changes_in_vgs
}});
# 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});
}
}
@ -540,13 +556,13 @@ WHERE
}
# 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 $scan_lvm_vg_uuid = $anvil->Get->uuid();
my $query = "
INSERT INTO
scan_lvm_vgs
(
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 $scan_lvm_pv_uuid = $anvil->Get->uuid();
my $query = "
INSERT INTO
scan_lvm_pvs
(
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];
$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;
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_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 $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},
}});
}
}