virt-install: Deprecate --nodisks in favor of --disk none

This commit is contained in:
Cole Robinson 2014-09-20 19:16:13 -04:00
parent 57ae284ad4
commit d7e1a40352
5 changed files with 41 additions and 43 deletions

View File

@ -36,7 +36,7 @@ argument, example: virt-install --disk=?
=head1 OPTIONS
Most options are not required. Minimum requirements are --name, --memory,
guest storage (--disk, --filesystem or --nodisks), and an install option.
guest storage (--disk or --filesystem), and an install option.
=over 2
@ -383,7 +383,7 @@ C<--disk> or C<--filesystem>.
Specify that the installation media is a live CD and thus the guest
needs to be configured to boot off the CDROM device permanently. It
may be desirable to also use the C<--nodisks> flag in combination.
may be desirable to also use the C<--disk none> flag in combination.
=item -x EXTRA, --extra-args=EXTRA
@ -655,7 +655,7 @@ possible values in L<http://www.libvirt.org/formatdomain.html#elementsDisks>
=back
See the examples section for some uses. This option deprecates -f/--file,
-s/--file-size, and --nonsparse.
-s/--file-size, --nonsparse, and --nodisks.
Use --disk=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#elementsDisks>
@ -697,11 +697,6 @@ The mount location to use in the guest.
Use --filesystem=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#elementsFilesystems>
=item --nodisks
Request a virtual machine without any local disk storage, typically used for
running 'Live CD' images or installing to network storage (iSCSI or NFS root).
=back
@ -1505,7 +1500,7 @@ Run a Live CD image under Xen fullyvirt, in diskless environment
--hvm \
--name demo \
--memory 500 \
--nodisks \
--disks none \
--livecd \
--graphics vnc \
--cdrom /root/fedora7live.iso

View File

@ -1,4 +1,4 @@
ERROR
--disk storage must be specified (override with --nodisks)
--disk storage must be specified (override with --disk none)
An install method must be specified
(--location URL, --cdrom CD/ISO, --pxe, --import, --boot hd|cdrom|...)

View File

@ -505,9 +505,9 @@ c.add_compare("--disk %(EXISTIMG1)s --cdrom %(EXISTIMG1)s --livecd --hvm", "xen-
c.add_compare("--connect %(XENIA64URI)s --disk %(EXISTIMG1)s --import", "xen-ia64-default") # ia64 default
c.add_compare("--connect %(XENIA64URI)s --disk %(EXISTIMG1)s --location %(TREEDIR)s --paravirt", "xen-ia64-pv") # ia64 pv
c.add_compare("--connect %(XENIA64URI)s --disk %(EXISTIMG1)s --location %(TREEDIR)s --hvm", "xen-ia64-hvm") # ia64 hvm
c.add_valid("--nodisks --cdrom %(EXISTIMG1)s --livecd --hvm") # HVM
c.add_valid("--nodisks --boot hd --paravirt") # PV
c.add_valid("--nodisks --boot hd --paravirt --arch i686") # 32 on 64 xen
c.add_valid("--disk none --cdrom %(EXISTIMG1)s --livecd --hvm") # HVM
c.add_valid("--disk none --boot hd --paravirt") # PV
c.add_valid("--disk none --boot hd --paravirt --arch i686") # 32 on 64 xen
c = vinst.add_category("kvm", "--connect %(KVMURI)s --noautoconsole")
@ -522,10 +522,10 @@ c.add_compare("--os-variant fedora20 --nodisks --boot fd --graphics sdl --arch s
c.add_compare("--arch armv7l --machine vexpress-a9 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,dtb=/f19-arm.dtb,extra_args=\"console=ttyAMA0 rw root=/dev/mmcblk0p3\" --disk %(EXISTIMG1)s --nographics", "arm-vexpress-plain", skip_check=support.SUPPORT_CONN_DISK_SD)
c.add_compare("--arch armv7l --machine vexpress-a15 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,dtb=/f19-arm.dtb,kernel_args=\"console=ttyAMA0 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s --nographics --os-variant fedora19", "arm-vexpress-f19", skip_check=support.SUPPORT_CONN_VIRTIO_MMIO)
c.add_compare("--arch ppc64 --machine pseries --boot network --disk %(EXISTIMG1)s --os-variant fedora20 --network none", "ppc64-pseries-f20")
c.add_compare("--nodisks --location /tmp/fake.iso --nonetworks", "location-iso") # Using --location iso mounting
c.add_compare("--disk none --location /tmp/fake.iso --nonetworks", "location-iso") # Using --location iso mounting
c.add_valid("--cdrom %(EXISTIMG2)s --file %(EXISTIMG1)s --os-variant win2k3 --wait 0 --sound") # HVM windows install with disk
c.add_valid("--os-variant fedora20 --file %(EXISTIMG1)s --location %(TREEDIR)s --extra-args console=ttyS0 --sound") # F14 Directory tree URL install with extra-args
c.add_invalid("--nodisks --boot network --machine foobar") # Unknown machine type
c.add_invalid("--disk none --boot network --machine foobar") # Unknown machine type
c.add_invalid("--nodisks --boot network --arch mips --virt-type kvm") # Invalid domain type for arch
c.add_invalid("--nodisks --boot network --paravirt --arch mips") # Invalid arch/virt combo

View File

@ -58,10 +58,6 @@ def cdrom_specified(guest, disk=None):
return False
def storage_specified(disks, nodisks, filesystems):
return bool(disks or nodisks or filesystems)
def supports_pxe(guest):
"""
Return False if we are pretty sure the config doesn't support PXE
@ -126,10 +122,7 @@ def convert_old_init(options):
logging.debug("Converted old --init to --boot %s", options.boot)
def convert_old_disks(options):
if options.disk or options.nodisks:
return
def _do_convert_old_disks(options):
paths = virtinst.util.listify(options.file_paths)
sizes = virtinst.util.listify(options.disksize)
@ -158,9 +151,30 @@ def convert_old_disks(options):
opts.append(optstr)
options.disk = opts
options.file_paths = []
options.disksize = None
options.sparse = True
def convert_old_disks(options):
if options.nodisks and (options.file_paths or
options.disk or
options.disksize):
fail(_("Cannot specify storage and use --nodisks"))
if ((options.file_paths or options.disksize or not options.sparse) and
options.disk):
fail(_("Cannot mix --file, --nonsparse, or --file-size with --disk "
"options. Use --disk PATH[,size=SIZE][,sparse=yes|no]"))
if not options.disk:
if options.nodisks:
options.disk = ["none"]
else:
_do_convert_old_disks(options)
del(options.file_paths)
del(options.disksize)
del(options.sparse)
del(options.nodisks)
logging.debug("Distilled --disk options: %s", options.disk)
def convert_old_os_options(options):
@ -400,11 +414,9 @@ def validate_required_options(options, guest):
msg += "\n" + _("--memory amount in MiB is required")
if (not guest.os.is_container() and
not storage_specified(options.disk,
options.nodisks,
options.filesystem)):
not (options.disk or options.filesystem)):
msg += "\n" + (
_("--disk storage must be specified (override with --nodisks)"))
_("--disk storage must be specified (override with --disk none)"))
if (not guest.os.is_container() and
not (options.xmlonly or options.xmlstep) and
@ -424,17 +436,6 @@ _cdrom_location_man_page = _("See the man page for examples of "
def check_option_collisions(options, guest):
# Disk collisions
if options.nodisks and (options.file_paths or
options.disk or
options.disksize):
fail(_("Cannot specify storage and use --nodisks"))
if ((options.file_paths or options.disksize or not options.sparse) and
options.disk):
fail(_("Cannot mix --file, --nonsparse, or --file-size with --disk "
"options. Use --disk PATH[,size=SIZE][,sparse=yes|no]"))
# Install collisions
if sum([bool(l) for l in [options.pxe, options.location,
options.cdrom, options.import_install]]) > 1:
@ -934,8 +935,7 @@ def parse_args():
stog = parser.add_argument_group(_("Storage Configuration"))
cli.add_disk_option(stog)
stog.add_argument("--nodisks", action="store_true",
help=_("Don't set up any disks for the guest."))
stog.add_argument("--nodisks", action="store_true", help=argparse.SUPPRESS)
cli.add_fs_option(stog)
# Deprecated storage options

View File

@ -1554,6 +1554,9 @@ class ParserDisk(VirtCLIParser):
def _parse(self, opts, inst):
if opts.fullopts == "none":
return
def parse_size(val):
if val is None:
return None