From 98e4d64197543617031240c55b9bd261912d7613 Mon Sep 17 00:00:00 2001
From: Mitchell E Berger <mitchb@mit.edu>
Date: Sat, 2 Feb 2019 16:55:37 -0500
Subject: [PATCH] Fix autoinstall logic when configured memory is lower than
 needed

invirt-database: Fix the autoinstall logic so that if we've
increased the memory temporarily for the autoinstall above
the machine's database setting, we also bring maxmem up to
the same level.  Otherwise the machine doesn't turn on
because it's requesting to start with more memory than maxmem,
and this failure mode is silent to the user.
---
 debian/changelog |   11 +++++++++++
 invirt-database  |    1 +
 2 files changed, 12 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 40ff336..c0ac0ae 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+invirt-xen-config (0.0.57) unstable; urgency=low
+
+  * invirt-database: Fix the autoinstall logic so that if we've
+    increased the memory temporarily for the autoinstall above
+    the machine's database setting, we also bring maxmem up to
+    the same level.  Otherwise the machine doesn't turn on
+    because it's requesting to start with more memory than maxmem,
+    and this failure mode is silent to the user.
+
+ -- Mitchell Berger <mitchb@mit.edu>  Sat, 02 Feb 2019 16:52:00 -0500
+
 invirt-xen-config (0.0.56) unstable; urgency=low
 
   * vif-invirtroute: Kill arpspoof with SIGKILL when we're done.  The
diff --git a/invirt-database b/invirt-database
index 5e7b772..11fefb5 100644
--- a/invirt-database
+++ b/invirt-database
@@ -101,6 +101,7 @@ if 'installer_options' in locals(): #Installer
     codepath = None
 
     memory = max(memory, 768)
+    maxmem = memory
 elif cdrom is not None:
     disk.append('phy:/dev/xenvg/image_' + cdrom.cdrom_id + ',hdc:cdrom,r')
     boot = 'd'
-- 
1.7.9.5