cli: Default lxc:/// memory to 1024, and print it

My previous patch was misguided as pointed out by Pavel:
https://github.com/virt-manager/virt-manager/issues/73#issuecomment-574680435

And it was setting incorrect memory, which I missed because the tests
are busted here. Add a hack to work around that

Bump up the default to 1024, and print it, so the user can tell if
the default is not to their liking

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2020-01-15 10:28:53 -05:00
parent 925948a19e
commit 5e63e87a8a
5 changed files with 14 additions and 9 deletions

View File

@ -6,8 +6,8 @@
<libosinfo:os id="http://fedoraproject.org/fedora/27"/>
</libosinfo:libosinfo>
</metadata>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<memory>1048576</memory>
<currentMemory>1048576</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64">exe</type>

View File

@ -1,8 +1,8 @@
<domain type="lxc">
<name>foolxc</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<memory>1048576</memory>
<currentMemory>1048576</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64">exe</type>

View File

@ -1,8 +1,8 @@
<domain type="lxc">
<name>foolxc</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<memory>1048576</memory>
<currentMemory>1048576</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64">exe</type>

View File

@ -391,7 +391,9 @@ class App(object):
args += " --connect %s" % uri
if self.appname in ["virt-install"]:
if "--ram " not in cli:
# Excluding 'lxc' is a hack. We need to remove this, but it
# will take some work
if "--ram " not in cli and "lxc" not in cli:
args += " --ram 64"
if iscompare:

View File

@ -455,10 +455,13 @@ def set_cli_defaults(options, guest):
if guest.os.is_container():
if not memory_specified(guest):
mbram = 1024
# LXC doesn't even do anything with memory settings, but libvirt
# XML requires it anyways. Fill in 64 MiB
log.debug("Setting container default --memory 64")
guest.currentMemory = 64 // 1024
cli.print_stdout(
_("Using container default --memory {megabytes}").format(
megabytes=mbram))
guest.currentMemory = mbram * 1024
return
if (options.unattended and