[PATCH 1/4] IPv6 support v2: update gui python and ui

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

 



The purpose of this update is:

1. replace use of IPy with ipaddr since ipaddr has needed
functionality and IPy does not.
2. Update the glade-3 ui (vmm-host.ui) to provide
for IPv6 as well as IPv4.  If either IPv4 or IPv6
is not defined, its respective frame is hidden.
3. The DNS Domain Name is added to the basic frame.
4. IPv4 forwarding is moved to the basic frame and ipv6
forwarding is added.
5. If an IPv4 address is not defined then the IPv4
is set to Isolated network, internal rout only.
6. IPv6 network has three values for Forwarding:
Isolated network, Isolated network with internal forwarding,
and Routed network.
7. Add network definitions to tests/testdriver.xml which
include IPv6 and other new parameters now being handled.

This patch includes the fix for getting a KeyError exception
when deleting a network definition.

In this update, createnet.py has been changed to use
ipaddr but it still only handles IPv4 network creation.
.
Signed-off-by: Gene Czarcinski <gene@xxxxxxxxx>
---
 tests/testdriver.xml     | 125 +++++++
 ui/vmm-host.ui           | 830 +++++++++++++++++++++++++++++++----------------
 virtManager/createnet.py |  67 ++--
 virtManager/host.py      |  85 ++++-
 virtManager/network.py   | 161 +++++++--
 5 files changed, 913 insertions(+), 355 deletions(-)

diff --git a/tests/testdriver.xml b/tests/testdriver.xml
index ad423ad..7f436ee 100644
--- a/tests/testdriver.xml
+++ b/tests/testdriver.xml
@@ -141,6 +141,131 @@
   </ip>
 </network>
 
+<network ipv6='yes'>
+  <name>net0</name>
+  <uuid>591d28b3-25fd-21f5-ac71-e1877d787945</uuid>
+  <bridge name='virbr1' stp='on' delay='0' />
+</network>
+
+<network>
+  <name>net6</name>
+  <uuid>e08c0cc3-b892-b53b-c41d-c4f526291be9</uuid>
+  <forward mode='nat'/>
+  <bridge name='virbr2' stp='on' delay='0' />
+  <domain name='net6'/>
+  <ip address='192.168.6.1' netmask='255.255.255.0'>
+    <dhcp>
+      <range start='192.168.6.128' end='192.168.6.254' />
+    </dhcp>
+  </ip>
+  <ip family='ipv6' address='fd00:beef:10:6::1' prefix='64'>
+    <dhcp>
+      <range start='fd00:beef:10:6::1:1' end='fd00:beef:10:6::1:f1' />
+    </dhcp>
+  </ip>
+</network>
+
+<network>
+  <name>net7</name>
+  <uuid>41b4afe4-87bb-8087-6724-5e208a2d483a</uuid>
+  <forward mode='nat'/>
+  <bridge name='virbr3' stp='on' delay='0' />
+  <domain name='net7'/>
+  <ip address='192.168.7.1' netmask='255.255.255.0'>
+    <dhcp>
+      <range start='192.168.7.128' end='192.168.7.254' />
+      <host mac='52:54:00:60:7d:5d' name='paul' ip='192.168.7.2' />
+      <host mac='52:54:00:69:eb:91' name='badbob' ip='192.168.7.3' />
+    </dhcp>
+  </ip>
+  <ip family='ipv6' address='fd00:beef:10:7::1' prefix='64'>
+    <dhcp>
+      <range start='fd00:beef:10:7::1:1' end='fd00:beef:10:7::1:f1' />
+      <host id='00:03:00:01:52:54:00:60:7d:5d' name='paul' ip='fd00:beef:10:7::7:2' />
+      <host id='00:03:00:01:52:54:00:69:eb:91' name='badbob' ip='fd00:beef:10:7::7:4' />
+    </dhcp>
+  </ip>
+  <ip family='ipv6' address='fd00:beef:12::' prefix='48' via='fd00:beef:10:7::7:2'>
+  </ip>
+  <ip family='ipv4' address='192.168.19.0' netmask='255.255.255.0'>
+  </ip>
+</network>
+
+<network>
+  <name>net8</name>
+  <uuid>f9c6675f-98f8-ce75-b39a-02c1d23081e0</uuid>
+  <forward mode='nat'/>
+  <bridge name='virbr4' stp='on' delay='0' />
+  <domain name='net8'/>
+  <ip family='ipv4' address='192.168.8.1' netmask='255.255.255.0'>
+    <dhcp>
+      <range start='192.168.8.64' end='192.168.8.79' />
+    </dhcp>
+  </ip>
+  <ip family='ipv6' address='fd00:beef:10:8::1' prefix='64'>
+    <dhcp>
+      <range start='fd00:beef:10:8::1:1' end='fd00:beef:10:8::1:f1' />
+      <host id='0:3:0:1:52:54:00:d0:2e:22' name='btrfs2' ip='fd00:beef:10:8::2:5' />
+    </dhcp>
+  </ip>
+  <ip family='ipv6' address='fd00:beef:13::' prefix='48' via='fd00:beef:10:8::2:5'>
+  </ip>
+  <ip family='ipv4' address='192.168.81.0' netmask='255.255.255.0' via='192.168.8.2'>
+  </ip>
+</network>
+
+<network>
+  <name>net9</name>
+  <uuid>327b43c5-6900-2e2c-7f14-e1a29bb2c9f5</uuid>
+  <forward mode='nat'/>
+  <bridge name='virbr5' stp='on' delay='0' />
+  <domain name='net9'/>
+  <ip address='192.168.109.1' netmask='255.255.255.0'>
+  </ip>
+  <ip address='192.168.9.1' netmask='255.255.255.0'>
+    <dhcp>
+      <range start='192.168.9.128' end='192.168.9.254' />
+    </dhcp>
+  </ip>
+  <ip family='ipv6' address='fd00:beef:10:9::1' prefix='64'>
+    <dhcp>
+      <range start='fd00:beef:10:9::100' end='fd00:beef:10:9::1fe' />
+    </dhcp>
+  </ip>
+  <ip family='ipv6' address='fd00:beef:12:9::1' prefix='64'>
+  </ip>
+</network>
+
+<network>
+  <name>net91</name>
+  <uuid>c1621b18-797c-e2cb-71f6-21ca120e51cc</uuid>
+  <forward mode='nat'/>
+  <bridge name='virbr6' stp='on' delay='0' />
+  <domain name='net91'/>
+  <ip address='192.168.91.1' netmask='255.255.255.0'>
+  </ip>
+</network>
+
+<network ipv6='yes'>
+  <name>net92</name>
+  <uuid>bf2e337c-ee12-a1d5-4c14-7185191fe00b</uuid>
+  <forward mode='nat'/>
+  <bridge name='virbr7' stp='on' delay='0' />
+  <ip family='ipv6' address='fd00:beef:10:92::1' prefix='64'>
+  </ip>
+</network>
+
+<network>
+  <name>net93</name>
+  <uuid>f117daa4-5aaf-43d9-3c09-d9e522e5a1df</uuid>
+  <bridge name='virbr15' stp='on' delay='0' />
+  <domain name='net93'/>
+  <ip address='192.168.93.1' netmask='255.255.255.0'>
+  </ip>
+  <ip family='ipv6' address='fd00:beef:10:93::1' prefix='64'>
+  </ip>
+</network>
+
 <pool type='dir'>
   <name>default-pool</name>
   <uuid>35bb2ad9-388a-cdfe-461a-b8907f6e53fe</uuid>
diff --git a/ui/vmm-host.ui b/ui/vmm-host.ui
index 5334f07..aca4cb7 100644
--- a/ui/vmm-host.ui
+++ b/ui/vmm-host.ui
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
+  <!-- interface-naming-policy toplevel-contextual -->
   <object class="GtkAccelGroup" id="accelgroup1"/>
   <object class="GtkImage" id="image3">
     <property name="visible">True</property>
@@ -328,7 +329,6 @@
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
                                 <property name="use_underline">True</property>
-                                <property name="xalign">0.5</property>
                                 <property name="draw_indicator">True</property>
                                 <signal name="toggled" handler="on_config_autoconnect_toggled" swapped="no"/>
                               </object>
@@ -495,9 +495,6 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="headers_visible">False</property>
-                            <child internal-child="selection">
-                              <object class="GtkTreeSelection" id="treeview-selection1"/>
-                            </child>
                           </object>
                         </child>
                       </object>
@@ -515,356 +512,632 @@
                           <object class="GtkVBox" id="net-details">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="spacing">20</property>
+                            <property name="spacing">10</property>
                             <child>
-                              <object class="GtkFrame" id="frame3">
+                              <object class="GtkAlignment" id="alignment6">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="label_xalign">0</property>
-                                <property name="shadow_type">none</property>
+                                <property name="yalign">0</property>
                                 <child>
-                                  <object class="GtkTable" id="table4">
+                                  <object class="GtkFrame" id="frame3">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="border_width">6</property>
-                                    <property name="n_rows">4</property>
-                                    <property name="n_columns">2</property>
-                                    <property name="column_spacing">6</property>
-                                    <property name="row_spacing">5</property>
-                                    <child>
-                                      <object class="GtkLabel" id="label56">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
-                                        <property name="label" translatable="yes">Name:</property>
-                                      </object>
-                                      <packing>
-                                        <property name="x_options">GTK_FILL</property>
-                                        <property name="y_options"/>
-                                      </packing>
-                                    </child>
+                                    <property name="label_xalign">0</property>
+                                    <property name="shadow_type">none</property>
                                     <child>
-                                      <object class="GtkLabel" id="label58">
+                                      <object class="GtkTable" id="table4">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
-                                        <property name="label" translatable="yes">Device:</property>
-                                      </object>
-                                      <packing>
-                                        <property name="top_attach">1</property>
-                                        <property name="bottom_attach">2</property>
-                                        <property name="x_options">GTK_FILL</property>
-                                        <property name="y_options"/>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkLabel" id="label63">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
-                                        <property name="label" translatable="yes">State:</property>
-                                      </object>
-                                      <packing>
-                                        <property name="top_attach">2</property>
-                                        <property name="bottom_attach">3</property>
-                                        <property name="x_options">GTK_FILL</property>
-                                        <property name="y_options"/>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkHBox" id="hbox3">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="spacing">3</property>
+                                        <property name="border_width">6</property>
+                                        <property name="n_rows">7</property>
+                                        <property name="n_columns">2</property>
+                                        <property name="column_spacing">6</property>
+                                        <property name="row_spacing">5</property>
                                         <child>
-                                          <object class="GtkImage" id="net-state-icon">
+                                          <object class="GtkLabel" id="label56">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
-                                            <property name="stock">gtk-missing-image</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">Name:</property>
                                           </object>
                                           <packing>
-                                            <property name="expand">False</property>
-                                            <property name="fill">True</property>
-                                            <property name="position">0</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
                                           </packing>
                                         </child>
                                         <child>
-                                          <object class="GtkLabel" id="net-state">
+                                          <object class="GtkLabel" id="label58">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
                                             <property name="xalign">0</property>
-                                            <property name="label">Running</property>
+                                            <property name="label" translatable="yes">Device:</property>
                                           </object>
                                           <packing>
-                                            <property name="expand">True</property>
-                                            <property name="fill">True</property>
-                                            <property name="position">1</property>
+                                            <property name="top_attach">1</property>
+                                            <property name="bottom_attach">2</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="label63">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">State:</property>
+                                          </object>
+                                          <packing>
+                                            <property name="top_attach">2</property>
+                                            <property name="bottom_attach">3</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkHBox" id="hbox3">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="spacing">3</property>
+                                            <child>
+                                              <object class="GtkImage" id="net-state-icon">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="stock">gtk-missing-image</property>
+                                              </object>
+                                              <packing>
+                                                <property name="expand">False</property>
+                                                <property name="fill">True</property>
+                                                <property name="position">0</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkLabel" id="net-state">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="xalign">0</property>
+                                                <property name="label">Running</property>
+                                              </object>
+                                              <packing>
+                                                <property name="expand">True</property>
+                                                <property name="fill">True</property>
+                                                <property name="position">1</property>
+                                              </packing>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">1</property>
+                                            <property name="right_attach">2</property>
+                                            <property name="top_attach">2</property>
+                                            <property name="bottom_attach">3</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="label70">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">A_utostart:</property>
+                                            <property name="use_underline">True</property>
+                                            <property name="mnemonic_widget">net-autostart</property>
+                                          </object>
+                                          <packing>
+                                            <property name="top_attach">3</property>
+                                            <property name="bottom_attach">4</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkCheckButton" id="net-autostart">
+                                            <property name="label">Some Label</property>
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">False</property>
+                                            <property name="use_underline">True</property>
+                                            <property name="draw_indicator">True</property>
+                                            <signal name="toggled" handler="on_net_autostart_toggled" swapped="no"/>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">1</property>
+                                            <property name="right_attach">2</property>
+                                            <property name="top_attach">3</property>
+                                            <property name="bottom_attach">4</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="net-name">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label">label</property>
+                                            <property name="selectable">True</property>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">1</property>
+                                            <property name="right_attach">2</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="net-device">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label">label</property>
+                                            <property name="selectable">True</property>
+                                          </object>
+                                          <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="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="label33">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">DNS Domain Name:</property>
+                                            <property name="use_markup">True</property>
+                                          </object>
+                                          <packing>
+                                            <property name="top_attach">4</property>
+                                            <property name="bottom_attach">5</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="label34">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">IPv4 Forwarding:</property>
+                                          </object>
+                                          <packing>
+                                            <property name="top_attach">5</property>
+                                            <property name="bottom_attach">6</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="net-name-domain">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                          </object>
+                                          <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="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkHBox" id="hbox13">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="spacing">3</property>
+                                            <child>
+                                              <object class="GtkImage" id="net-ip4-forwarding-icon">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="stock">gtk-missing-image</property>
+                                              </object>
+                                              <packing>
+                                                <property name="expand">False</property>
+                                                <property name="fill">False</property>
+                                                <property name="position">0</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkLabel" id="net-ip4-forwarding">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="xalign">0</property>
+                                                <property name="label" translatable="yes">NAT to any device</property>
+                                              </object>
+                                              <packing>
+                                                <property name="expand">True</property>
+                                                <property name="fill">True</property>
+                                                <property name="position">1</property>
+                                              </packing>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">1</property>
+                                            <property name="right_attach">2</property>
+                                            <property name="top_attach">5</property>
+                                            <property name="bottom_attach">6</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="label22">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">IPv6 Forwarding:</property>
+                                          </object>
+                                          <packing>
+                                            <property name="top_attach">6</property>
+                                            <property name="bottom_attach">7</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkHBox" id="hbox6">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="spacing">3</property>
+                                            <child>
+                                              <object class="GtkImage" id="net-ip6-forwarding-icon">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="stock">gtk-missing-image</property>
+                                              </object>
+                                              <packing>
+                                                <property name="expand">False</property>
+                                                <property name="fill">False</property>
+                                                <property name="position">0</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkLabel" id="net-ip6-forwarding">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="xalign">0</property>
+                                                <property name="label" translatable="yes">Routed</property>
+                                              </object>
+                                              <packing>
+                                                <property name="expand">True</property>
+                                                <property name="fill">True</property>
+                                                <property name="position">1</property>
+                                              </packing>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">1</property>
+                                            <property name="right_attach">2</property>
+                                            <property name="top_attach">6</property>
+                                            <property name="bottom_attach">7</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
                                           </packing>
                                         </child>
                                       </object>
-                                      <packing>
-                                        <property name="left_attach">1</property>
-                                        <property name="right_attach">2</property>
-                                        <property name="top_attach">2</property>
-                                        <property name="bottom_attach">3</property>
-                                        <property name="x_options">GTK_FILL</property>
-                                        <property name="y_options"/>
-                                      </packing>
                                     </child>
-                                    <child>
-                                      <object class="GtkLabel" id="label70">
+                                    <child type="label">
+                                      <object class="GtkLabel" id="label26">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
                                         <property name="xalign">0</property>
-                                        <property name="label" translatable="yes">A_utostart:</property>
-                                        <property name="use_underline">True</property>
-                                        <property name="mnemonic_widget">net-autostart</property>
+                                        <property name="label" translatable="yes">&lt;b&gt;Basic details&lt;/b&gt;</property>
+                                        <property name="use_markup">True</property>
                                       </object>
-                                      <packing>
-                                        <property name="top_attach">3</property>
-                                        <property name="bottom_attach">4</property>
-                                        <property name="x_options">GTK_FILL</property>
-                                        <property name="y_options"/>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkCheckButton" id="net-autostart">
-                                        <property name="label">Some Label</property>
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="receives_default">False</property>
-                                        <property name="use_underline">True</property>
-                                        <property name="xalign">0.5</property>
-                                        <property name="draw_indicator">True</property>
-                                        <signal name="toggled" handler="on_net_autostart_toggled" swapped="no"/>
-                                      </object>
-                                      <packing>
-                                        <property name="left_attach">1</property>
-                                        <property name="right_attach">2</property>
-                                        <property name="top_attach">3</property>
-                                        <property name="bottom_attach">4</property>
-                                        <property name="x_options">GTK_FILL</property>
-                                        <property name="y_options"/>
-                                      </packing>
                                     </child>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkAlignment" id="alignment4">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <child>
+                                  <object class="GtkFrame" id="net-frame-ip4">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label_xalign">0</property>
+                                    <property name="shadow_type">none</property>
                                     <child>
-                                      <object class="GtkLabel" id="net-name">
+                                      <object class="GtkTable" id="table3">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
-                                        <property name="label">label</property>
-                                        <property name="selectable">True</property>
+                                        <property name="border_width">6</property>
+                                        <property name="n_rows">4</property>
+                                        <property name="n_columns">2</property>
+                                        <property name="column_spacing">6</property>
+                                        <property name="row_spacing">5</property>
+                                        <child>
+                                          <object class="GtkLabel" id="label52">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">Network:</property>
+                                          </object>
+                                          <packing>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="label54">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">DHCP start:</property>
+                                          </object>
+                                          <packing>
+                                            <property name="top_attach">1</property>
+                                            <property name="bottom_attach">2</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="label55">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">DHCP end:</property>
+                                          </object>
+                                          <packing>
+                                            <property name="top_attach">2</property>
+                                            <property name="bottom_attach">3</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="net-ip4-network">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label">label</property>
+                                            <property name="selectable">True</property>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">1</property>
+                                            <property name="right_attach">2</property>
+                                            <property name="y_options">GTK_FILL</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="net-ip4-dhcp-start">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label">label</property>
+                                            <property name="selectable">True</property>
+                                          </object>
+                                          <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="y_options">GTK_FILL</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="net-ip4-dhcp-end">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label">label</property>
+                                            <property name="selectable">True</property>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">1</property>
+                                            <property name="right_attach">2</property>
+                                            <property name="top_attach">2</property>
+                                            <property name="bottom_attach">3</property>
+                                            <property name="y_options">GTK_FILL</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="net-ip4-route-label">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">Route-Via:</property>
+                                          </object>
+                                          <packing>
+                                            <property name="top_attach">3</property>
+                                            <property name="bottom_attach">4</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="net-ip4-route-via">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">&lt;network-addr&gt; via &lt;gateway-addr&gt;</property>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">1</property>
+                                            <property name="right_attach">2</property>
+                                            <property name="top_attach">3</property>
+                                            <property name="bottom_attach">4</property>
+                                            <property name="y_options">GTK_FILL</property>
+                                          </packing>
+                                        </child>
                                       </object>
-                                      <packing>
-                                        <property name="left_attach">1</property>
-                                        <property name="right_attach">2</property>
-                                        <property name="y_options"/>
-                                      </packing>
                                     </child>
-                                    <child>
-                                      <object class="GtkLabel" id="net-device">
+                                    <child type="label">
+                                      <object class="GtkLabel" id="label27">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
-                                        <property name="label">label</property>
-                                        <property name="selectable">True</property>
+                                        <property name="label" translatable="yes">&lt;b&gt;IPv4 configuration&lt;/b&gt;</property>
+                                        <property name="use_markup">True</property>
                                       </object>
-                                      <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="y_options"/>
-                                      </packing>
                                     </child>
                                   </object>
                                 </child>
-                                <child type="label">
-                                  <object class="GtkLabel" id="label26">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">&lt;b&gt;Basic details&lt;/b&gt;</property>
-                                    <property name="use_markup">True</property>
-                                  </object>
-                                </child>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
                                 <property name="fill">True</property>
-                                <property name="position">0</property>
+                                <property name="position">1</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkFrame" id="frame4">
+                              <object class="GtkAlignment" id="alignment5">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="label_xalign">0</property>
-                                <property name="shadow_type">none</property>
                                 <child>
-                                  <object class="GtkTable" id="table3">
+                                  <object class="GtkFrame" id="net-frame-ip6">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="border_width">6</property>
-                                    <property name="n_rows">4</property>
-                                    <property name="n_columns">2</property>
-                                    <property name="column_spacing">6</property>
-                                    <property name="row_spacing">5</property>
-                                    <child>
-                                      <object class="GtkLabel" id="label52">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
-                                        <property name="label" translatable="yes">Network:</property>
-                                      </object>
-                                      <packing>
-                                        <property name="x_options">GTK_FILL</property>
-                                        <property name="y_options"/>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkLabel" id="label54">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
-                                        <property name="label" translatable="yes">DHCP start:</property>
-                                      </object>
-                                      <packing>
-                                        <property name="top_attach">1</property>
-                                        <property name="bottom_attach">2</property>
-                                        <property name="x_options">GTK_FILL</property>
-                                        <property name="y_options"/>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkLabel" id="label55">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
-                                        <property name="label" translatable="yes">DHCP end:</property>
-                                      </object>
-                                      <packing>
-                                        <property name="top_attach">2</property>
-                                        <property name="bottom_attach">3</property>
-                                        <property name="x_options">GTK_FILL</property>
-                                        <property name="y_options"/>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkLabel" id="label22">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
-                                        <property name="label" translatable="yes">Forwarding:</property>
-                                      </object>
-                                      <packing>
-                                        <property name="top_attach">3</property>
-                                        <property name="bottom_attach">4</property>
-                                        <property name="x_options">GTK_FILL</property>
-                                        <property name="y_options"/>
-                                      </packing>
-                                    </child>
+                                    <property name="label_xalign">0</property>
+                                    <property name="shadow_type">none</property>
                                     <child>
-                                      <object class="GtkHBox" id="hbox6">
+                                      <object class="GtkTable" id="table9">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="spacing">3</property>
+                                        <property name="border_width">6</property>
+                                        <property name="n_rows">4</property>
+                                        <property name="n_columns">2</property>
+                                        <property name="column_spacing">6</property>
+                                        <property name="row_spacing">5</property>
                                         <child>
-                                          <object class="GtkImage" id="net-ip4-forwarding-icon">
+                                          <object class="GtkLabel" id="label39">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
-                                            <property name="stock">gtk-missing-image</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">Network:</property>
                                           </object>
                                           <packing>
-                                            <property name="expand">False</property>
-                                            <property name="fill">False</property>
-                                            <property name="position">0</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
                                           </packing>
                                         </child>
                                         <child>
-                                          <object class="GtkLabel" id="net-ip4-forwarding">
+                                          <object class="GtkLabel" id="label40">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
                                             <property name="xalign">0</property>
-                                            <property name="label" translatable="yes">NAT to any physical device</property>
+                                            <property name="label" translatable="yes">DHCP start:</property>
                                           </object>
                                           <packing>
-                                            <property name="expand">False</property>
-                                            <property name="fill">False</property>
-                                            <property name="position">1</property>
+                                            <property name="top_attach">1</property>
+                                            <property name="bottom_attach">2</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="label41">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">DHCP end:</property>
+                                          </object>
+                                          <packing>
+                                            <property name="top_attach">2</property>
+                                            <property name="bottom_attach">3</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="net-ip6-route-label">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">Route-Via:</property>
+                                          </object>
+                                          <packing>
+                                            <property name="top_attach">3</property>
+                                            <property name="bottom_attach">4</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                            <property name="y_options"/>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="net-ip6-network">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label">label</property>
+                                            <property name="selectable">True</property>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">1</property>
+                                            <property name="right_attach">2</property>
+                                            <property name="y_options">GTK_FILL</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="net-ip6-dhcp-start">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label">label</property>
+                                            <property name="selectable">True</property>
+                                          </object>
+                                          <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="y_options">GTK_FILL</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="net-ip6-dhcp-end">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label">label</property>
+                                            <property name="selectable">True</property>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">1</property>
+                                            <property name="right_attach">2</property>
+                                            <property name="top_attach">2</property>
+                                            <property name="bottom_attach">3</property>
+                                            <property name="y_options">GTK_FILL</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="net-ip6-route-via">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label">&lt;network-addr&gt; via &lt;gateway-addr&gt;</property>
+                                            <property name="selectable">True</property>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">1</property>
+                                            <property name="right_attach">2</property>
+                                            <property name="top_attach">3</property>
+                                            <property name="bottom_attach">4</property>
+                                            <property name="y_options">GTK_FILL</property>
                                           </packing>
                                         </child>
                                       </object>
-                                      <packing>
-                                        <property name="left_attach">1</property>
-                                        <property name="right_attach">2</property>
-                                        <property name="top_attach">3</property>
-                                        <property name="bottom_attach">4</property>
-                                        <property name="x_options">GTK_FILL</property>
-                                        <property name="y_options">GTK_FILL</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkLabel" id="net-ip4-network">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
-                                        <property name="label">label</property>
-                                        <property name="selectable">True</property>
-                                      </object>
-                                      <packing>
-                                        <property name="left_attach">1</property>
-                                        <property name="right_attach">2</property>
-                                        <property name="y_options">GTK_FILL</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkLabel" id="net-ip4-dhcp-start">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
-                                        <property name="label">label</property>
-                                        <property name="selectable">True</property>
-                                      </object>
-                                      <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="y_options">GTK_FILL</property>
-                                      </packing>
                                     </child>
-                                    <child>
-                                      <object class="GtkLabel" id="net-ip4-dhcp-end">
+                                    <child type="label">
+                                      <object class="GtkLabel" id="label43">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
-                                        <property name="label">label</property>
-                                        <property name="selectable">True</property>
+                                        <property name="label" translatable="yes">&lt;b&gt;IPv6 configuration&lt;/b&gt;</property>
+                                        <property name="use_markup">True</property>
                                       </object>
-                                      <packing>
-                                        <property name="left_attach">1</property>
-                                        <property name="right_attach">2</property>
-                                        <property name="top_attach">2</property>
-                                        <property name="bottom_attach">3</property>
-                                        <property name="y_options">GTK_FILL</property>
-                                      </packing>
                                     </child>
                                   </object>
                                 </child>
-                                <child type="label">
-                                  <object class="GtkLabel" id="label27">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="label" translatable="yes">&lt;b&gt;IPv4 configuration&lt;/b&gt;</property>
-                                    <property name="use_markup">True</property>
-                                  </object>
-                                </child>
                               </object>
                               <packing>
-                                <property name="expand">True</property>
+                                <property name="expand">False</property>
                                 <property name="fill">True</property>
-                                <property name="position">1</property>
+                                <property name="position">2</property>
                               </packing>
                             </child>
                             <child>
@@ -875,7 +1148,7 @@
                               <packing>
                                 <property name="expand">False</property>
                                 <property name="fill">True</property>
-                                <property name="position">2</property>
+                                <property name="position">3</property>
                               </packing>
                             </child>
                           </object>
@@ -1100,9 +1373,6 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="headers_visible">False</property>
-                            <child internal-child="selection">
-                              <object class="GtkTreeSelection" id="treeview-selection2"/>
-                            </child>
                           </object>
                         </child>
                       </object>
@@ -1284,7 +1554,6 @@
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">False</property>
                                         <property name="use_underline">True</property>
-                                        <property name="xalign">0.5</property>
                                         <property name="draw_indicator">True</property>
                                         <signal name="toggled" handler="on_pool_autostart_toggled" swapped="no"/>
                                       </object>
@@ -1383,9 +1652,6 @@
                                             <property name="visible">True</property>
                                             <property name="can_focus">True</property>
                                             <signal name="button-press-event" handler="on_vol_list_button_press_event" swapped="no"/>
-                                            <child internal-child="selection">
-                                              <object class="GtkTreeSelection" id="treeview-selection3"/>
-                                            </child>
                                           </object>
                                         </child>
                                       </object>
@@ -1653,9 +1919,6 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="headers_visible">False</property>
-                            <child internal-child="selection">
-                              <object class="GtkTreeSelection" id="treeview-selection4"/>
-                            </child>
                           </object>
                         </child>
                       </object>
@@ -2073,9 +2336,6 @@
                                           <object class="GtkTreeView" id="interface-child-list">
                                             <property name="visible">True</property>
                                             <property name="can_focus">True</property>
-                                            <child internal-child="selection">
-                                              <object class="GtkTreeSelection" id="treeview-selection5"/>
-                                            </child>
                                           </object>
                                         </child>
                                       </object>
diff --git a/virtManager/createnet.py b/virtManager/createnet.py
index 79dd249..846cfbf 100644
--- a/virtManager/createnet.py
+++ b/virtManager/createnet.py
@@ -21,7 +21,7 @@
 import logging
 import re
 
-from IPy import IP
+import ipaddr
 
 from gi.repository import Gtk
 from gi.repository import Gdk
@@ -153,7 +153,7 @@ class vmmCreateNetwork(vmmGObjectUI):
         src.modify_text(Gtk.StateType.NORMAL, black)
 
         # No IP specified or invalid IP
-        if ip is None or ip.version() != 4:
+        if ip is None or ip.version != 4:
             src.modify_base(Gtk.StateType.NORMAL, red)
             self.widget("net-info-netmask").set_text("")
             self.widget("net-info-broadcast").set_text("")
@@ -162,26 +162,25 @@ class vmmCreateNetwork(vmmGObjectUI):
             self.widget("net-info-type").set_text("")
             return
 
+        # FIXME: handle other networks and not just private?
         # We've got a valid IP
-        if ip.len() < 4 or ip.iptype() != "PRIVATE":
-            src.modify_base(Gtk.StateType.NORMAL, red)
+        if ip.numhosts < 16 or not ip.is_private:
+            src.modify_base(gtk.STATE_NORMAL, red)
         else:
             src.modify_base(Gtk.StateType.NORMAL, green)
-        self.widget("net-info-netmask").set_text(str(ip.netmask()))
-        self.widget("net-info-broadcast").set_text(str(ip.broadcast()))
+        self.widget("net-info-netmask").set_text(str(ip.netmask))
+        self.widget("net-info-broadcast").set_text(str(ip.broadcast))
 
-        if ip.len() <= 1:
+        if ip.prefixlen == 32:
             self.widget("net-info-gateway").set_text("")
         else:
-            self.widget("net-info-gateway").set_text(str(ip[1]))
+            self.widget("net-info-gateway").set_text(str(ip.network + 1))
         self.widget("net-info-size").set_text(_("%d addresses") %
-                                                         (ip.len()))
+                                                         (ip.numhosts))
 
-        if ip.iptype() == "PUBLIC":
-            self.widget("net-info-type").set_text(_("Public"))
-        elif ip.iptype() == "PRIVATE":
+        if ip.is_private:
             self.widget("net-info-type").set_text(_("Private"))
-        elif ip.iptype() == "RESERVED":
+        elif ip.is_reserved:
             self.widget("net-info-type").set_text(_("Reserved"))
         else:
             self.widget("net-info-type").set_text(_("Other"))
@@ -192,8 +191,8 @@ class vmmCreateNetwork(vmmGObjectUI):
         self.widget("net-dhcp-end").set_sensitive(val)
 
     def change_dhcp_start(self, src):
-        end = self.get_config_dhcp_start()
-        self.change_dhcp(src, end)
+        start = self.get_config_dhcp_start()
+        self.change_dhcp(src, start)
 
     def change_dhcp_end(self, src):
         end = self.get_config_dhcp_end()
@@ -222,18 +221,18 @@ class vmmCreateNetwork(vmmGObjectUI):
 
     def get_config_ip4(self):
         try:
-            return IP(self.widget("net-network").get_text())
+            return ipaddr.IPNetwork(self.widget("net-network").get_text())
         except:
             return None
 
     def get_config_dhcp_start(self):
         try:
-            return IP(self.widget("net-dhcp-start").get_text())
+            return ipaddr.IPNetwork(self.widget("net-dhcp-start").get_text())
         except:
             return None
     def get_config_dhcp_end(self):
         try:
-            return IP(self.widget("net-dhcp-end").get_text())
+            return ipaddr.IPNetwork(self.widget("net-dhcp-end").get_text())
         except:
             return None
 
@@ -260,16 +259,16 @@ class vmmCreateNetwork(vmmGObjectUI):
 
         ip = self.get_config_ip4()
         self.widget("summary-ip4-network").set_text(str(ip))
-        self.widget("summary-ip4-gateway").set_text(str(ip[1]))
-        self.widget("summary-ip4-netmask").set_text(str(ip.netmask()))
+        self.widget("summary-ip4-gateway").set_text(str(ip.network + 1))
+        self.widget("summary-ip4-netmask").set_text(str(ip.netmask))
 
         self.widget("label-dhcp-end").set_property("visible", dodhcp)
         self.widget("summary-dhcp-end").set_property("visible", dodhcp)
         if dodhcp:
             start = self.get_config_dhcp_start()
             end = self.get_config_dhcp_end()
-            self.widget("summary-dhcp-start").set_text(str(start))
-            self.widget("summary-dhcp-end").set_text(str(end))
+            self.widget("summary-dhcp-start").set_text(str(start.network))
+            self.widget("summary-dhcp-end").set_text(str(end.network))
             self.widget("label-dhcp-start").set_text(_("Start address:"))
             self.widget("label-dhcp-end").show()
             self.widget("summary-dhcp-end").show()
@@ -284,13 +283,13 @@ class vmmCreateNetwork(vmmGObjectUI):
 
     def populate_dhcp(self):
         ip = self.get_config_ip4()
-        start = int(ip.len() / 2)
-        end = ip.len() - 2
+        start = int(ip.numhosts / 2)
+        end   = int(ip.numhosts - 2)
 
         if self.widget("net-dhcp-start").get_text() == "":
-            self.widget("net-dhcp-start").set_text(str(ip[start]))
+            self.widget("net-dhcp-start").set_text(str(ip.network + start))
         if self.widget("net-dhcp-end").get_text() == "":
-            self.widget("net-dhcp-end").set_text(str(ip[end]))
+            self.widget("net-dhcp-end").set_text(str(ip.network + end))
 
     def page_changed(self, ignore1, ignore2, page_number):
         if page_number == PAGE_NAME:
@@ -331,13 +330,13 @@ class vmmCreateNetwork(vmmGObjectUI):
             else:
                 xml += "  <forward mode='%s'/>\n" % mode
 
-        xml += "  <ip address='%s' netmask='%s'>\n" % (str(ip[1]),
-                                                       str(ip.netmask()))
+        xml += "  <ip address='%s' netmask='%s'>\n" % (str(ip.network + 1),
+                                                       str(ip.netmask))
 
         if self.get_config_dhcp_enable():
             xml += "    <dhcp>\n"
-            xml += "      <range start='%s' end='%s'/>\n" % (str(start),
-                                                             str(end))
+            xml += "      <range start='%s' end='%s'/>\n" % (str(start.network),
+                                                             str(end.network))
             xml += "    </dhcp>\n"
 
         xml += "  </ip>\n"
@@ -372,15 +371,15 @@ class vmmCreateNetwork(vmmGObjectUI):
             return self.err.val_err(_("Invalid Network Address"),
                     _("The network address could not be understood"))
 
-        if ip.version() != 4:
+        if ip.version != 4:
             return self.err.val_err(_("Invalid Network Address"),
                     _("The network must be an IPv4 address"))
 
-        if ip.len() < 4:
+        if ip.numhosts < 16:
             return self.err.val_err(_("Invalid Network Address"),
-                    _("The network prefix must be at least /4 (16 addresses)"))
+                    _("The network prefix must be at least /28 (16 addresses)"))
 
-        if ip.iptype() != "PRIVATE":
+        if not ip.is_private:
             res = self.err.yes_no(_("Check Network Address"),
                     _("The network should normally use a private IPv4 "
                       "address. Use this non-private address anyway?"))
diff --git a/virtManager/host.py b/virtManager/host.py
index ff50f82..690af07 100644
--- a/virtManager/host.py
+++ b/virtManager/host.py
@@ -508,7 +508,14 @@ class vmmHost(vmmGObjectUI):
             return
 
         self.widget("network-pages").set_current_page(0)
-        net = self.conn.get_net(selected[0].get_value(selected[1], 0))
+        try:
+            net = self.conn.get_net(selected[0].get_value(selected[1], 0))
+        except KeyError:
+            self.widget("net-apply").set_sensitive(False)
+            return
+        except Exception, e:
+            logging.exception(e)
+            self.set_net_error_page(_("Error selecting network: %s") % e)
 
         try:
             self.populate_net_state(net)
@@ -523,6 +530,11 @@ class vmmHost(vmmGObjectUI):
 
         self.widget("net-details").set_sensitive(True)
         self.widget("net-name").set_text(net.get_name())
+        dns_name = net.get_name_domain()
+        if dns_name:
+            self.widget("net-name-domain").set_text(dns_name)
+        else:
+            self.widget("net-name-domain").set_text("")
 
         dev = active and net.get_bridge_device() or ""
         state = active and _("Active") or _("Inactive")
@@ -544,24 +556,76 @@ class vmmHost(vmmGObjectUI):
         self.widget("net-autostart").set_active(autostart)
         self.widget("net-autostart").set_label(autolabel)
 
-        network = net.get_ipv4_network()
+        #########  IPv4  #########
+        result = net.get_ipv4_network()
+        network = result[0]
+        dhcp = result[1]
+        route = result[2]
+        if network:
+            self.widget("net-frame-ip4").show()
+        else:
+            self.widget("net-frame-ip4").hide()
         self.widget("net-ip4-network").set_text(str(network))
 
-        dhcp = net.get_ipv4_dhcp_range()
         start = dhcp and str(dhcp[0]) or _("Disabled")
         end = dhcp and str(dhcp[1]) or _("Disabled")
         self.widget("net-ip4-dhcp-start").set_text(start)
         self.widget("net-ip4-dhcp-end").set_text(end)
+        if route and route[0] and route[1]:
+            routeVia = str(route[0]) + " via " + str(route[1])
+            self.widget("net-ip4-route-label").show()
+        else:
+            routeVia = _("")
+            self.widget("net-ip4-route-label").hide()
+        self.widget("net-ip4-route-via").set_text(routeVia)
 
         forward, ignore = net.get_ipv4_forward()
         iconsize = Gtk.IconSize.MENU
         icon = forward and Gtk.STOCK_CONNECT or Gtk.STOCK_DISCONNECT
-
         self.widget("net-ip4-forwarding-icon").set_from_stock(icon, iconsize)
-
         forward_str = net.pretty_forward_mode()
         self.widget("net-ip4-forwarding").set_text(forward_str)
 
+        #########  IPv6  #########
+        result = net.get_ipv6_network()
+        network = result[0]
+        dhcp = result[1]
+        route = result[2]
+        if network:
+            self.widget("net-frame-ip6").show()
+            iconsize = Gtk.IconSize.MENU
+            icon = Gtk.STOCK_CONNECT
+            self.widget("net-ip6-forwarding-icon").set_from_stock(icon, iconsize)
+            self.widget("net-ip6-forwarding").set_text(_("Routed network"))
+        else:
+            self.widget("net-frame-ip6").hide()
+            iconsize = Gtk.IconSize.MENU
+            icon = Gtk.STOCK_DISCONNECT
+            self.widget("net-ip6-forwarding-icon").set_from_stock(icon, iconsize)
+            ipv6 = net.get_ipv6_route()
+            if ipv6:
+                self.widget("net-ip6-forwarding").set_text(
+                                        _("Isolated network, internal and host routing only"))
+            elif ipv6 == 'yes':
+                self.widget("net-ip6-forwarding").set_text(
+                                        _("Isolated network, internal routing only"))
+            else:
+                self.widget("net-ip6-forwarding").set_text(
+                                        _("Isolated network, routing disabled"))
+        self.widget("net-ip6-network").set_text(str(network))
+
+        start = dhcp and str(dhcp[0]) or _("Disabled")
+        end = dhcp and str(dhcp[1]) or _("Disabled")
+        self.widget("net-ip6-dhcp-start").set_text(start)
+        self.widget("net-ip6-dhcp-end").set_text(end)
+        if route and route[0] and route[1]:
+            routeVia = str(route[0]) + " via " + str(route[1])
+            self.widget("net-ip6-route-label").show()
+        else:
+            routeVia = ""
+            self.widget("net-ip6-route-label").hide()
+        self.widget("net-ip6-route-via").set_text(routeVia)
+
 
     def reset_net_state(self):
         self.widget("net-details").set_sensitive(False)
@@ -579,10 +643,19 @@ class vmmHost(vmmGObjectUI):
         self.widget("net-ip4-network").set_text("")
         self.widget("net-ip4-dhcp-start").set_text("")
         self.widget("net-ip4-dhcp-end").set_text("")
+        self.widget("net-ip4-route-label").hide()
+        self.widget("net-ip4-route-via").set_text("")
         self.widget("net-ip4-forwarding-icon").set_from_stock(
                                     Gtk.STOCK_DISCONNECT, Gtk.IconSize.MENU)
         self.widget("net-ip4-forwarding").set_text(
-                                    _("Isolated virtual network"))
+                                    _("Isolated network"))
+        self.widget("net-ip6-network").set_text("")
+        self.widget("net-ip6-dhcp-start").set_text("")
+        self.widget("net-ip6-dhcp-end").set_text("")
+        self.widget("net-ip6-route-label").hide()
+        self.widget("net-ip6-route-via").set_text("")
+        self.widget("net-ip6-forwarding").set_text(
+                                    _("Isolated network"))
         self.widget("net-apply").set_sensitive(False)
 
     def repopulate_networks(self, src_ignore, uuid_ignore):
diff --git a/virtManager/network.py b/virtManager/network.py
index 13a16e3..a28bdb6 100644
--- a/virtManager/network.py
+++ b/virtManager/network.py
@@ -18,9 +18,9 @@
 # MA 02110-1301 USA.
 #
 
-from IPy import IP
-
 from virtManager import util
+import ipaddr
+import libxml2
 from virtManager.libvirtobject import vmmLibvirtObject
 
 class vmmNetwork(vmmLibvirtObject):
@@ -43,7 +43,7 @@ class vmmNetwork(vmmLibvirtObject):
                 else:
                     desc = "%s network" % forward.capitalize()
         else:
-            desc = _("Isolated network")
+            desc = _("Isolated network, internal and host routing only")
 
         return desc
 
@@ -97,27 +97,137 @@ class vmmNetwork(vmmLibvirtObject):
         return self.net.autostart()
 
     def get_ipv4_network(self):
+        doc = None
+        ret = None
+        goodNode = None
+        dhcpstart = None
+        dhcpend = None
+        routeAddr = None
+        routeVia = None
         xml = self.get_xml()
-        if util.xpath(xml, "/network/ip") is None:
-            return None
-        addrStr = util.xpath(xml, "/network/ip/@address")
-        netmaskStr = util.xpath(xml, "/network/ip/@netmask")
-        prefix = util.xpath(xml, "/network/ip/@prefix")
-
-        if prefix:
-            prefix = int(prefix)
-            binstr = ((prefix * "1") + ((32 - prefix) * "0"))
-            netmaskStr = str(IP(int(binstr, base=2)))
-
-        if netmaskStr:
-            netmask = IP(netmaskStr)
-            gateway = IP(addrStr)
-            network = IP(gateway.int() & netmask.int())
-            ret = IP(str(network) + "/" + netmaskStr)
+        doc = libxml2.parseDoc(xml)
+        nodes = doc.xpathEval('//ip')
+        for node in nodes:
+            family = node.xpathEval('string(./@family)')
+            if not family or family == 'ipv4':
+                dhcp = node.xpathEval('string(./dhcp)')
+                if dhcp:
+                    dhcpstart = node.xpathEval('string(./dhcp/range[1]/@start)')
+                    dhcpend = node.xpathEval('string(./dhcp/range[1]/@end)')
+                    goodNode = node
+                    break
+
+        for node in nodes:
+            family = node.xpathEval('string(./@family)')
+            if not family or family == 'ipv4':
+                routeVia = node.xpathEval('string(./@via)')
+                if routeVia:
+                    routeAddr = node.xpathEval('string(./@address)')
+                    break;
+
+        if goodNode == None:
+            for node in nodes:
+                family = node.xpathEval('string(./@family)')
+                if not family or family == 'ipv4':
+                    tmp = node.xpathEval('string(./@via)')
+                    if tmp:
+                        continue
+                    goodNode = node;
+                    break
+
+        if goodNode:
+            addrStr    = goodNode.xpathEval('string(./@address)')
+            netmaskStr = goodNode.xpathEval('string(./@netmask)')
+            prefix     = goodNode.xpathEval('string(./@prefix)')
+            if prefix:
+                prefix = int(prefix)
+                ret = str(ipaddr.IPNetwork(str(addrStr) + "/" + str(prefix)).masked())
+            elif netmaskStr:
+                netmask = ipaddr.IPAddress(netmaskStr)
+                network = ipaddr.IPAddress(addrStr)
+                ret = str(ipaddr.IPNetwork(str(network) + "/" + str(netmask)).masked())
+            else:
+                ret = str(ipaddr.IPNetwork(str(addrStr)))
+        if doc:
+            doc.freeDoc()
+        if dhcpstart and dhcpend:
+            dhcp = [str(ipaddr.IPAddress(dhcpstart)), str(ipaddr.IPAddress(dhcpend))]
+        else:
+            dhcp = None
+        if routeAddr and routeVia:
+            route = [str(ipaddr.IPAddress(routeAddr)), str(ipaddr.IPAddress(routeVia))]
+        else:
+            route = None
+        return [ret, dhcp, route]
+
+    def get_ipv6_network(self):
+        doc = None
+        ret = None
+        goodNode = None
+        dhcpstart = None
+        dhcpend = None
+        routeAddr = None
+        routeVia = None
+        xml = self.get_xml()
+        doc = libxml2.parseDoc(xml)
+        nodes = doc.xpathEval('//ip')
+        for node in nodes:
+            family = node.xpathEval('string(./@family)')
+            if family and family == 'ipv6':
+                dhcp = node.xpathEval('string(./dhcp)')
+                if dhcp:
+                    dhcpstart = node.xpathEval('string(./dhcp/range[1]/@start)')
+                    dhcpend = node.xpathEval('string(./dhcp/range[1]/@end)')
+                    goodNode = node
+                    break
+
+        for node in nodes:
+            family = node.xpathEval('string(./@family)')
+            if family and family == 'ipv6':
+                routeVia = node.xpathEval('string(./@via)')
+                if routeVia:
+                    routeAddr = node.xpathEval('string(./@address)')
+                    break;
+
+        if goodNode == None:
+            for node in nodes:
+                family = node.xpathEval('string(./@family)')
+                if family and family == 'ipv6':
+                    tmp = node.xpathEval('string(./@via)')
+                    if tmp:
+                        continue
+                    goodNode = node;
+                    break
+
+        if goodNode:
+            addrStr    = goodNode.xpathEval('string(./@address)')
+            prefix     = goodNode.xpathEval('string(./@prefix)')
+            if prefix:
+                prefix = int(prefix)
+                ret = str(ipaddr.IPNetwork(str(addrStr) + "/" + str(prefix)).masked())
+            else:
+                ret = str(ipaddr.IPNetwork(str(addrStr)))
+        if doc:
+            doc.freeDoc()
+        if dhcpstart and dhcpend:
+            dhcp = [str(ipaddr.IPAddress(dhcpstart)), str(ipaddr.IPAddress(dhcpend))]
+        else:
+            dhcp = None
+        if routeAddr and routeVia:
+            route = [str(ipaddr.IPAddress(routeAddr)), str(ipaddr.IPAddress(routeVia))]
         else:
-            ret = IP(str(addrStr))
+            route = None
+        return [ret, dhcp, route]
 
-        return ret
+    def get_name_domain(self):
+        xml = self.get_xml()
+        name_domain = util.xpath(xml, "/network/domain/@name")
+        return name_domain
+
+    def get_ipv6_route(self):
+        xml = self.get_xml()
+        ipv6_route = util.xpath(xml, "/network/@ipv6")
+        return ipv6_route
 
     def get_ipv4_forward(self):
         xml = self.get_xml()
@@ -125,15 +235,6 @@ class vmmNetwork(vmmLibvirtObject):
         forwardDev = util.xpath(xml, "/network/forward/@dev")
         return [fw, forwardDev]
 
-    def get_ipv4_dhcp_range(self):
-        xml = self.get_xml()
-        dhcpstart = util.xpath(xml, "/network/ip/dhcp/range[1]/@start")
-        dhcpend = util.xpath(xml, "/network/ip/dhcp/range[1]/@end")
-        if not dhcpstart or not dhcpend:
-            return None
-
-        return [IP(dhcpstart), IP(dhcpend)]
-
     def pretty_forward_mode(self):
         forward, forwardDev = self.get_ipv4_forward()
         return vmmNetwork.pretty_desc(forward, forwardDev)
-- 
1.8.1.4

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




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux