virt-install: Add --disk removable option

This commit is contained in:
Fred A. Kemp 2013-10-04 03:38:59 +02:00 committed by Cole Robinson
parent bcd47d6471
commit 05254479db
3 changed files with 11 additions and 0 deletions

View File

@ -448,6 +448,11 @@ Disk bus type. Value can be 'ide', 'sata', 'scsi', 'usb', 'virtio' or 'xen'.
The default is hypervisor dependent since not all hypervisors support all
bus types.
=item B<removable>
Sets the removable flag (/sys/block/$dev/removable on Linux). Only
used with QEMU and bus=usb. Value can be 'on' or 'off'.
=item B<perms>
Disk permissions. Value can be 'rw' (Read/Write), 'ro' (Readonly),

View File

@ -639,6 +639,9 @@ c.add_valid("--disk %(DIR)s,device=floppy") # Dir with a floppy dev
c.add_valid("--disk %(EXISTIMG1)s,driver_name=qemu,driver_type=qcow2") # Driver name and type options
c.add_valid("--disk /dev/hda") # Using a storage pool source as a disk
c.add_valid("--disk pool=default,size=.00001") # Building 'default' pool
c.add_valid("--disk path=%(EXISTIMG1)s,bus=usb") # Existing USB disk
c.add_valid("--disk path=%(EXISTIMG1)s,bus=usb,removable=on") # Existing USB disk as removable
c.add_valid("--disk path=%(EXISTIMG1)s,bus=usb,removable=off") # Existing USB disk as non-removable
c.add_invalid("--file %(NEWIMG1)s --file-size 100000 --nonsparse") # Nonexisting file, size too big
c.add_invalid("--file %(NEWIMG1)s --file-size 100000") # Huge file, sparse, but no prompting
c.add_invalid("--file %(NEWIMG1)s") # Nonexisting file, no size
@ -657,6 +660,8 @@ c.add_invalid("--disk %(DIR)s,device=cdrom") # Dir without floppy
c.add_invalid("--disk %(EXISTIMG1)s,driver_name=foobar,driver_type=foobaz") # Unknown driver name and type options (as of 1.0.0)
c.add_valid("--disk path=%(EXISTIMG1)s,startup_policy=optional") # Existing disk, startupPolicy
c.add_invalid("--disk path=%(EXISTIMG1)s,startup_policy=Foo") # Existing disk, invalid startupPolicy
c.add_invalid("--disk path=%(EXISTIMG1)s,bus=ide,removable=on") # removable only supported by USB disks
c.add_invalid("--disk path=%(EXISTIMG1)s,bus=ide,removable=off") # removable only supported by USB disks
c = vinst.add_category("redirdev", "--noautoconsole --nographics --nodisks --pxe")

View File

@ -1455,6 +1455,7 @@ def parse_disk(guest, optstr, dev=None, validate=True):
set_param("device", "device")
set_param("bus", "bus")
set_param("removable", "removable", convert_cb=_on_off_convert)
set_param("driver_cache", "cache")
set_param("driver_name", "driver_name")
set_param("driver_type", "driver_type")