[virt-tools-list] [virt-install PATCH 4/4] installer: Set the network install resources when needed

Fabiano Fidêncio fidencio at redhat.com
Fri Mar 8 16:20:59 UTC 2019


Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 virtinst/installer.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/virtinst/installer.py b/virtinst/installer.py
index 67cdfb29..cd9e7fc2 100644
--- a/virtinst/installer.py
+++ b/virtinst/installer.py
@@ -152,6 +152,21 @@ class Installer(object):
         else:
             guest.os.bootorder = []
 
+    def _alter_install_resources(self, guest):
+        if not self._treemedia:
+            return
+        if not self._treemedia.requires_internet():
+            return
+
+        guest.set_network_install_resources()
+
+    def _restore_resources(self, guest):
+        if not self._treemedia:
+            return
+        if not self._treemedia.requires_internet():
+            return
+
+        guest.unset_network_install_resources()
 
     ##########################
     # Internal API overrides #
@@ -301,9 +316,11 @@ class Installer(object):
         data = self._prepare_get_install_xml(guest)
         try:
             self._alter_bootconfig(guest)
+            self._alter_install_resources(guest)
             ret = guest.get_xml()
             return ret
         finally:
+            self._restore_resources(guest)
             self._remove_install_cdrom_media(guest)
             self._finish_get_install_xml(guest, data)
 
-- 
2.20.1




More information about the virt-tools-list mailing list