[PATCH] Add usermode networking to the list of available network types

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

 



It's perfectly reasonable for privileged users to want to use usermode
networking, but currently, there's no way for them to do that. The
attached patch fixes this.

-- 
Soren Hansen
Ubuntu Server Team
http://www.ubuntu.com/
diff -r 8d3d06e022e9 -r 52478567f837 src/virtManager/addhardware.py
--- a/src/virtManager/addhardware.py	Wed Jan 16 00:12:04 2008 +0100
+++ b/src/virtManager/addhardware.py	Wed Jan 16 00:34:02 2008 +0100
@@ -178,7 +178,7 @@ class vmmAddHardware(gobject.GObject):
         self.window.get_widget("non-sparse").set_active(True)
         self.window.get_widget("hardware-type").set_active(0)
 
-        self.window.get_widget("net-type-network").set_active(True)
+        self.window.get_widget("net-type-network").set_active(False)
         self.window.get_widget("net-type-device").set_active(False)
         self.window.get_widget("mac-address").set_active(False)
         self.window.get_widget("create-mac-address").set_text("")
@@ -311,10 +311,12 @@ class vmmAddHardware(gobject.GObject):
             net = self.window.get_widget("net-network")
             model = net.get_model()
             return ["network", model.get_value(net.get_active_iter(), 0)]
-        else:
+        elif self.window.get_widget("net-type-device").get_active():
             dev = self.window.get_widget("net-device")
             model = dev.get_model()
             return ["bridge", model.get_value(dev.get_active_iter(), 0)]
+        else:
+            return ["user"]
 
     def get_config_macaddr(self):
         macaddr = None
@@ -609,9 +611,12 @@ class vmmAddHardware(gobject.GObject):
         if self.window.get_widget("net-type-network").get_active():
             self.window.get_widget("net-network").set_sensitive(True)
             self.window.get_widget("net-device").set_sensitive(False)
+        elif self.window.get_widget("net-type-device").get_active():
+            self.window.get_widget("net-network").set_sensitive(False)
+            self.window.get_widget("net-device").set_sensitive(True)
         else:
             self.window.get_widget("net-network").set_sensitive(False)
-            self.window.get_widget("net-device").set_sensitive(True)
+            self.window.get_widget("net-device").set_sensitive(False)
 
     def change_macaddr_use(self, ignore=None):
         if self.window.get_widget("mac-address").get_active():
diff -r 8d3d06e022e9 -r 52478567f837 src/virtManager/create.py
--- a/src/virtManager/create.py	Wed Jan 16 00:12:04 2008 +0100
+++ b/src/virtManager/create.py	Wed Jan 16 00:34:02 2008 +0100
@@ -272,7 +272,7 @@ class vmmCreate(gobject.GObject):
         self.populate_os_type_model()
         self.window.get_widget("os-type").set_active(0)
 
-        self.window.get_widget("net-type-network").set_active(True)
+        self.window.get_widget("net-type-network").set_active(False)
         self.window.get_widget("net-type-device").set_active(False)
         self.window.get_widget("mac-address").set_active(False)
         self.window.get_widget("create-mac-address").set_text("")
@@ -386,10 +386,12 @@ class vmmCreate(gobject.GObject):
             net = self.window.get_widget("net-network")
             model = net.get_model()
             return ["network", model.get_value(net.get_active_iter(), 0)]
-        else:
+        elif self.window.get_widget("net-type-device").get_active():
             dev = self.window.get_widget("net-device")
             model = dev.get_model()
             return ["bridge", model.get_value(dev.get_active_iter(), 0)]
+        else:
+            return ["user"]
 
     def get_config_macaddr(self):
         macaddr = None
@@ -740,9 +745,12 @@ class vmmCreate(gobject.GObject):
         if self.window.get_widget("net-type-network").get_active():
             self.window.get_widget("net-network").set_sensitive(True)
             self.window.get_widget("net-device").set_sensitive(False)
+        elif self.window.get_widget("net-type-device").get_active():
+            self.window.get_widget("net-network").set_sensitive(False)
+            self.window.get_widget("net-device").set_sensitive(True)
         else:
             self.window.get_widget("net-network").set_sensitive(False)
-            self.window.get_widget("net-device").set_sensitive(True)
+            self.window.get_widget("net-device").set_sensitive(False)
 
     def change_macaddr_use(self, ignore=None):
         if self.window.get_widget("mac-address").get_active():
@@ -923,7 +931,7 @@ class vmmCreate(gobject.GObject):
                     self._validation_error_box(_("Virtual Network Required"),
                                                _("You must select one of the virtual networks"))
                     return False
-            else:
+            elif self.window.get_widget("net-type-device").get_active():
                 if self.window.get_widget("net-device").get_active() == -1:
                     self._validation_error_box(_("Physical Device Required"),
                                                _("You must select one of the physical devices"))
diff -r 8d3d06e022e9 -r 52478567f837 src/vmm-add-hardware.glade
--- a/src/vmm-add-hardware.glade	Wed Jan 16 00:12:04 2008 +0100
+++ b/src/vmm-add-hardware.glade	Wed Jan 16 00:34:02 2008 +0100
@@ -1165,7 +1165,7 @@
 		      <child>
 			<widget class="GtkTable" id="table31">
 			  <property name="visible">True</property>
-			  <property name="n_rows">8</property>
+			  <property name="n_rows">9</property>
 			  <property name="n_columns">2</property>
 			  <property name="homogeneous">False</property>
 			  <property name="row_spacing">6</property>
@@ -1183,18 +1183,18 @@
 			    <packing>
 			      <property name="left_attach">1</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">4</property>
-			      <property name="bottom_attach">5</property>
+			      <property name="top_attach">5</property>
+			      <property name="bottom_attach">6</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options">fill</property>
 			    </packing>
 			  </child>
 
 			  <child>
-			    <widget class="GtkRadioButton" id="net-type-network">
+			    <widget class="GtkRadioButton" id="net-type-user">
 			      <property name="visible">True</property>
 			      <property name="can_focus">True</property>
-			      <property name="label" translatable="yes">_Virtual network</property>
+			      <property name="label" translatable="yes">_Usermode network</property>
 			      <property name="use_underline">True</property>
 			      <property name="relief">GTK_RELIEF_NORMAL</property>
 			      <property name="focus_on_click">True</property>
@@ -1214,6 +1214,30 @@
 			  </child>
 
 			  <child>
+			    <widget class="GtkRadioButton" id="net-type-network">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">_Virtual network</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">True</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			      <property name="group">net-type-user</property>
+			      <signal name="toggled" handler="on_network_toggled" last_modification_time="Tue, 20 Mar 2007 22:13:43 GMT"/>
+			    </widget>
+			    <packing>
+			      <property name="left_attach">0</property>
+			      <property name="right_attach">2</property>
+			      <property name="top_attach">1</property>
+			      <property name="bottom_attach">2</property>
+			      <property name="x_options">fill</property>
+			      <property name="y_options">fill</property>
+			    </packing>
+			  </child>
+
+			  <child>
 			    <widget class="GtkRadioButton" id="net-type-device">
 			      <property name="visible">True</property>
 			      <property name="can_focus">True</property>
@@ -1224,14 +1248,14 @@
 			      <property name="active">False</property>
 			      <property name="inconsistent">False</property>
 			      <property name="draw_indicator">True</property>
-			      <property name="group">net-type-network</property>
+			      <property name="group">net-type-user</property>
 			      <signal name="toggled" handler="on_network_toggled" last_modification_time="Tue, 20 Mar 2007 22:13:51 GMT"/>
 			    </widget>
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">3</property>
-			      <property name="bottom_attach">4</property>
+			      <property name="top_attach">4</property>
+			      <property name="bottom_attach">5</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options">fill</property>
 			    </packing>
@@ -1302,8 +1326,8 @@
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">2</property>
-			      <property name="bottom_attach">3</property>
+			      <property name="top_attach">3</property>
+			      <property name="bottom_attach">4</property>
 			      <property name="x_options">fill</property>
 			    </packing>
 			  </child>
@@ -1373,8 +1397,8 @@
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">5</property>
-			      <property name="bottom_attach">6</property>
+			      <property name="top_attach">6</property>
+			      <property name="bottom_attach">7</property>
 			      <property name="x_options">fill</property>
 			    </packing>
 			  </child>
@@ -1391,8 +1415,8 @@
 			    <packing>
 			      <property name="left_attach">1</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">1</property>
-			      <property name="bottom_attach">2</property>
+			      <property name="top_attach">2</property>
+			      <property name="bottom_attach">3</property>
 			      <property name="y_options">fill</property>
 			    </packing>
 			  </child>
@@ -1441,8 +1465,8 @@
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">1</property>
-			      <property name="top_attach">1</property>
-			      <property name="bottom_attach">2</property>
+			      <property name="top_attach">2</property>
+			      <property name="bottom_attach">3</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options"></property>
 			    </packing>
@@ -1492,8 +1516,8 @@
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">1</property>
-			      <property name="top_attach">4</property>
-			      <property name="bottom_attach">5</property>
+			      <property name="top_attach">5</property>
+			      <property name="bottom_attach">6</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options"></property>
 			    </packing>
@@ -1515,8 +1539,8 @@
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">6</property>
-			      <property name="bottom_attach">7</property>
+			      <property name="top_attach">7</property>
+			      <property name="bottom_attach">8</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options"></property>
 			    </packing>
@@ -1544,8 +1568,8 @@
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">1</property>
-			      <property name="top_attach">7</property>
-			      <property name="bottom_attach">8</property>
+			      <property name="top_attach">8</property>
+			      <property name="bottom_attach">9</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options"></property>
 			    </packing>
@@ -1569,8 +1593,8 @@
 			    <packing>
 			      <property name="left_attach">1</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">7</property>
-			      <property name="bottom_attach">8</property>
+			      <property name="top_attach">8</property>
+			      <property name="bottom_attach">9</property>
 			      <property name="y_options"></property>
 			    </packing>
 			  </child>
diff -r 8d3d06e022e9 -r 52478567f837 src/vmm-create.glade
--- a/src/vmm-create.glade	Wed Jan 16 00:12:04 2008 +0100
+++ b/src/vmm-create.glade	Wed Jan 16 00:34:02 2008 +0100
@@ -3287,7 +3287,7 @@ mipsel</property>
 		      <child>
 			<widget class="GtkTable" id="table31">
 			  <property name="visible">True</property>
-			  <property name="n_rows">8</property>
+			  <property name="n_rows">9</property>
 			  <property name="n_columns">2</property>
 			  <property name="homogeneous">False</property>
 			  <property name="row_spacing">6</property>
@@ -3305,8 +3305,31 @@ mipsel</property>
 			    <packing>
 			      <property name="left_attach">1</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">4</property>
-			      <property name="bottom_attach">5</property>
+			      <property name="top_attach">5</property>
+			      <property name="bottom_attach">6</property>
+			      <property name="x_options">fill</property>
+			      <property name="y_options">fill</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkRadioButton" id="net-type-user">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">_Usermode network</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">True</property>
+			      <property name="active">True</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			      <signal name="toggled" handler="on_network_toggled" last_modification_time="Tue, 20 Mar 2007 22:13:43 GMT"/>
+			    </widget>
+			    <packing>
+			      <property name="left_attach">0</property>
+			      <property name="right_attach">2</property>
+			      <property name="top_attach">0</property>
+			      <property name="bottom_attach">1</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options">fill</property>
 			    </packing>
@@ -3320,16 +3343,17 @@ mipsel</property>
 			      <property name="use_underline">True</property>
 			      <property name="relief">GTK_RELIEF_NORMAL</property>
 			      <property name="focus_on_click">True</property>
-			      <property name="active">True</property>
-			      <property name="inconsistent">False</property>
-			      <property name="draw_indicator">True</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			      <property name="group">net-type-user</property>
 			      <signal name="toggled" handler="on_network_toggled" last_modification_time="Tue, 20 Mar 2007 22:13:43 GMT"/>
 			    </widget>
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">0</property>
-			      <property name="bottom_attach">1</property>
+			      <property name="top_attach">1</property>
+			      <property name="bottom_attach">2</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options">fill</property>
 			    </packing>
@@ -3346,14 +3370,14 @@ mipsel</property>
 			      <property name="active">False</property>
 			      <property name="inconsistent">False</property>
 			      <property name="draw_indicator">True</property>
-			      <property name="group">net-type-network</property>
+			      <property name="group">net-type-user</property>
 			      <signal name="toggled" handler="on_network_toggled" last_modification_time="Tue, 20 Mar 2007 22:13:51 GMT"/>
 			    </widget>
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">3</property>
-			      <property name="bottom_attach">4</property>
+			      <property name="top_attach">4</property>
+			      <property name="bottom_attach">5</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options">fill</property>
 			    </packing>
@@ -3424,8 +3448,8 @@ mipsel</property>
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">2</property>
-			      <property name="bottom_attach">3</property>
+			      <property name="top_attach">3</property>
+			      <property name="bottom_attach">4</property>
 			      <property name="x_options">fill</property>
 			    </packing>
 			  </child>
@@ -3495,8 +3519,8 @@ mipsel</property>
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">5</property>
-			      <property name="bottom_attach">6</property>
+			      <property name="top_attach">6</property>
+			      <property name="bottom_attach">7</property>
 			      <property name="x_options">fill</property>
 			    </packing>
 			  </child>
@@ -3513,8 +3537,8 @@ mipsel</property>
 			    <packing>
 			      <property name="left_attach">1</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">1</property>
-			      <property name="bottom_attach">2</property>
+			      <property name="top_attach">2</property>
+			      <property name="bottom_attach">3</property>
 			      <property name="y_options">fill</property>
 			    </packing>
 			  </child>
@@ -3563,8 +3587,8 @@ mipsel</property>
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">1</property>
-			      <property name="top_attach">1</property>
-			      <property name="bottom_attach">2</property>
+			      <property name="top_attach">2</property>
+			      <property name="bottom_attach">3</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options"></property>
 			    </packing>
@@ -3614,8 +3638,8 @@ mipsel</property>
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">1</property>
-			      <property name="top_attach">4</property>
-			      <property name="bottom_attach">5</property>
+			      <property name="top_attach">5</property>
+			      <property name="bottom_attach">6</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options"></property>
 			    </packing>
@@ -3643,31 +3667,31 @@ mipsel</property>
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">1</property>
+			      <property name="top_attach">8</property>
+			      <property name="bottom_attach">9</property>
+			      <property name="x_options">fill</property>
+			      <property name="y_options"></property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkCheckButton" id="mac-address">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Set _fixed MAC address for your virtual system?</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">True</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			      <signal name="clicked" handler="on_mac_address_clicked" last_modification_time="Tue, 15 May 2007 02:05:47 GMT"/>
+			    </widget>
+			    <packing>
+			      <property name="left_attach">0</property>
+			      <property name="right_attach">2</property>
 			      <property name="top_attach">7</property>
 			      <property name="bottom_attach">8</property>
-			      <property name="x_options">fill</property>
-			      <property name="y_options"></property>
-			    </packing>
-			  </child>
-
-			  <child>
-			    <widget class="GtkCheckButton" id="mac-address">
-			      <property name="visible">True</property>
-			      <property name="can_focus">True</property>
-			      <property name="label" translatable="yes">Set _fixed MAC address for your virtual system?</property>
-			      <property name="use_underline">True</property>
-			      <property name="relief">GTK_RELIEF_NORMAL</property>
-			      <property name="focus_on_click">True</property>
-			      <property name="active">False</property>
-			      <property name="inconsistent">False</property>
-			      <property name="draw_indicator">True</property>
-			      <signal name="clicked" handler="on_mac_address_clicked" last_modification_time="Tue, 15 May 2007 02:05:47 GMT"/>
-			    </widget>
-			    <packing>
-			      <property name="left_attach">0</property>
-			      <property name="right_attach">2</property>
-			      <property name="top_attach">6</property>
-			      <property name="bottom_attach">7</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options"></property>
 			    </packing>
@@ -3691,8 +3715,8 @@ mipsel</property>
 			    <packing>
 			      <property name="left_attach">1</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">7</property>
-			      <property name="bottom_attach">8</property>
+			      <property name="top_attach">8</property>
+			      <property name="bottom_attach">9</property>
 			      <property name="y_options"></property>
 			    </packing>
 			  </child>

Attachment: signature.asc
Description: Digital signature

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux