| 708 | | # The Agent::run() thread has stopped; we assume |
|---|
| 709 | | # it's because the Agent is waiting for the firewall |
|---|
| 710 | | # to allow access to the new targets. |
|---|
| 711 | | # TODO: Need to distinguish between run() stopping because |
|---|
| 712 | | # of firewall mods, or if the Agent is completely finished |
|---|
| 713 | | # and needs more input to continue. |
|---|
| | 716 | # Check to see if any links remain to be processed by the |
|---|
| | 717 | # Agent. |
|---|
| | 718 | if (!$ret->{$args{'driver'}}->{status}->{links_remaining}) { |
|---|
| | 719 | |
|---|
| | 720 | $LOG->info("All URLs exhausted. Shutting down Manager."); |
|---|
| | 721 | # Get a local copy of the configuration and kill the global copy. |
|---|
| | 722 | my $vmCfg = $vmCloneConfig; |
|---|
| | 723 | $vmCloneConfig = undef; |
|---|
| | 724 | $LOG->info("Calling destroyVM(config => " . $vmCfg . ")."); |
|---|
| | 725 | $stubVM->destroyVM(config => $vmCfg); |
|---|
| | 726 | print "Done!\n"; |
|---|
| | 727 | _cleanup(); |
|---|
| | 728 | |
|---|
| | 729 | } else { |
|---|
| | 730 | # The Agent::run() thread has stopped; we assume |
|---|
| | 731 | # it's because the Agent is waiting for the firewall |
|---|
| | 732 | # to allow access to the new targets. |
|---|
| 715 | | # Delete the old firewall rules, based upon existing |
|---|
| 716 | | # targets. |
|---|
| 717 | | $stubFW->deleteRules($vmStateTable); |
|---|
| 718 | | |
|---|
| 719 | | # Get the new targets from the Agent. |
|---|
| 720 | | $vmStateTable->{$vmName}->{targets} = $ret->{$args{'driver'}}->{next}->{targets}; |
|---|
| 721 | | |
|---|
| 722 | | print "VM State Table:\n"; |
|---|
| 723 | | # Make Dumper format more verbose. |
|---|
| 724 | | $Data::Dumper::Terse = 0; |
|---|
| 725 | | $Data::Dumper::Indent = 2; |
|---|
| 726 | | print Dumper($vmStateTable) . "\n"; |
|---|
| 727 | | |
|---|
| 728 | | # Add the new targets from the Agent. |
|---|
| 729 | | $stubFW->addRules($vmStateTable); |
|---|
| 730 | | |
|---|
| 731 | | print "Calling run()...\n"; |
|---|
| 732 | | $som = $stubAgent->run(); |
|---|
| | 734 | # Delete the old firewall rules, based upon existing |
|---|
| | 735 | # targets. |
|---|
| | 736 | $stubFW->deleteRules($vmStateTable); |
|---|
| | 737 | |
|---|
| | 738 | # Get the new targets from the Agent. |
|---|
| | 739 | $vmStateTable->{$vmName}->{targets} = $ret->{$args{'driver'}}->{next}->{targets}; |
|---|
| | 740 | |
|---|
| | 741 | print "VM State Table:\n"; |
|---|
| | 742 | # Make Dumper format more verbose. |
|---|
| | 743 | $Data::Dumper::Terse = 0; |
|---|
| | 744 | $Data::Dumper::Indent = 2; |
|---|
| | 745 | print Dumper($vmStateTable) . "\n"; |
|---|
| | 746 | |
|---|
| | 747 | # Add the new targets from the Agent. |
|---|
| | 748 | $stubFW->addRules($vmStateTable); |
|---|
| | 749 | |
|---|
| | 750 | print "Calling run()...\n"; |
|---|
| | 751 | $som = $stubAgent->run(); |
|---|
| | 752 | } |
|---|