mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virt-install: Better error when user accidentally passes -vcpus
Notice the missing - in -vcpus. It maps to --hvm --cdrom pus If the user also specifies --paravirt, they get an error that hvm and paravirt conflict, which is very confusing. There isn't a nice way to catch this issue which isn't back compatible, so scrape the raw argv and try to figure it out.
This commit is contained in:
parent
9aa54dc1c4
commit
9fc356af43
13
virt-install
13
virt-install
@ -93,6 +93,18 @@ def supports_pxe(guest):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def check_vcpu_option_error(options):
|
||||||
|
# Catch a strangely common error of users passing -vcpus=2 instead of
|
||||||
|
# --vcpus=2. The single dash happens to map to enough shortened options
|
||||||
|
# that things can fail weirdly if --paravirt is also specified.
|
||||||
|
if not options.cdrom:
|
||||||
|
return
|
||||||
|
|
||||||
|
for vcpu in [o for o in sys.argv if o.startswith("-vcpu")]:
|
||||||
|
if options.cdrom == vcpu[3:]:
|
||||||
|
fail("You specified -vcpus, you want --vcpus")
|
||||||
|
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
# Device validation wrappers #
|
# Device validation wrappers #
|
||||||
##############################
|
##############################
|
||||||
@ -980,6 +992,7 @@ def main(conn=None):
|
|||||||
|
|
||||||
if cliargs:
|
if cliargs:
|
||||||
fail(_("Unknown argument '%s'") % cliargs[0])
|
fail(_("Unknown argument '%s'") % cliargs[0])
|
||||||
|
check_vcpu_option_error(options)
|
||||||
|
|
||||||
if options.distro_variant == "list":
|
if options.distro_variant == "list":
|
||||||
logging.debug("OS list requested")
|
logging.debug("OS list requested")
|
||||||
|
Loading…
Reference in New Issue
Block a user