[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH V2 1/2] TestSupport.pm: introduce host_get_free_memory



... which returns the size of free memory in MB.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 Osstest/TestSupport.pm |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index b11eb17..8c69eb4 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -79,6 +79,7 @@ BEGIN {
                       remote_perl_script_open remote_perl_script_done
                       host_reboot target_reboot target_reboot_hard            
                       target_choose_vg target_umount_lv target_await_down
+                      host_get_free_memory
 
                       target_ping_check_down target_ping_check_up
                       target_kernkind_check target_kernkind_console_inittab
@@ -915,6 +916,15 @@ sub host_reboot ($) {
     });
 }
 
+sub host_get_free_memory($$) {
+    my ($ho,$toolstack) = @_;
+    # The line is as followed:
+    # free_memory       :   XXXX
+    my $info = target_cmd_output_root($ho, "$toolstack info", 10);
+    my @matched = $info =~ /free_memory\s*:\s*(\d+)/;
+    return $matched[0];
+}
+
 sub target_reboot ($) {
     my ($ho) = @_;
     target_cmd_root($ho, "init 6");
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.