From e0e3153024042c5a20229583ff34c913a0a1ca18 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 27 Nov 2008 03:12:53 +0000
Subject: [PATCH] Allow network-less instances

Currently there's no way to specify no NICs for an instance, even though
this is a supported configuration.

The patch adds a --no-nics option to gnt-instance add.

Reviewed-by: amishchenko
---
 scripts/gnt-instance | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/gnt-instance b/scripts/gnt-instance
index d50265382..5af186cbc 100755
--- a/scripts/gnt-instance
+++ b/scripts/gnt-instance
@@ -302,6 +302,9 @@ def AddInstance(opts, args):
     for nidx, ndict in opts.nics.items():
       nidx = int(nidx)
       nics[nidx] = ndict
+  elif opts.no_nics:
+    # no nics
+    nics = []
   else:
     # default of one nic, all auto
     nics = [{}]
@@ -1145,6 +1148,8 @@ add_opts = [
              default=[], dest="nics",
              action="append",
              type="identkeyval"),
+  make_option("--no-nics", default=False, action="store_true",
+              help="Do not create any network cards for the instance"),
   make_option("--no-wait-for-sync", dest="wait_for_sync", default=True,
               action="store_false", help="Don't wait for sync (DANGEROUS!)"),
   make_option("--no-start", dest="start", default=True,
-- 
GitLab