]> xenbits.xensource.com Git - people/iwj/osstest.git/commitdiff
target_check_ip: Rename and improve from guest_check_ip
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 25 Sep 2015 17:07:42 +0000 (18:07 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 13 Nov 2015 12:42:16 +0000 (12:42 +0000)
Make this function suitable for running on targets with static IP
addresses.  (Ie, on physical hosts.)  Accordingly, rename it and
adjust all call sites.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Tested-by: Robert Ho <robert.hu@intel.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
v14: New patch

Osstest/TestSupport.pm
ts-guest-localmigrate
ts-guest-migrate
ts-guest-saverestore

index 9a256a9a10ec2d53f3637b2918e1fba197d4853e..325e2e3729f9b9526a332ead2debd41a1b651b1f 100644 (file)
@@ -95,7 +95,7 @@ BEGIN {
                       prepareguest_part_lvmdisk prepareguest_part_diskimg
                       prepareguest_part_xencfg
                       guest_umount_lv guest_await guest_await_dhcp_tcp
-                      guest_checkrunning guest_check_ip guest_find_ether
+                      guest_checkrunning target_check_ip guest_find_ether
                       guest_find_domid guest_check_up guest_check_up_quick
                       guest_get_state guest_await_reboot
                       guest_await_shutdown guest_await_destroy guest_destroy
@@ -730,8 +730,9 @@ sub dhcp_watch_setup ($$) {
     $gho->{DhcpWatch} = get_host_method_object($ho, 'DhcpWatch', $meth);
 }
 
-sub guest_check_ip ($) {
-    my ($gho) = @_;
+sub target_check_ip ($) {
+    my ($gho) = @_; # returns error message or undef
+    return undef if $gho->{IpStatic};
     guest_find_ether($gho);
     $gho->{DhcpWatch}->check_ip($gho);
 }
@@ -871,7 +872,7 @@ sub selecthost ($) {
        $msg .= " guest $child->{Guest} (@{ $child->{Info} })";
        $msg .= " $child->{Ether}";
 
-       my $err = guest_check_ip($child);
+       my $err = target_check_ip($child);
        $msg .= " ".(defined $err ? "<no-ip> $err" : $child->{Ip});
 
        logm($msg);
@@ -1956,7 +1957,7 @@ sub guest_await_dhcp_tcp ($$) {
              " $gho->{TcpCheckPort}".
               " link/ip/tcp",
               sub {
-        my $err= guest_check_ip($gho);
+        my $err= target_check_ip($gho);
         return $err if defined $err;
 
         return
index 8fe986df089bc5cfc1c2d09524b69ef77eccbc2a..85a0887b7a239b83edc527b2727fc7826729be76 100755 (executable)
@@ -40,7 +40,7 @@ sub migrate () {
 guest_await_dhcp_tcp($gho, 5);
 guest_check_up($gho);
 
-my $err= guest_check_ip($gho);  die "$err $gho->{Name}" if defined $err;
+my $err= target_check_ip($gho);  die "$err $gho->{Name}" if defined $err;
 
 for (my $rep=1; $rep<=$reps; $rep++) {
     logm("========== rep $rep ==========");
index b77d0de2d05cd1cd2a88127c85492f03ab8f282f..505fab29b9babb67470a4b7fe2737a551cf7ff55 100755 (executable)
@@ -30,7 +30,7 @@ our $gho = selectguest($ARGV[2],$sho);
 
 sub migrate () {
     guest_checkrunning($sho,$gho) or die $gho->{Name};
-    my $err= guest_check_ip($gho);  die "$err $gho->{Name}" if defined $err;
+    my $err= target_check_ip($gho);  die "$err $gho->{Name}" if defined $err;
     toolstack($sho)->migrate($gho, $dho, $timeout{Migrate});
 }
 
index 7e13d90d7e5710308d319deaa4f9983e97de87a8..73883ef8dc7a23ef27b795a295e943ee1184ae3d 100755 (executable)
@@ -26,7 +26,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV);
 
 sub save () {
     guest_checkrunning($ho,$gho) or die $gho->{Name};
-    my $err= guest_check_ip($gho);  die "$err $gho->{Name}" if defined $err;
+    my $err= target_check_ip($gho);  die "$err $gho->{Name}" if defined $err;
     toolstack($ho)->save($gho,"image",200);
     target_ping_check_down($gho);
 }