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
# for live cds. Try to restart the domain.
vm.startup() # pragma: no cover
elif installer.has_install_phase():
elif installer.requires_postboot_xml_changes():
# Register a status listener, which will restart the
# guest after the install has finished
def cb():

View File

@ -501,11 +501,11 @@ class Installer(object):
search_paths.append(self._cdrom_path())
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
into the guest. Things like LiveCDs, Import, or a manually specified
bootorder do not have an install phase.
Return True if the install operation has 2 XML phases, and
requires a hard VM poweroff to ensure the second stage is
used for subsequent boots.
"""
if self.has_cloudinit() or self.has_unattended():
return True
@ -515,18 +515,13 @@ class Installer(object):
self._install_bootdev or
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):
"""
Return True if some explicit install option was actually passed in
"""
if self._no_install:
return True
return self.has_install_phase()
return self.requires_postboot_xml_changes()
def detect_distro(self, guest):
"""
@ -614,7 +609,7 @@ class Installer(object):
def _build_xml(self, guest, meter):
initial_xml = None
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(
guest, final_xml, meter)
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:
# used --noautoconsole
# killed console and guest is still running
if not installer.has_install_phase():
if not installer.requires_postboot_xml_changes():
return
msg += "\n"
@ -921,7 +921,7 @@ def _process_domain(domain, guest, installer, waithandler, autoconsole,
if domain.isActive():
return
if noreboot or not installer.has_install_phase():
if noreboot or not installer.requires_postboot_xml_changes():
print_stdout( # pragma: no cover
_("You can restart your domain by running:\n %s") %
cli.virsh_start_cmd(guest))