mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virtinst: installer: Add _make_cdrom_device helper
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
5c64d35756
commit
8732b2d52b
@ -84,6 +84,14 @@ class Installer(object):
|
|||||||
# Private helpers #
|
# Private helpers #
|
||||||
###################
|
###################
|
||||||
|
|
||||||
|
def _make_cdrom_device(self, path):
|
||||||
|
dev = DeviceDisk(self.conn)
|
||||||
|
dev.device = dev.DEVICE_CDROM
|
||||||
|
dev.path = path
|
||||||
|
dev.sync_path_props()
|
||||||
|
dev.validate()
|
||||||
|
return dev
|
||||||
|
|
||||||
def _cdrom_path(self):
|
def _cdrom_path(self):
|
||||||
if self._treemedia:
|
if self._treemedia:
|
||||||
return self._treemedia.cdrom_path()
|
return self._treemedia.cdrom_path()
|
||||||
@ -95,11 +103,7 @@ class Installer(object):
|
|||||||
if not bool(self._cdrom_path()):
|
if not bool(self._cdrom_path()):
|
||||||
return
|
return
|
||||||
|
|
||||||
dev = DeviceDisk(self.conn)
|
dev = self._make_cdrom_device(self._cdrom_path())
|
||||||
dev.device = dev.DEVICE_CDROM
|
|
||||||
dev.path = self._cdrom_path()
|
|
||||||
dev.sync_path_props()
|
|
||||||
dev.validate()
|
|
||||||
self._install_cdrom_device_added = True
|
self._install_cdrom_device_added = True
|
||||||
|
|
||||||
# Insert the CDROM before any other CDROM, so boot=cdrom picks
|
# Insert the CDROM before any other CDROM, so boot=cdrom picks
|
||||||
@ -125,11 +129,8 @@ class Installer(object):
|
|||||||
def _add_unattended_install_cdrom_device(self, guest, location):
|
def _add_unattended_install_cdrom_device(self, guest, location):
|
||||||
if self._unattended_install_cdrom_device:
|
if self._unattended_install_cdrom_device:
|
||||||
return # pragma: no cover
|
return # pragma: no cover
|
||||||
dev = DeviceDisk(self.conn)
|
|
||||||
dev.device = dev.DEVICE_CDROM
|
dev = self._make_cdrom_device(location)
|
||||||
dev.path = location
|
|
||||||
dev.sync_path_props()
|
|
||||||
dev.validate()
|
|
||||||
dev.set_defaults(guest)
|
dev.set_defaults(guest)
|
||||||
self._unattended_install_cdrom_device = dev
|
self._unattended_install_cdrom_device = dev
|
||||||
guest.add_device(self._unattended_install_cdrom_device)
|
guest.add_device(self._unattended_install_cdrom_device)
|
||||||
|
Loading…
Reference in New Issue
Block a user