[et-mgmt-tools] [PATCH] Add --nonetworks option

john.levon at sun.com john.levon at sun.com
Fri Jan 30 20:26:49 UTC 2009


# HG changeset patch
# User john.levon at sun.com
# Date 1233347129 28800
# Node ID 319c0671a923fcab3731f6aee283384c79cc1b4e
# Parent  f032492954493006474be7b4b6514174f56a915b
Add --nonetworks option

Signed-off-by: John Levon <john.levon at sun.com>

diff --git a/man/en/virt-install.1 b/man/en/virt-install.1
--- a/man/en/virt-install.1
+++ b/man/en/virt-install.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -129,11 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "VIRT-INSTALL 1"
-.TH VIRT-INSTALL 1 "2009-01-26" "perl v5.10.0" "Virtual Machine Install Tools"
-.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
+.TH VIRT-INSTALL 1 "2009-01-30" "perl v5.8.8" "Virtual Machine Install Tools"
 .SH "NAME"
 virt\-install \- provision new virtual machines
 .SH "SYNOPSIS"
@@ -288,6 +284,9 @@ by faster install times inside the guest
 by faster install times inside the guest. Thus use of this optional is recommended 
 to ensure consistently high performance and to avoid I/O errors in the guest 
 should the host filesystem fill up. 
+.IP "\-\-nonetworks" 4
+.IX Item "--nonetworks"
+Request a virtual machine without any network interfaces.
 .IP "\-m \s-1MAC\s0, \-\-mac=MAC" 4
 .IX Item "-m MAC, --mac=MAC"
 Fixed \s-1MAC\s0 address for the guest; If this parameter is omitted, or the value
diff --git a/man/en/virt-install.pod b/man/en/virt-install.pod
--- a/man/en/virt-install.pod
+++ b/man/en/virt-install.pod
@@ -178,6 +178,10 @@ by faster install times inside the guest
 by faster install times inside the guest. Thus use of this optional is recommended 
 to ensure consistently high performance and to avoid I/O errors in the guest 
 should the host filesystem fill up. 
+
+=item --nonetworks
+
+Request a virtual machine without any network interfaces.
 
 =item -m MAC, --mac=MAC
 
diff --git a/virt-install b/virt-install
--- a/virt-install
+++ b/virt-install
@@ -239,7 +239,15 @@ def get_disks(file_paths, disk_paths, si
     else:
         get_disk(disk, size, sparse, guest, hvm, conn, is_file_path)
 
-def get_networks(macs, bridges, networks, guest):
+def get_networks(macs, bridges, networks, nonetworks, guest):
+    if nonetworks:
+        if macs:
+            fail(_("Cannot use --mac with --nonetworks"))
+        if bridges:
+            fail(_("Cannot use --bridges with --nonetworks"))
+        if networks:
+            fail(_("Cannot use --network with --nonetworks"))
+        return
     (macs, networks) = cli.digest_networks(guest.conn, macs, bridges,
                                            networks, nics=1)
     map(lambda m, n: cli.get_network(m, n, guest), macs, networks)
@@ -413,6 +421,8 @@ def parse_args():
     parser.add_option_group(stog)
 
     netg = OptionGroup(parser, _("Networking Configuration"))
+    netg.add_option("", "--nonetworks", action="store_true",
+                    help=_("Don't create network interfaces for the guest."))
     netg.add_option("-b", "--bridge", type="string", dest="bridge",
                     action="callback", callback=cli.check_before_append,
                     help=_("Bridge to connect guest NIC to; if none given, "
@@ -600,6 +610,9 @@ def main():
         installer = virtinst.LiveCDInstaller(type = htype, os_type = os_type,
                                              conn = conn)
     elif options.pxe:
+        if options.nonetworks:
+            fail(_("Can't use --pxe with --nonetworks"))
+
         installer = virtinst.PXEInstaller(type = htype, os_type = os_type,
                                           conn = conn)
     else:
@@ -626,7 +639,8 @@ def main():
               options.sparse, options.nodisks, guest, hvm, conn)
 
     # set up network information
-    get_networks(options.mac, options.bridge, options.network, guest)
+    get_networks(options.mac, options.bridge, options.network,
+                 options.nonetworks, guest)
 
     # set up graphics information
     cli.get_graphics(options.vnc, options.vncport, options.nographics,




More information about the et-mgmt-tools mailing list