mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-03-09 08:58:27 +03:00
virt-install: Deprecate --nonetworks in favor of --network none
Follows the pattern used by the other cli options
This commit is contained in:
parent
c26512926d
commit
57ae284ad4
@ -744,6 +744,10 @@ Direct connect to host interface IFACE using macvtap.
|
||||
Connect to the LAN using SLIRP. Only use this if running a QEMU guest as
|
||||
an unprivileged user. This provides a very limited form of NAT.
|
||||
|
||||
=item none
|
||||
|
||||
Tell virt-install not to add any default network interface.
|
||||
|
||||
=back
|
||||
|
||||
If this option is omitted a single NIC will be created in the guest. If
|
||||
@ -779,11 +783,7 @@ by running 'virsh nwfilter-list', e.g.: 'clean-traffic', 'no-mac-spoofing', ...
|
||||
|
||||
Use --network=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#elementsNICS>
|
||||
|
||||
This option deprecates -m/--mac and -b/--bridge
|
||||
|
||||
=item --nonetworks
|
||||
|
||||
Request a virtual machine without any network interfaces.
|
||||
This option deprecates -m/--mac, -b/--bridge, and --nonetworks
|
||||
|
||||
=back
|
||||
|
||||
@ -1564,7 +1564,7 @@ Start serial QEMU ARM VM, which requires specifying a manual kernel.
|
||||
--arch armv7l --machine vexpress-a9 \
|
||||
--disk /home/user/VMs/myarmdisk.img \
|
||||
--boot kernel=/tmp/my-arm-kernel,initrd=/tmp/my-arm-initrd,dtb=/tmp/my-arm-dtb,kernel_args="console=ttyAMA0 rw root=/dev/mmcblk0p3" \
|
||||
--nographics
|
||||
--graphics none
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
|
@ -43,10 +43,6 @@
|
||||
<controller type="usb" index="0" model="ich9-uhci3">
|
||||
<master startport="4"/>
|
||||
</controller>
|
||||
<interface type="bridge">
|
||||
<source bridge="eth0"/>
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
</interface>
|
||||
<input type="mouse" bus="ps2"/>
|
||||
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes"/>
|
||||
<console type="pty"/>
|
||||
@ -105,10 +101,6 @@
|
||||
<controller type="usb" index="0" model="ich9-uhci3">
|
||||
<master startport="4"/>
|
||||
</controller>
|
||||
<interface type="bridge">
|
||||
<source bridge="eth0"/>
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
</interface>
|
||||
<input type="mouse" bus="ps2"/>
|
||||
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes"/>
|
||||
<console type="pty"/>
|
||||
|
@ -24,10 +24,6 @@
|
||||
<source file="/dev/default-pool/testvol1.img"/>
|
||||
<target dev="sda" bus="scsi"/>
|
||||
</disk>
|
||||
<interface type="bridge">
|
||||
<source bridge="eth0"/>
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
</interface>
|
||||
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes"/>
|
||||
<console type="pty"/>
|
||||
<channel type="unix">
|
||||
|
@ -521,8 +521,8 @@ c.add_compare("--os-variant fedora20 --boot fd --graphics spice --machine pc --c
|
||||
c.add_compare("--os-variant fedora20 --nodisks --boot fd --graphics sdl --arch sparc --machine SS-20", "qemu-sparc") # exotic arch + machine type
|
||||
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", "ppc64-pseries-f20")
|
||||
c.add_compare("--nodisks --location /tmp/fake.iso", "location-iso") # Using --location iso mounting
|
||||
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_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
|
||||
@ -588,7 +588,6 @@ c.add_valid("--hvm --nodisks --nonetworks --cdrom %(EXISTIMG1)s") # no networks
|
||||
c.add_valid("--hvm --nodisks --pxe --memballoon virtio") # --memballoon use virtio
|
||||
c.add_valid("--hvm --nodisks --pxe --memballoon none") # --memballoon disabled
|
||||
c.add_invalid("--hvm --nodisks --pxe foobar") # Positional arguments error
|
||||
c.add_invalid("--nodisks --pxe --nonetworks") # pxe and nonetworks
|
||||
c.add_invalid("--nodisks --pxe --name test") # Colliding name
|
||||
c.add_invalid("--hvm --nodisks --pxe --watchdog default,action=foobar") # Busted --watchdog
|
||||
c.add_invalid("--hvm --nodisks --pxe --soundhw default --soundhw foobar") # Busted --soundhw
|
||||
|
39
virt-install
39
virt-install
@ -197,10 +197,19 @@ def convert_old_cpuset(options):
|
||||
logging.debug("Generated compat cpuset: --vcpus %s", options.vcpus)
|
||||
|
||||
|
||||
def convert_old_networks(options, number_of_default_nics):
|
||||
macs = virtinst.util.listify(options.mac)
|
||||
def convert_old_networks(options):
|
||||
if options.nonetworks:
|
||||
if options.mac:
|
||||
fail(_("Cannot use --mac with --nonetworks"))
|
||||
if options.bridge:
|
||||
fail(_("Cannot use --bridge with --nonetworks"))
|
||||
if options.network:
|
||||
fail(_("Cannot use --nonetworks with --network"))
|
||||
options.network = ["none"]
|
||||
|
||||
macs = virtinst.util.listify(options.mac)
|
||||
networks = virtinst.util.listify(options.network)
|
||||
bridges = virtinst.util.listify(options.bridge)
|
||||
bridges = virtinst.util.listify(options.bridge)
|
||||
|
||||
if bridges and networks:
|
||||
fail(_("Cannot mix both --bridge and --network arguments"))
|
||||
@ -215,7 +224,7 @@ def convert_old_networks(options, number_of_default_nics):
|
||||
return l
|
||||
|
||||
# If a plain mac is specified, have it imply a default network
|
||||
networks = padlist(networks, max(len(macs), number_of_default_nics))
|
||||
networks = padlist(networks, max(len(macs), 1))
|
||||
macs = padlist(macs, len(networks))
|
||||
|
||||
for idx in range(len(networks)):
|
||||
@ -230,7 +239,12 @@ def convert_old_networks(options, number_of_default_nics):
|
||||
networks[idx] = networks[idx].replace(prefix + ":",
|
||||
prefix + "=")
|
||||
|
||||
del(options.mac)
|
||||
del(options.bridge)
|
||||
del(options.nonetworks)
|
||||
|
||||
options.network = networks
|
||||
logging.debug("Distilled --network options: %s", options.network)
|
||||
|
||||
|
||||
def _determine_default_graphics(guest, default_override):
|
||||
@ -421,16 +435,6 @@ def check_option_collisions(options, guest):
|
||||
fail(_("Cannot mix --file, --nonsparse, or --file-size with --disk "
|
||||
"options. Use --disk PATH[,size=SIZE][,sparse=yes|no]"))
|
||||
|
||||
# Network collisions
|
||||
if options.nonetworks:
|
||||
if options.mac:
|
||||
fail(_("Cannot use --mac with --nonetworks"))
|
||||
if options.bridge:
|
||||
fail(_("Cannot use --bridge with --nonetworks"))
|
||||
if options.network:
|
||||
fail(_("Cannot use --network with --nonetworks"))
|
||||
return
|
||||
|
||||
# Install collisions
|
||||
if sum([bool(l) for l in [options.pxe, options.location,
|
||||
options.cdrom, options.import_install]]) > 1:
|
||||
@ -541,9 +545,6 @@ def show_warnings(options, guest):
|
||||
def build_installer(options, conn, virt_type):
|
||||
# Build the Installer instance
|
||||
if options.pxe:
|
||||
if options.nonetworks:
|
||||
fail(_("Can't use --pxe with --nonetworks"))
|
||||
|
||||
instclass = virtinst.PXEInstaller
|
||||
elif options.cdrom or options.location or options.livecd:
|
||||
instclass = virtinst.DistroInstaller
|
||||
@ -576,7 +577,7 @@ def build_guest_instance(conn, options, parsermap):
|
||||
|
||||
convert_old_memory(options)
|
||||
convert_old_sound(options)
|
||||
convert_old_networks(options, not options.nonetworks and 1 or 0)
|
||||
convert_old_networks(options)
|
||||
convert_old_graphics(guest, options)
|
||||
convert_old_disks(options)
|
||||
convert_old_features(options)
|
||||
@ -960,7 +961,7 @@ def parse_args():
|
||||
netg = parser.add_argument_group(_("Networking Configuration"))
|
||||
cli.add_net_option(netg)
|
||||
netg.add_argument("--nonetworks", action="store_true",
|
||||
help=_("Don't create network interfaces for the guest."))
|
||||
help=argparse.SUPPRESS)
|
||||
netg.add_argument("-b", "--bridge", action="append",
|
||||
help=argparse.SUPPRESS)
|
||||
netg.add_argument("-m", "--mac", action="append",
|
||||
|
@ -551,7 +551,7 @@ def add_net_option(devg):
|
||||
"--network bridge=mybr0\n"
|
||||
"--network network=my_libvirt_virtual_net\n"
|
||||
"--network network=mynet,model=virtio,mac=00:11...\n"
|
||||
"--network network=mynet,filterref=clean-traffic\n"
|
||||
"--network none\n"
|
||||
"--network help"))
|
||||
|
||||
|
||||
@ -1657,6 +1657,9 @@ class ParserNetwork(VirtCLIParser):
|
||||
self.set_param("virtualport.instanceid", "virtualport_instanceid")
|
||||
|
||||
def _parse(self, optsobj, inst):
|
||||
if optsobj.fullopts == "none":
|
||||
return
|
||||
|
||||
opts = optsobj.opts
|
||||
if "type" not in opts:
|
||||
if "network" in opts:
|
||||
|
Loading…
x
Reference in New Issue
Block a user