[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[et-mgmt-tools] [PATCH] Fix regression with --mac option

# HG changeset patch
# User john levon sun com
# Date 1228365031 28800
# Node ID 09d307f7983dc9e29be7e1fe724ef12ade1a42a2
# Parent  152e0bfb277efb24679d7c7f440df0b0f6b21529
Fix regression with --mac option

Older versions of virt-install allowed a MAC address to be specified
and a default network would be created.  For ease of use, if the user
specifies exactly one MAC address, create a default network for it.

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

diff --git a/virtinst/cli.py b/virtinst/cli.py
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -295,6 +295,15 @@ def digest_networks(conn, macs, bridges,
     if bridges:
         networks = map(lambda b: "bridge:" + b, bridges)
+    # With just one mac, create a default network if one is not
+    # specified.
+    if len(macs) == 1 and len(networks) == 0:
+        if util.privileged_user():
+            net = util.default_network(conn)
+            networks.append(net[0] + ":" + net[1])
+        else:
+            networks.append("user")
     # ensure we have less macs then networks. Auto fill in the remaining
     # macs       
     if len(macs) > len(networks):

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]