[libvirt] freecell gives out bytes instead of kilobytes

Florian Vichot florian.vichot at diateam.net
Fri Apr 3 08:29:50 UTC 2009


Gerrit Slomma a écrit :
> 
> --- a/src/virsh.c        2009-04-02 17:45:50.000000000 +0200
> +++ b/src/virsh.c 2009-04-02 23:35:54.000000000 +0200
> @@ -1661,10 +1661,23 @@
>     }
> 
>     if (cell == -1)
> -        vshPrint(ctl, "%s: %llu kB\n", _("Total"), memory);
> +       if (memory < 10*1024*1204*1024)

If I may, it should probably read "1024", not "1204" here.

> +               {
> +                       vshPrint(ctl, "%s: %.0f MB\n", _("Total"), 
> (float)memory/1024/1024);
> +               }
> +               else
> +               {
> +                       vshPrint(ctl, "%s: %.2f GB\n", _("Total"), 
> (float)memory/1024/1024/1024);
> +               }
>     else
> -        vshPrint(ctl, "%d: %llu kB\n", cell, memory);
> -
> +       if (memory < 10*1024*1204*1024)

and here.

> +               {
> +               vshPrint(ctl, "%d: %.0f MB\n", cell, 
> (float)memory/1024/1024);
> +               }
> +       else
> +       {
> +               vshPrint(ctl, "%d: %.2f GB\n", cell, 
> (float)memory/1024/1024/1024);
> +       }
>     return TRUE;
> }

Florian




More information about the libvir-list mailing list