mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virt-install: Error if -c <uri> specified
-c maps to --cdrom for virt-install, but for other libvirt tools like virsh it maps to --connect. Handle -c and --cdrom a little differently: if -c contains '://', error out with an explanation. User can work around it by using --cdrom. This could in theory break some users, but the change they make will be backwards compatible.
This commit is contained in:
@@ -197,7 +197,7 @@ including images that virt-install is asked to create.
|
|||||||
|
|
||||||
=over 2
|
=over 2
|
||||||
|
|
||||||
=item -c CDROM, --cdrom=CDROM
|
=item --cdrom=CDROM
|
||||||
|
|
||||||
File or device use as a virtual CD-ROM device for fully virtualized guests.
|
File or device use as a virtual CD-ROM device for fully virtualized guests.
|
||||||
It can be path to an ISO image, or to a CDROM device. It can also be a URL
|
It can be path to an ISO image, or to a CDROM device. It can also be a URL
|
||||||
|
|||||||
22
virt-install
22
virt-install
@@ -99,13 +99,22 @@ def supports_pxe(guest):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def check_vcpu_option_error(options):
|
def check_cdrom_option_error(options):
|
||||||
# Catch a strangely common error of users passing -vcpus=2 instead of
|
if options.cdrom_short and options.cdrom:
|
||||||
# --vcpus=2. The single dash happens to map to enough shortened options
|
fail("Cannot specify both -c and --cdrom")
|
||||||
# that things can fail weirdly if --paravirt is also specified.
|
|
||||||
|
if options.cdrom_short:
|
||||||
|
if "://" in options.cdrom_short:
|
||||||
|
fail("-c specified with what looks like a URI. Did you mean "
|
||||||
|
"to use --connect? If not, use --cdrom instead")
|
||||||
|
options.cdrom = options.cdrom_short
|
||||||
|
|
||||||
if not options.cdrom:
|
if not options.cdrom:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# 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.
|
||||||
for vcpu in [o for o in sys.argv if o.startswith("-vcpu")]:
|
for vcpu in [o for o in sys.argv if o.startswith("-vcpu")]:
|
||||||
if options.cdrom == vcpu[3:]:
|
if options.cdrom == vcpu[3:]:
|
||||||
fail("You specified -vcpus, you want --vcpus")
|
fail("You specified -vcpus, you want --vcpus")
|
||||||
@@ -856,7 +865,8 @@ def parse_args():
|
|||||||
parser.add_option_group(geng)
|
parser.add_option_group(geng)
|
||||||
|
|
||||||
insg = optparse.OptionGroup(parser, _("Installation Method Options"))
|
insg = optparse.OptionGroup(parser, _("Installation Method Options"))
|
||||||
insg.add_option("-c", "--cdrom", dest="cdrom",
|
insg.add_option("-c", dest="cdrom_short", help=optparse.SUPPRESS_HELP)
|
||||||
|
insg.add_option("", "--cdrom", dest="cdrom",
|
||||||
help=_("CD-ROM installation media"))
|
help=_("CD-ROM installation media"))
|
||||||
insg.add_option("-l", "--location", dest="location",
|
insg.add_option("-l", "--location", dest="location",
|
||||||
help=_("Installation source (eg, nfs:host:/path, "
|
help=_("Installation source (eg, nfs:host:/path, "
|
||||||
@@ -1010,7 +1020,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)
|
check_cdrom_option_error(options)
|
||||||
|
|
||||||
if options.distro_variant == "list":
|
if options.distro_variant == "list":
|
||||||
logging.debug("OS list requested")
|
logging.debug("OS list requested")
|
||||||
|
|||||||
Reference in New Issue
Block a user