Display memory in GB/MB using `oneuser` command

Hi,

How can i make the output from oneuser list command display the memory information in either GB or MB. Currently it display with mixture of GB and MB. I need all to be in same so that i can use for some reporting purpose.

Hi,

To process the data you may want to use the -x option instead, and parse the xml output directly.
But if you really want to modify the column output, take a look at /usr/lib/one/ruby/cli/one_helper/oneuser_helper.rb, line 290.

Hi @cmartin,

Im aware of oneuser_helper.rb file and already done few changes there to display additional information. The only thing im stuck now is the memory to display in standard value.

Changing the below line from “M” to “G” also doesnt solve as it display some with “TB” and some with “GB”

OpenNebulaHelper.unit_to_str(q[‘VM_QUOTA’][‘VM’][“MEMORY_USED”].to_i,{},“M”)

That is because the last param is the original value unit, not the desired output unit. That function automatically decides the final unit.

Skip the call to unit_to_str and use the values directly (it comes in MB).

Hi @cmartin,

Thank you. That is what im using it now. Thank you for your support.