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

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



Wei Liu writes ("[PATCH V2 1/2] TestSupport.pm: introduce 
host_get_free_memory"):
> ... which returns the size of free memory in MB.
...

Thanks, this is much better.

> +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+)/;

But maybe you wanted
      /^free_memory\s*:\s*(\d+)\s*$/m;

Also, you should die if the regexp doesn't match, rather than
returning undef.

Ian.

_______________________________________________
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®.