* Created System->get_bridges() that gets a list of bridges (and connected interfaces, and data). Also created ->get_free_memory() that returns the amount of available RAM.
# Make sure the emulator it wants is the one we have.
validate_emulator($anvil);
# These tests are only needed if we're about to boot the server
if (($anvil->data->{switches}{start}) or ($anvil->data->{switches}{migrate_from}))
{
# Check that we have enough RAM.
validate_ram($anvil);
}
# Validate bridges
validate_bridges($anvil);
# Which DRBD resources do I need?
@ -410,6 +420,40 @@ sub validate_bridges
{
my ($anvil) = @_;
# Get my bridge list
$anvil->System->get_bridges({debug => 2});
# Find the Optical drives and DRBD devices.
my $server = $anvil->data->{environment}{OCF_RESKEY_name};
foreach my $mac (sort {$a cmp $b} keys %{$anvil->data->{server}{$server}{from_disk}{device}{interface}})
{
# See if we have this bridge
my $found = 0;
my $bridge = $anvil->data->{server}{$server}{from_disk}{device}{interface}{$mac}{bridge};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { bridge => $bridge }});
foreach my $interface_name (sort {$a cmp $b} keys %{$anvil->data->{'local'}{network}{bridges}{bridge}})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { interface_name => $interface_name }});
if ((exists $anvil->data->{'local'}{network}{bridges}{bridge}{$interface_name}) && ($anvil->data->{'local'}{network}{bridges}{bridge}{$interface_name}{found}))
{
$found = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { found => $found }});