Bug 893933

Summary: use greatest possible memory units that cleanly divide actual memory for 'virsh edit' temporary domain xmls
Product: [Community] Virtualization Tools Reporter: David Jaša <djasa>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DEFERRED QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: crobinso, cwei, dyuan, jdenemar, mzhan, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-24 00:29:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Jaša 2013-01-10 09:52:54 UTC
Description of problem:
When changing memory from e.g. 1.5 GB to 2.5 GB, it's quite inconvenient to always change KiB to MiB and then rewrite the longish number to 2560. It would be much more convenient if libvirt would have done this conversion (to greatest unit where memory size is still integer) right away.

The same issue goes for current memory and video RAM.

Version-Release number of selected component (if applicable):
libvirt-0.10.2-14.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. have a VM with 1.5 GB memory
2. virsh edit VM
3.
  
Actual results:
memory element contains value in KiB

Expected results:
memory element should contain value in MiB

Additional info:

Comment 2 Jiri Denemark 2013-01-10 11:07:59 UTC
While libvirt accepts different units when parsing domain XML, it has to always use KiB when giving the XML back for backward compatibility and we can't change that.

Comment 3 Cole Robinson 2016-03-24 00:29:38 UTC
Rather than add this syntactic sugar for virsh edit (which already has a crazy impl), I suggest using a tool like virt-xml to a) change the memory in one shot, 2) use more sensible MB as its base