summaryrefslogtreecommitdiff
path: root/virt-install
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2019-06-13 16:15:21 -0400
committerCole Robinson <crobinso@redhat.com>2019-06-13 16:36:21 -0400
commitf36e8b36bc98f6328c6bd75d54f311d5464810b6 (patch)
treea7c67a0f2a0ca99d3331913affb804453376904e /virt-install
parent3b396e83210703991f15f9b41cb1bb10834db17c (diff)
downloadvirt-manager-f36e8b36bc98f6328c6bd75d54f311d5464810b6.tar.gz
virt-install: Rework install option detection a bit
Add an explicit no_install to Installer to encode that the user is not expecting an install phase. Use that to determine later if any install options were specified. This saves later code from having to deal with installer=None, and is the basis for further clarifications
Diffstat (limited to 'virt-install')
-rwxr-xr-xvirt-install35
1 files changed, 14 insertions, 21 deletions
diff --git a/virt-install b/virt-install
index 0646ac85..03ed324e 100755
--- a/virt-install
+++ b/virt-install
@@ -307,7 +307,7 @@ def validate_required_options(options, guest, installer):
msg += "\n" + (
_("--disk storage must be specified (override with --disk none)"))
- if not installer:
+ if not guest.os.is_container() and not installer.options_specified():
msg += "\n" + (
_("An install method must be specified\n(%(methods)s)") %
{"methods": INSTALL_METHODS})
@@ -377,8 +377,6 @@ def build_installer(options, guest):
install_initrd = None
install_kernel_args = None
- has_installer = True
-
if options.install:
installdata = cli.parse_install(options.install)
@@ -415,26 +413,23 @@ def build_installer(options, guest):
else:
extra_args = [installdata.kernel_args]
+ no_install = None
if options.location:
(location,
location_kernel,
location_initrd) = cli.parse_location(options.location)
elif options.cdrom:
cdrom = options.cdrom
+ if options.livecd:
+ no_install = True
elif options.pxe:
install_bootdev = "network"
- elif (guest.os.is_container() or
- options.import_install or
- options.xmlonly or
- options.boot or
- installdata):
+ elif installdata:
pass
- else:
- has_installer = False
-
- if not has_installer:
- # This triggers an error in validate_required_options
- return None
+ elif (options.import_install or
+ options.xmlonly or
+ options.boot):
+ no_install = True
installer = virtinst.Installer(guest.conn,
cdrom=cdrom,
@@ -444,10 +439,9 @@ def build_installer(options, guest):
install_bootdev=install_bootdev,
install_kernel=install_kernel,
install_initrd=install_initrd,
- install_kernel_args=install_kernel_args)
+ install_kernel_args=install_kernel_args,
+ no_install=no_install)
- if cdrom and options.livecd:
- installer.livecd = True
if options.unattended:
unattended_data = cli.parse_unattended(options.unattended)
installer.set_unattended_data(unattended_data)
@@ -543,10 +537,9 @@ def build_guest_instance(conn, options):
installer = build_installer(options, guest)
set_cli_defaults(options, guest)
- if installer:
- installer.set_install_defaults(guest)
- for path in installer.get_search_paths(guest):
- cli.check_path_search(guest.conn, path)
+ installer.set_install_defaults(guest)
+ for path in installer.get_search_paths(guest):
+ cli.check_path_search(guest.conn, path)
# cli specific disk validation
for disk in guest.devices.disk: