From 2feed6a3f3f66f5b2279c893775ef041bce255f1 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Thu, 25 Feb 2010 17:31:27 -0500 Subject: [PATCH] host: Add 'error' page for virtual net and storage Display a proper error if connection doesn't support network or storage management. --- src/virtManager/host.py | 33 +- src/vmm-host.glade | 1058 +++++++++++++++++++++------------------ 2 files changed, 599 insertions(+), 492 deletions(-) diff --git a/src/virtManager/host.py b/src/virtManager/host.py index 62c019dbe..bae5b871c 100644 --- a/src/virtManager/host.py +++ b/src/virtManager/host.py @@ -156,6 +156,8 @@ class vmmHost(gobject.GObject): def init_net_state(self): + self.window.get_widget("network-pages").set_show_tabs(False) + # [ unique, label, icon name, icon size, is_active ] netListModel = gtk.ListStore(str, str, str, int, bool) self.window.get_widget("net-list").set_model(netListModel) @@ -175,7 +177,14 @@ class vmmHost(gobject.GObject): self.populate_networks(netListModel) + if not self.conn.network_capable: + self.set_net_error_page( + _("Libvirt connection does not support virtual network " + "management.")) + def init_storage_state(self): + self.window.get_widget("storage-pages").set_show_tabs(False) + self.volmenu = gtk.Menu() volCopyPath = gtk.ImageMenuItem(_("Copy Volume Path")) volCopyImage = gtk.Image() @@ -216,6 +225,10 @@ class vmmHost(gobject.GObject): populate_storage_pools(self.window.get_widget("pool-list"), self.conn) + if not self.conn.storage_capable: + self.set_storage_error_page( + _("Libvirt connection does not support storage management.")) + def init_interface_state(self): self.window.get_widget("interface-pages").set_show_tabs(False) @@ -264,7 +277,7 @@ class vmmHost(gobject.GObject): if not self.conn.interface_capable: self.set_interface_error_page( - _("Libvirt connection does not have interface support.")) + _("Libvirt connection does not support interface management.")) def init_conn_state(self): uri = self.conn.get_uri() @@ -437,13 +450,20 @@ class vmmHost(gobject.GObject): if curruuid == uuid: self.net_selected(sel) + def set_net_error_page(self, msg): + self.reset_net_state() + self.window.get_widget("network-pages").set_current_page(1) + self.window.get_widget("network-error-label").set_text(msg) + def net_selected(self, src): selected = src.get_selected() if selected[1] == None or \ selected[0].get_value(selected[1], 0) == None: - self.reset_net_state() + self.set_net_error_page(_("No virtual network selected.")) return + self.window.get_widget("network-pages").set_current_page(0) + net = self.conn.get_net(selected[0].get_value(selected[1], 0)) active = net.is_active() selected[0].set_value(selected[1], 4, bool(active)) @@ -657,13 +677,20 @@ class vmmHost(gobject.GObject): _("Never")) self.window.get_widget("pool-apply").set_sensitive(True) + def set_storage_error_page(self, msg): + self.reset_pool_state() + self.window.get_widget("storage-pages").set_current_page(1) + self.window.get_widget("storage-error-label").set_text(msg) + def pool_selected(self, src): selected = src.get_selected() if selected[1] is None or \ selected[0].get_value(selected[1], 0) is None: - self.reset_pool_state() + self.set_storage_error_page(_("No storage pool selected.")) return + self.window.get_widget("storage-pages").set_current_page(0) + uuid = selected[0].get_value(selected[1], 0) pool = self.conn.get_pool(uuid) auto = pool.get_autostart() diff --git a/src/vmm-host.glade b/src/vmm-host.glade index 3b7787924..7bda47062 100644 --- a/src/vmm-host.glade +++ b/src/vmm-host.glade @@ -469,337 +469,379 @@ - + True - vertical - 20 + True + False - + True - 0 - none + vertical + 20 - + True - 6 - 4 - 2 - 3 - 3 + 0 + none - + True - 0 - Name: - - - GTK_FILL - - - - - - True - True - False - - - 1 - 2 - - - - - - True - 0 - Device: - - - 1 - 2 - GTK_FILL - - - - - - True - True - False - - - 1 - 2 - 1 - 2 - - - - - - True - 0 - State: - - - 2 - 3 - GTK_FILL - - - - - - True - 3 + 6 + 4 + 2 + 3 + 3 - - True - gtk-missing-image - - - False - 0 - - - - + True 0 - Running + Name: - 1 + GTK_FILL + + + + + + True + True + False + + + + 1 + 2 + + + + + + True + 0 + Device: + + + 1 + 2 + GTK_FILL + + + + + + True + True + False + + + + 1 + 2 + 1 + 2 + + + + + + True + 0 + State: + + + 2 + 3 + GTK_FILL + + + + + + True + 3 + + + True + gtk-missing-image + + + False + 0 + + + + + True + 0 + Running + + + 1 + + + + + 1 + 2 + 2 + 3 + GTK_FILL + GTK_FILL + + + + + True + 0 + A_utostart: + True + net-autostart + + + 3 + 4 + GTK_FILL + + + + + + Some Label + True + True + False + True + True + + + + 1 + 2 + 3 + 4 + GTK_FILL + - - 1 - 2 - 2 - 3 - GTK_FILL - GTK_FILL - - + True 0 - A_utostart: - True - net-autostart + <b>Basic details</b> + True - 3 - 4 - GTK_FILL - + label_item - - - Some Label - True - True - False - True - True - - - - 1 - 2 - 3 - 4 - GTK_FILL - - - - - - - - True - 0 - <b>Basic details</b> - True - label_item + False + 0 + + + + + True + 0 + none + + + True + 6 + 4 + 2 + 3 + 3 + + + True + 0 + Network: + + + GTK_FILL + + + + + + True + 0 + DHCP start: + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + DHCP end: + + + 2 + 3 + GTK_FILL + + + + + + True + True + False + + + + 1 + 2 + + + + + + True + True + False + + + + 1 + 2 + 1 + 2 + + + + + + True + True + False + + + + 1 + 2 + 2 + 3 + + + + + + True + 0 + Forwarding: + + + 3 + 4 + GTK_FILL + + + + + + True + 3 + + + True + gtk-missing-image + + + False + False + 0 + + + + + True + 0 + NAT to any physical device + + + False + False + 1 + + + + + 1 + 2 + 3 + 4 + GTK_FILL + GTK_FILL + + + + + + + True + <b>IPv4 configuration</b> + True + + + label_item + + + + + 1 + + + + + True + + + False + 2 + + + + True + info + - False - 0 + False + tab - + True - 0 - none - - - True - 6 - 4 - 2 - 3 - 3 - - - True - 0 - Network: - - - GTK_FILL - - - - - - True - 0 - DHCP start: - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - DHCP end: - - - 2 - 3 - GTK_FILL - - - - - - True - True - False - - - 1 - 2 - - - - - - True - True - False - - - 1 - 2 - 1 - 2 - - - - - - True - True - False - - - 1 - 2 - 2 - 3 - - - - - - True - 0 - Forwarding: - - - 3 - 4 - GTK_FILL - - - - - - True - 3 - - - True - gtk-missing-image - - - False - False - 0 - - - - - True - 0 - NAT to any physical device - - - False - False - 1 - - - - - 1 - 2 - 3 - 4 - GTK_FILL - GTK_FILL - - - - - - - True - <b>IPv4 configuration</b> - True - - - label_item - - + some error here 1 - + True + error - False - 2 + 1 + False + tab @@ -989,223 +1031,234 @@ - + True - 6 + True + False - + True - vertical - 6 + 6 - - True - 5 - 2 - 8 - 3 - - - True - 0 - Pool Type: - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - Pool Type - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - - True - 0 - <b>Poolname:</b> - True - - - GTK_FILL - - - - - - True - 0 - <span size="large">1234 GB Free</span> / <i>6000 GB In Use</i> - True - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - Location: - - - 2 - 3 - GTK_FILL - - - - - - True - True - False - - - 1 - 2 - 2 - 3 - - - - - - True - 0 - State: - - - 3 - 4 - GTK_FILL - - - - - - True - 3 - - - True - 0 - gtk-missing-image - - - False - 0 - - - - - True - Active - - - False - False - 1 - - - - - 1 - 2 - 3 - 4 - GTK_FILL - GTK_FILL - - - - - True - 0 - A_utostart: - True - pool-autostart - - - 4 - 5 - GTK_FILL - - - - - - Some label - True - True - False - True - True - - - - 1 - 2 - 4 - 5 - GTK_FILL - - - - - - False - 0 - - - - + True vertical - 3 + 6 - + True - 0 - <b>Volumes</b> - True + 5 + 2 + 8 + 3 + + + True + 0 + Pool Type: + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + Pool Type + True + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + + True + 0 + <b>Poolname:</b> + True + + + GTK_FILL + + + + + + True + 0 + <span size="large">1234 GB Free</span> / <i>6000 GB In Use</i> + True + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + Location: + + + 2 + 3 + GTK_FILL + + + + + + True + True + False + + + + 1 + 2 + 2 + 3 + + + + + + True + 0 + State: + + + 3 + 4 + GTK_FILL + + + + + + True + 3 + + + True + 0 + gtk-missing-image + + + False + 0 + + + + + True + Active + + + False + False + 1 + + + + + 1 + 2 + 3 + 4 + GTK_FILL + GTK_FILL + + + + + True + 0 + A_utostart: + True + pool-autostart + + + 4 + 5 + GTK_FILL + + + + + + Some label + True + True + False + True + True + + + + 1 + 2 + 4 + 5 + GTK_FILL + + + False - False 0 - + True - True - automatic - automatic - in + vertical + 3 - + + True + 0 + <b>Volumes</b> + True + + + False + False + 0 + + + + True True - + automatic + automatic + in + + + True + True + + + + + 1 + @@ -1213,12 +1266,39 @@ - - 1 - + + + True + info + + + False + tab + + + + + True + some error here + + + 1 + + + + + True + error + + + 1 + False + tab + + True