installer: rename has_install_phase to requires_postboot_xml_changes

has_install_phase is an ambiguous name for its intended purpose.
Really this is so API users have a way of knowing if the VM `install`
process requires 2 XML phases or not. Make that naming explicit

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2024-10-09 13:06:40 -04:00 committed by Pavel Hrdina
parent 1c8e6f8428
commit a9a78f45cf
3 changed files with 9 additions and 14 deletions

View File

@ -2031,7 +2031,7 @@ class vmmCreateVM(vmmGObjectUI):
# Probably means guest had no 'install' phase, as in # Probably means guest had no 'install' phase, as in
# for live cds. Try to restart the domain. # for live cds. Try to restart the domain.
vm.startup() # pragma: no cover vm.startup() # pragma: no cover
elif installer.has_install_phase(): elif installer.requires_postboot_xml_changes():
# Register a status listener, which will restart the # Register a status listener, which will restart the
# guest after the install has finished # guest after the install has finished
def cb(): def cb():

View File

@ -501,11 +501,11 @@ class Installer(object):
search_paths.append(self._cdrom_path()) search_paths.append(self._cdrom_path())
return search_paths return search_paths
def has_install_phase(self): def requires_postboot_xml_changes(self):
""" """
Return True if the requested setup is actually installing an OS Return True if the install operation has 2 XML phases, and
into the guest. Things like LiveCDs, Import, or a manually specified requires a hard VM poweroff to ensure the second stage is
bootorder do not have an install phase. used for subsequent boots.
""" """
if self.has_cloudinit() or self.has_unattended(): if self.has_cloudinit() or self.has_unattended():
return True return True
@ -515,18 +515,13 @@ class Installer(object):
self._install_bootdev or self._install_bootdev or
self._treemedia) self._treemedia)
def _requires_postboot_xml_changes(self):
if self.has_cloudinit() or self.has_unattended():
return True
return self.has_install_phase()
def options_specified(self): def options_specified(self):
""" """
Return True if some explicit install option was actually passed in Return True if some explicit install option was actually passed in
""" """
if self._no_install: if self._no_install:
return True return True
return self.has_install_phase() return self.requires_postboot_xml_changes()
def detect_distro(self, guest): def detect_distro(self, guest):
""" """
@ -614,7 +609,7 @@ class Installer(object):
def _build_xml(self, guest, meter): def _build_xml(self, guest, meter):
initial_xml = None initial_xml = None
final_xml = guest.get_xml() final_xml = guest.get_xml()
if self._requires_postboot_xml_changes(): if self.requires_postboot_xml_changes():
initial_xml, final_xml = self._build_postboot_xml( initial_xml, final_xml = self._build_postboot_xml(
guest, final_xml, meter) guest, final_xml, meter)
final_xml = self._pre_reinstall_xml or final_xml final_xml = self._pre_reinstall_xml or final_xml

View File

@ -870,7 +870,7 @@ def _wait_for_domain(installer, instdomain, autoconsole, waithandler):
# User either: # User either:
# used --noautoconsole # used --noautoconsole
# killed console and guest is still running # killed console and guest is still running
if not installer.has_install_phase(): if not installer.requires_postboot_xml_changes():
return return
msg += "\n" msg += "\n"
@ -921,7 +921,7 @@ def _process_domain(domain, guest, installer, waithandler, autoconsole,
if domain.isActive(): if domain.isActive():
return return
if noreboot or not installer.has_install_phase(): if noreboot or not installer.requires_postboot_xml_changes():
print_stdout( # pragma: no cover print_stdout( # pragma: no cover
_("You can restart your domain by running:\n %s") % _("You can restart your domain by running:\n %s") %
cli.virsh_start_cmd(guest)) cli.virsh_start_cmd(guest))