mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
installer: add support for windows unattended install
The Windows unattended installation is quite similar to the Linux one
with a few major differences:
- It uses floppy injection instead of initrd injection
- Yes, it does. Then we have to create a floppy, add the device and,
when finishing the installation, remove the device;
- There's no InstallerTreeMedia in the game making us end up duplicating
some code in the Installer class as:
- keeping track of files that have to be cleanup up;
- actually cleaning up the files;
- generating the install script
Apart from that, some obvious differences in the scripts where already
done in a previous commit, but those were basically:
- Not using /dev/*da as a target disk, but use "C" instead;
- Set the product-key
- Explicitly set the injection method as "floppy"
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
committed by
Cole Robinson
parent
ec102a07a1
commit
d5af67d077
@@ -449,10 +449,11 @@ def build_installer(options, guest):
|
||||
if options.unattended:
|
||||
if options.os_variant.is_none or options.os_variant.is_auto:
|
||||
fail(_("--unattended requires an explicit --os-variant"))
|
||||
if options.cdrom:
|
||||
options.location = options.cdrom
|
||||
options.cdrom = None
|
||||
options.os_variant.install = "location"
|
||||
if not guest.osinfo.is_windows():
|
||||
if options.cdrom:
|
||||
options.location = options.cdrom
|
||||
options.cdrom = None
|
||||
options.os_variant.install = "location"
|
||||
|
||||
if options.os_variant.install == "location":
|
||||
if not options.location:
|
||||
|
||||
@@ -13,8 +13,10 @@ import libvirt
|
||||
|
||||
from .devices import DeviceDisk
|
||||
from .domain import DomainOs
|
||||
from .osdict import OSDB
|
||||
from .osdict import OSDB, OsMedia
|
||||
from .installertreemedia import InstallerTreeMedia
|
||||
from .floppyinject import perform_floppy_injections
|
||||
from . import unattended
|
||||
from . import util
|
||||
|
||||
|
||||
@@ -208,10 +210,26 @@ class Installer(object):
|
||||
self._install_initrd = i
|
||||
if a and "VIRTINST_INITRD_TEST" not in os.environ:
|
||||
self.extra_args.append(a)
|
||||
elif self._unattended_data:
|
||||
osguess = OSDB.guess_os_by_iso(self.cdrom)
|
||||
osmedia = OsMedia(osguess[1])
|
||||
script = unattended.prepare_install_script(
|
||||
guest, self._unattended_data, self.cdrom, osmedia)
|
||||
path, _ = unattended.generate_install_script(script)
|
||||
logging.debug("Generated unattended script: %s", path)
|
||||
logging.debug("Generated script contents:\n%s",
|
||||
open(path).read())
|
||||
|
||||
floppy = perform_floppy_injections([path], util.get_cache_dir())
|
||||
self._add_install_floppy_device(guest, floppy)
|
||||
|
||||
self._unattended_files.extend([path, floppy])
|
||||
|
||||
def _cleanup(self, guest):
|
||||
if self._treemedia:
|
||||
self._treemedia.cleanup(guest)
|
||||
elif self._unattended_files:
|
||||
self._cleanup_unattended_files()
|
||||
|
||||
def _get_postinstall_bootdev(self, guest):
|
||||
if self.cdrom and self.livecd:
|
||||
@@ -354,6 +372,7 @@ class Installer(object):
|
||||
return ret
|
||||
finally:
|
||||
self._remove_install_cdrom_media(guest)
|
||||
self._remove_install_floppy_device(guest)
|
||||
self._finish_get_install_xml(guest, data)
|
||||
|
||||
def _build_xml(self, guest, meter):
|
||||
|
||||
Reference in New Issue
Block a user