[virt-tools-list] [virt-manager PATCH 4/7] installer: deal with floppy devices used during install

Fabiano Fidêncio fidencio at redhat.com
Thu Mar 28 21:44:45 UTC 2019


A floppy device is going to be used when performing a unattended
installation in a Windows guest.

In order to have it done cleanly, let's mimic the what's already
existent for dealing with cdrom devices used during installation.

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

diff --git a/virtinst/installer.py b/virtinst/installer.py
index b8c048f1..488ed324 100644
--- a/virtinst/installer.py
+++ b/virtinst/installer.py
@@ -49,6 +49,7 @@ class Installer(object):
         self._install_kernel = None
         self._install_initrd = None
         self._install_cdrom_device = None
+        self._install_floppy_device = None
         self._defaults_are_set = False
 
         if location_kernel or location_initrd:
@@ -111,6 +112,25 @@ class Installer(object):
         self._install_cdrom_device.path = None
         self._install_cdrom_device.sync_path_props()
 
+    def _add_install_floppy_device(self, guest, location):
+        if self._install_floppy_device:
+            return
+        dev = DeviceDisk(self.conn)
+        dev.device = dev.DEVICE_FLOPPY
+        dev.path = location
+        dev.sync_path_props()
+        dev.validate()
+        dev.set_defaults(guest)
+        self._install_floppy_device = dev
+        guest.add_device(self._install_floppy_device)
+
+    def _remove_install_floppy_device(self, guest):
+        if not self._install_floppy_device:
+            return
+
+        self._install_floppy_device.path = None
+        self._install_floppy_device.sync_path_props()
+
     def _build_boot_order(self, guest, bootdev):
         bootorder = [bootdev]
 
-- 
2.20.1




More information about the virt-tools-list mailing list