[virt-tools-list] [virt-manager PATCH 3/4] cli: Add special treatment for --memballoon none

Andrea Bolognani abologna at redhat.com
Thu Jun 13 10:55:09 UTC 2019


We want to start adding a memory balloon automatically to
guests, but we also need to make sure that it can be explicitly
disabled at the user's request.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 virtinst/cli.py   | 6 ++++++
 virtinst/guest.py | 1 +
 2 files changed, 7 insertions(+)

diff --git a/virtinst/cli.py b/virtinst/cli.py
index 4b985097..f4053daf 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -3557,6 +3557,12 @@ class ParserMemballoon(VirtCLIParser):
         cls.add_arg("autodeflate", "autodeflate", is_onoff=True)
         cls.add_arg("stats.period", "stats_period")
 
+    def _parse(self, inst):
+        if self.optstr == "none":
+            self.guest.disable_default_memballoon = True
+
+        return super()._parse(inst)
+
 
 ###################
 # --panic parsing #
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 717ed21e..e1162ff7 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -227,6 +227,7 @@ class Guest(XMLBuilder):
         self.skip_default_usbredir = False
         self.skip_default_graphics = False
         self.skip_default_rng = False
+        self.disable_default_memballoon = False
         self.x86_cpu_default = self.cpu.SPECIAL_MODE_APP_DEFAULT
 
         self.__osinfo = None
-- 
2.21.0




More information about the virt-tools-list mailing list