diff --git a/Anvil/Tools/Database.pm b/Anvil/Tools/Database.pm index ae227823..cc897f8d 100644 --- a/Anvil/Tools/Database.pm +++ b/Anvil/Tools/Database.pm @@ -9112,16 +9112,21 @@ sub insert_or_update_network_interfaces # If we don't have a network interface UUID, try to look one up using the MAC address if (not $network_interface_uuid) { - # See if I know this NIC by referencing it's MAC and name. The name is needed because virtual - # devices can share the MAC with the real interface. + # See if I know this NIC by referencing it's MAC (if not a vnet device), host_uuid and name. + # The name is needed because virtual devices can share the MAC with the real interface. my $query = " SELECT network_interface_uuid FROM network_interfaces -WHERE +WHERE "; + if ($network_interface_name !~ /^vnet/) + { + $query .= " network_interface_mac_address = ".$anvil->Database->quote($network_interface_mac_address)." -AND +AND "; + } + $query .= " network_interface_name = ".$anvil->Database->quote($network_interface_name)." AND network_interface_host_uuid = ".$anvil->Database->quote($network_interface_host_uuid)." diff --git a/Anvil/Tools/ScanCore.pm b/Anvil/Tools/ScanCore.pm index e80edfef..52272477 100644 --- a/Anvil/Tools/ScanCore.pm +++ b/Anvil/Tools/ScanCore.pm @@ -271,7 +271,7 @@ sub agent_startup } # Connect to DBs. - $anvil->Database->connect({debug => 2}); + $anvil->Database->connect({debug => $debug}); $anvil->Log->entry({source => $agent, line => __LINE__, level => $debug, secure => 0, key => "log_0132"}); if (not $anvil->data->{sys}{database}{connections}) { diff --git a/scancore-agents/scan-network/scan-network b/scancore-agents/scan-network/scan-network index d2449a1c..a99255e7 100755 --- a/scancore-agents/scan-network/scan-network +++ b/scancore-agents/scan-network/scan-network @@ -724,6 +724,7 @@ ORDER BY }}); my $query = "DELETE FROM network_interfaces WHERE network_interface_uuid = ".$anvil->Database->quote($network_interface_uuid).";"; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }}); $anvil->Database->write({query => $query, source => $THIS_FILE, line => __LINE__}); $count--;