Skip to content

Commit

Permalink
Add guest MAC address
Browse files Browse the repository at this point in the history
  • Loading branch information
tbaev authored and alice-suse committed Aug 27, 2024
1 parent 0df2003 commit 5bef4b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ sub add_virtual_network_interface {
if (get_var('VIRT_AUTOTEST') && is_kvm_host) {
$interface_model_option = '--model virtio';
}
script_retry("ssh root\@$guest ip l", delay => 60, retry => 10, timeout => 60);
script_retry("ssh root\@$guest ip l | grep " . $virt_autotest::common::guests{$guest}->{macaddress}, delay => 60, retry => 10, timeout => 60);
assert_script_run("virsh domiflist $guest", 90);
if (try_attach("virsh attach-interface --domain $guest --type bridge ${interface_model_option} --source br0 --mac " . $mac . " --live " . ${persistent_config_option})) {
assert_script_run("virsh domiflist $guest | grep br0");
Expand Down
7 changes: 5 additions & 2 deletions tests/virtualization/universal/waitfor_guests.pm
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,15 @@ sub run {
}
}

# Update guests hash with IPs and /etc/hosts
# Update guests hash with IP/macaddress and add guests to /etc/hosts
foreach my $guest (@guests) {
my $guest_ip = script_output("cat /tmp/guests_ip/$guest");
record_info("IP: $guest_ip", "$guest IP: $guest_ip");
# Update the guests hash with the current IP address for migration testing
$virt_autotest::common::guests{$guest}{ip} = "$guest_ip";
# Update the guests hash with the guest macaddress
my $guest_mac = script_output("virsh domiflist $guest | awk 'NR>2 {print \$5}'");
$virt_autotest::common::guests{$guest}{macaddress} = "$guest_mac";
record_info("$guest networking", "$guest IP: $guest_ip MAC: $guest_mac");
# Fill the current pairs of hostname & address to the /etc/hosts file
add_guest_to_hosts($guest, $guest_ip);
}
Expand Down

0 comments on commit 5bef4b5

Please sign in to comment.