summaryrefslogtreecommitdiff
path: root/virt-install
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2019-06-14 11:24:10 -0400
committerCole Robinson <crobinso@redhat.com>2019-06-14 11:24:10 -0400
commitfbe388b26ad611c21b4abcad63c0acee8d8988ac (patch)
treefdb651349e535bcde5f6e4e758f4a1ca69c04268 /virt-install
parentc37d6a72604b3c79269969742532a9e0fc231a1e (diff)
downloadvirt-manager-fbe388b26ad611c21b4abcad63c0acee8d8988ac.tar.gz
virt-install: Warn if mem less than OS recommended
And if mem is abnormally low, like it appears user tried to specify GiB not MiB
Diffstat (limited to 'virt-install')
-rwxr-xr-xvirt-install18
1 files changed, 18 insertions, 0 deletions
diff --git a/virt-install b/virt-install
index 779c1ec1..5493426d 100755
--- a/virt-install
+++ b/virt-install
@@ -339,6 +339,23 @@ def _show_nographics_warnings(options, guest, installer):
return
+def _show_memory_warnings(guest):
+ if not guest.currentMemory:
+ return
+
+ res = guest.osinfo.get_recommended_resources()
+ rammb = guest.currentMemory // 1024
+ minram = (res.get_minimum_ram(guest.os.arch) or 0)
+ if minram:
+ if (minram // 1024) > guest.currentMemory:
+ logging.warning(_("Requested memory %s MiB is less than the "
+ "recommended %s MiB for OS %s"), rammb,
+ minram // (1024 * 1024), guest.osinfo.name)
+ elif rammb < 17:
+ logging.warning(_("Requested memory %s MiB is abnormally low. "
+ "Were you trying to specify GiB?"), rammb)
+
+
def show_warnings(options, guest, installer, osdata):
if options.pxe and not supports_pxe(guest):
logging.warning(_("The guest's network configuration does not support "
@@ -353,6 +370,7 @@ def show_warnings(options, guest, installer, osdata):
logging.warning(_("No operating system detected, VM performance may "
"suffer. Specify an OS with --os-variant for optimal results."))
+ _show_memory_warnings(guest)
_show_nographics_warnings(options, guest, installer)