From 5e63e87a8a13b0f2f325519f9f1f69d3a0f74821 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Wed, 15 Jan 2020 10:28:53 -0500 Subject: [PATCH] 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 --- tests/cli-test-xml/compare/virt-install-default-f27.xml | 4 ++-- tests/cli-test-xml/compare/virt-install-default.xml | 4 ++-- tests/cli-test-xml/compare/virt-install-manual-init.xml | 4 ++-- tests/clitest.py | 4 +++- virt-install | 7 +++++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/cli-test-xml/compare/virt-install-default-f27.xml b/tests/cli-test-xml/compare/virt-install-default-f27.xml index 81623d069..b4df2bd2b 100644 --- a/tests/cli-test-xml/compare/virt-install-default-f27.xml +++ b/tests/cli-test-xml/compare/virt-install-default-f27.xml @@ -6,8 +6,8 @@ - 65536 - 65536 + 1048576 + 1048576 1 exe diff --git a/tests/cli-test-xml/compare/virt-install-default.xml b/tests/cli-test-xml/compare/virt-install-default.xml index d552b021e..e88ccbc38 100644 --- a/tests/cli-test-xml/compare/virt-install-default.xml +++ b/tests/cli-test-xml/compare/virt-install-default.xml @@ -1,8 +1,8 @@ foolxc 00000000-1111-2222-3333-444444444444 - 65536 - 65536 + 1048576 + 1048576 1 exe diff --git a/tests/cli-test-xml/compare/virt-install-manual-init.xml b/tests/cli-test-xml/compare/virt-install-manual-init.xml index ce738c066..cff1d3d93 100644 --- a/tests/cli-test-xml/compare/virt-install-manual-init.xml +++ b/tests/cli-test-xml/compare/virt-install-manual-init.xml @@ -1,8 +1,8 @@ foolxc 00000000-1111-2222-3333-444444444444 - 65536 - 65536 + 1048576 + 1048576 1 exe diff --git a/tests/clitest.py b/tests/clitest.py index 530ae275c..e89994c90 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -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: diff --git a/virt-install b/virt-install index 0056a218d..9d574fc83 100755 --- a/virt-install +++ b/virt-install @@ -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