[PATCH 1/5]: virt-manager: block device and network statistics

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

 



Hi,
this patch calculates block and net stats. Only change is a more
condensed calculation of the limits by introducing _set_max_rate().
 -- Guido
# HG changeset patch
# User "Guido Günther <agx@xxxxxxxxxxx>"
# Date 1224357693 -7200
# Node ID 359355108e78b7e440bf31d7bebe398c959ccbe5
# Parent  b5d4d81dfa571954275d009a47cff9d96e76f748
Calculate block and net device statistics

display them in the overview as well as in the vm details

diff -r b5d4d81dfa57 -r 359355108e78 src/virt-manager.schemas.in
--- a/src/virt-manager.schemas.in	Tue Oct 14 15:39:04 2008 -0400
+++ b/src/virt-manager.schemas.in	Sat Oct 18 21:21:33 2008 +0200
@@ -73,8 +73,8 @@
       <default>0</default>
 
       <locale name="C">
-        <short>Show disk usage in summary</short>
-        <long>Show the disk usage field in the domain list summary view</long>
+        <short>Show disk I/O in summary</short>
+        <long>Show the disk I/O field in the domain list summary view</long>
       </locale>
     </schema>
 
@@ -86,8 +86,8 @@
       <default>0</default>
 
       <locale name="C">
-        <short>Show network traffic in summary</short>
-        <long>Show the network traffic field in the domain list summary view</long>
+        <short>Show network I/O in summary</short>
+        <long>Show the network I/O field in the domain list summary view</long>
       </locale>
     </schema>
 
diff -r b5d4d81dfa57 -r 359355108e78 src/virtManager/config.py
--- a/src/virtManager/config.py	Tue Oct 14 15:39:04 2008 -0400
+++ b/src/virtManager/config.py	Sat Oct 18 21:21:33 2008 +0200
@@ -109,7 +109,7 @@
     def is_vmlist_memory_usage_visible(self):
         return self.conf.get_bool(self.conf_dir + "/vmlist-fields/memory_usage")
 
-    def is_vmlist_disk_usage_visible(self):
+    def is_vmlist_disk_io_visible(self):
         return self.conf.get_bool(self.conf_dir + "/vmlist-fields/disk_usage")
 
     def is_vmlist_network_traffic_visible(self):
@@ -132,7 +132,7 @@
     def set_vmlist_memory_usage_visible(self, state):
         self.conf.set_bool(self.conf_dir + "/vmlist-fields/memory_usage", state)
 
-    def set_vmlist_disk_usage_visible(self, state):
+    def set_vmlist_disk_io_visible(self, state):
         self.conf.set_bool(self.conf_dir + "/vmlist-fields/disk_usage", state)
 
     def set_vmlist_network_traffic_visible(self, state):
@@ -155,7 +155,7 @@
     def on_vmlist_memory_usage_visible_changed(self, callback):
         self.conf.notify_add(self.conf_dir + "/vmlist-fields/memory_usage", callback)
 
-    def on_vmlist_disk_usage_visible_changed(self, callback):
+    def on_vmlist_disk_io_visible_changed(self, callback):
         self.conf.notify_add(self.conf_dir + "/vmlist-fields/disk_usage", callback)
 
     def on_vmlist_network_traffic_visible_changed(self, callback):
diff -r b5d4d81dfa57 -r 359355108e78 src/virtManager/connection.py
--- a/src/virtManager/connection.py	Tue Oct 14 15:39:04 2008 -0400
+++ b/src/virtManager/connection.py	Sat Oct 18 21:21:33 2008 +0200
@@ -934,13 +934,20 @@
 
         mem = 0
         cpuTime = 0
+        rdRate = 0
+        wrRate = 0
+        rxRate = 0
+        txRate = 0
 
         for uuid in self.vms:
             vm = self.vms[uuid]
             if vm.get_id() != -1:
                 cpuTime = cpuTime + vm.get_cputime()
                 mem = mem + vm.get_memory()
-
+                rdRate += vm.disk_read_rate()
+                wrRate += vm.disk_write_rate()
+                rxRate += vm.network_rx_rate()
+                txRate += vm.network_tx_rate()
 
         pcentCpuTime = 0
         if len(self.record) > 0:
@@ -964,7 +971,11 @@
             "memory": mem,
             "memoryPercent": pcentMem,
             "cpuTime": cpuTime,
-            "cpuTimePercent": pcentCpuTime
+            "cpuTimePercent": pcentCpuTime,
+            "diskRdRate" : rdRate,
+            "diskWrRate" : wrRate,
+            "netRxRate" : rxRate,
+            "netTxRate" : txRate,
         }
 
         self.record.insert(0, newStats)
@@ -1017,6 +1028,32 @@
             else:
                 vector.append(0)
         return vector
+
+    def network_rx_rate(self):
+        if len(self.record) == 0:
+            return 0
+        return self.record[0]["netRxRate"]
+
+    def network_tx_rate(self):
+        if len(self.record) == 0:
+            return 0
+        return self.record[0]["netTxRate"]
+
+    def network_traffic_rate(self):
+        return self.network_tx_rate() + self.network_rx_rate()
+
+    def disk_read_rate(self):
+        if len(self.record) == 0:
+            return 0
+        return self.record[0]["diskRdRate"]
+
+    def disk_write_rate(self):
+        if len(self.record) == 0:
+            return 0
+        return self.record[0]["diskWrRate"]
+
+    def disk_io_rate(self):
+        return self.disk_read_rate() + self.disk_write_rate()
 
     def uuidstr(self, rawuuid):
         hex = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f']
diff -r b5d4d81dfa57 -r 359355108e78 src/virtManager/details.py
--- a/src/virtManager/details.py	Tue Oct 14 15:39:04 2008 -0400
+++ b/src/virtManager/details.py	Sat Oct 18 21:21:33 2008 +0200
@@ -189,10 +189,13 @@
         self.memory_usage_graph.set_property("reversed", True)
         self.window.get_widget("graph-table").attach(self.memory_usage_graph, 1, 2, 1, 2)
 
+        self.disk_io_graph = sparkline.Sparkline()
+        self.disk_io_graph.set_property("reversed", True)
+        self.window.get_widget("graph-table").attach(self.disk_io_graph, 1, 2, 2, 3)
+ 
         self.network_traffic_graph = sparkline.Sparkline()
         self.network_traffic_graph.set_property("reversed", True)
         self.window.get_widget("graph-table").attach(self.network_traffic_graph, 1, 2, 3, 4)
-
 
         self.accel_groups = gtk.accel_groups_from_object(topwin)
         self.gtk_settings_accel = None
@@ -499,12 +502,6 @@
             dialog.present()
             return
         dialog.show_all()
-        self.window.get_widget("overview-network-traffic-text").hide()
-        self.window.get_widget("overview-network-traffic-label").hide()
-        self.window.get_widget("overview-disk-usage-bar").hide()
-        self.window.get_widget("overview-disk-usage-text").hide()
-        self.window.get_widget("overview-disk-usage-label").hide()
-        self.network_traffic_graph.hide()
         dialog.present()
         self.engine.increment_window_counter()
         self.update_widget_states(self.vm, self.vm.status())
@@ -806,16 +803,16 @@
         self.window.get_widget("overview-memory-usage-text").set_text("%d MB of %d MB" % \
                                                                       (int(round(vm_memory/1024.0)), \
                                                                        int(round(host_memory/1024.0))))
+        self.window.get_widget("overview-network-traffic-text").set_text("%d KBytes/s in\n%d KBytes/s out" %
+                                                                   (self.vm.network_rx_rate(), self.vm.network_tx_rate()))
+        self.window.get_widget("overview-disk-usage-text").set_text("%d KBytes/s in\n%d KBytes/s out" %
+                                                                   (self.vm.disk_read_rate(), self.vm.disk_write_rate()))
 
         history_len = self.config.get_stats_history_length()
-        cpu_vector = self.vm.cpu_time_vector()
-        self.cpu_usage_graph.set_property("data_array", cpu_vector)
-
-        memory_vector = self.vm.current_memory_vector()
-        self.memory_usage_graph.set_property("data_array", memory_vector)
-
-        network_vector = self.vm.network_traffic_vector()
-        self.network_traffic_graph.set_property("data_array", network_vector)
+        self.cpu_usage_graph.set_property("data_array", self.vm.cpu_time_vector())
+        self.memory_usage_graph.set_property("data_array", self.vm.current_memory_vector())
+        self.network_traffic_graph.set_property("data_array", self.vm.network_traffic_vector())
+        self.disk_io_graph.set_property("data_array", self.vm.disk_io_vector())
 
     def refresh_config_cpu(self):
         self.window.get_widget("state-host-cpus").set_text("%d" % self.vm.get_connection().host_active_processor_count())
diff -r b5d4d81dfa57 -r 359355108e78 src/virtManager/domain.py
--- a/src/virtManager/domain.py	Tue Oct 14 15:39:04 2008 -0400
+++ b/src/virtManager/domain.py	Sat Oct 18 21:21:33 2008 +0200
@@ -45,6 +45,12 @@
         self.uuid = uuid
         self.lastStatus = None
         self.record = []
+        self.maxRecord = { "diskRdRate" : 10.0,
+                           "diskWrRate" : 10.0,
+                           "netTxRate"  : 10.0,
+                           "netRxRate"  : 10.0,
+                         }
+
         self._update_status()
         self.xml = None
 
@@ -149,6 +155,44 @@
             self.lastStatus = status
             self.emit("status-changed", status)
 
+    def _network_traffic(self):
+        rx = 0
+        tx = 0
+        for netdev in self.get_network_devices():
+            try:
+                io = self.vm.interfaceStats(netdev[2])
+                if io:
+                    rx += io[0]
+                    tx += io[4]
+            except libvirt.libvirtError, err:
+                    logging.error("Error reading interface stats %s" % err)
+        return rx, tx
+
+    def _disk_io(self):
+        rd = 0
+        wr = 0
+        for disk in self.get_disk_devices():
+            try:
+                io = self.vm.blockStats(disk[3])
+                if io:
+                    rd += io[1]
+                    wr += io[3]
+            except libvirt.libvirtError, err:
+                    logging.error("Error reading block stats %s" % err)
+        return rd, wr
+
+    def _get_cur_rate(self, what):
+        if len(self.record) > 1:
+            ret = float(self.record[0][what] - self.record[1][what]) / \
+                      float(self.record[0]["timestamp"] - self.record[1]["timestamp"])
+        else:
+            ret = 0.0
+        return max(ret, 0,0) # avoid negative values at poweroff
+
+    def _set_max_rate(self, what):
+        if self.record[0][what] > self.maxRecord[what]:
+            self.maxRecord[what] = self.record[0][what]
+
     def tick(self, now):
         if self.connection.get_state() != self.connection.STATE_ACTIVE:
             return
@@ -196,6 +240,9 @@
         pcentCurrMem = info[2] * 100.0 / self.connection.host_memory_size()
         pcentMaxMem = info[1] * 100.0 / self.connection.host_memory_size()
 
+        rdBytes, wrBytes = self._disk_io()
+        rxBytes, txBytes = self._network_traffic()
+
         newStats = { "timestamp": now,
                      "cpuTime": cpuTime,
                      "cpuTimeAbs": cpuTimeAbs,
@@ -205,6 +252,10 @@
                      "vcpuCount": info[3],
                      "maxMem": info[1],
                      "maxMemPercent": pcentMaxMem,
+                     "diskRdKB": rdBytes / 1024,
+                     "diskWrKB": wrBytes / 1024,
+                     "netRxKB": rxBytes / 1024,
+                     "netTxKB": txBytes / 1024,
                      }
 
         self.record.insert(0, newStats)
@@ -222,6 +273,10 @@
         else:
             self.record[0]["cpuTimeMovingAvg"] = (self.record[0]["cpuTimeAbs"]-startCpuTime) / nSamples
             self.record[0]["cpuTimeMovingAvgPercent"] = (self.record[0]["cpuTimeAbs"]-startCpuTime) * 100.0 / ((now-startTimestamp)*1000.0*1000.0*1000.0 * self.connection.host_active_processor_count())
+
+        for r in [ "diskRd", "diskWr", "netRx", "netTx" ]:
+            self.record[0][r + "Rate"] = self._get_cur_rate(r + "KB")
+            self._set_max_rate(r + "Rate")
 
         self._update_status(info[0])
         self.emit("resources-sampled")
@@ -297,17 +352,31 @@
     def cpu_time_pretty(self):
         return "%2.2f %%" % self.cpu_time_percentage()
 
-    def network_traffic(self):
-        return 1
+    def network_rx_rate(self):
+        if len(self.record) == 0:
+            return 0
+        return self.record[0]["netRxRate"]
 
-    def network_traffic_percentage(self):
-        return 1
+    def network_tx_rate(self):
+        if len(self.record) == 0:
+            return 0
+        return self.record[0]["netTxRate"]
 
-    def disk_usage(self):
-        return 1
+    def network_traffic_rate(self):
+        return self.network_tx_rate() + self.network_rx_rate()
 
-    def disk_usage_percentage(self):
-        return 1
+    def disk_read_rate(self):
+        if len(self.record) == 0:
+            return 0
+        return self.record[0]["diskRdRate"]
+
+    def disk_write_rate(self):
+        if len(self.record) == 0:
+            return 0
+        return self.record[0]["diskWrRate"]
+
+    def disk_io_rate(self):
+        return self.disk_read_rate() + self.disk_write_rate()
 
     def vcpu_count(self):
         if len(self.record) == 0:
@@ -358,14 +427,22 @@
         vector = []
         stats = self.record
         for i in range(self.config.get_stats_history_length()+1):
-            vector.append(0)
+            if i < len(stats):
+                vector.append(float(stats[i]["netRxRate"])/
+                              float(self.maxRecord["netRxRate"]))
+            else:
+                vector.append(0.0)
         return vector
 
-    def disk_usage_vector(self):
+    def disk_io_vector(self):
         vector = []
         stats = self.record
         for i in range(self.config.get_stats_history_length()+1):
-            vector.append(0)
+            if i < len(stats):
+                vector.append(float(stats[i]["diskRdRate"])/
+                              float(self.maxRecord["diskRdRate"]))
+            else:
+                vector.append(0.0)
         return vector
 
     def shutdown(self):
diff -r b5d4d81dfa57 -r 359355108e78 src/virtManager/manager.py
--- a/src/virtManager/manager.py	Tue Oct 14 15:39:04 2008 -0400
+++ b/src/virtManager/manager.py	Sat Oct 18 21:21:33 2008 +0200
@@ -37,7 +37,7 @@
 VMLIST_SORT_NAME = 2
 VMLIST_SORT_CPU_USAGE = 3
 VMLIST_SORT_MEMORY_USAGE = 4
-VMLIST_SORT_DISK_USAGE = 5
+VMLIST_SORT_DISK_IO = 5
 VMLIST_SORT_NETWORK_USAGE = 6
 
 # fields in the tree model data set
@@ -52,6 +52,10 @@
 ROW_MEM_USAGE = 8
 ROW_KEY = 9
 ROW_HINT = 10
+ROW_DISK_RD = 11
+ROW_DISK_WR = 12
+ROW_NET_RX = 13
+ROW_NET_TX = 14
 
 # Columns in the tree view
 COL_NAME = 0
@@ -121,7 +125,7 @@
         self.config.on_vmlist_cpu_usage_visible_changed(self.toggle_cpu_usage_visible_widget)
         self.config.on_vmlist_virtual_cpus_visible_changed(self.toggle_virtual_cpus_visible_widget)
         self.config.on_vmlist_memory_usage_visible_changed(self.toggle_memory_usage_visible_widget)
-        self.config.on_vmlist_disk_usage_visible_changed(self.toggle_disk_usage_visible_widget)
+        self.config.on_vmlist_disk_io_visible_changed(self.toggle_disk_io_visible_widget)
         self.config.on_vmlist_network_traffic_visible_changed(self.toggle_network_traffic_visible_widget)
 
         self.window.get_widget("menu_view_domain_id").set_active(self.config.is_vmlist_domain_id_visible())
@@ -129,10 +133,8 @@
         self.window.get_widget("menu_view_cpu_usage").set_active(self.config.is_vmlist_cpu_usage_visible())
         self.window.get_widget("menu_view_virtual_cpus").set_active(self.config.is_vmlist_virtual_cpus_visible())
         self.window.get_widget("menu_view_memory_usage").set_active(self.config.is_vmlist_memory_usage_visible())
-        self.window.get_widget("menu_view_disk_usage").set_active(self.config.is_vmlist_disk_usage_visible())
+        self.window.get_widget("menu_view_disk_io").set_active(self.config.is_vmlist_disk_io_visible())
         self.window.get_widget("menu_view_network_traffic").set_active(self.config.is_vmlist_network_traffic_visible())
-        self.window.get_widget("menu_view_disk_usage").set_sensitive(False)
-        self.window.get_widget("menu_view_network_traffic").set_sensitive(False)
 
         self.window.get_widget("vm-view").set_active(0)
 
@@ -248,7 +250,7 @@
             "on_menu_view_cpu_usage_activate" : self.toggle_cpu_usage_visible_conf,
             "on_menu_view_virtual_cpus_activate" : self.toggle_virtual_cpus_visible_conf,
             "on_menu_view_memory_usage_activate" : self.toggle_memory_usage_visible_conf,
-            "on_menu_view_disk_usage_activate" : self.toggle_disk_usage_visible_conf,
+            "on_menu_view_disk_io_activate" : self.toggle_disk_io_visible_conf,
             "on_menu_view_network_traffic_activate" : self.toggle_network_traffic_visible_conf,
 
             "on_vm_manager_delete_event": self.close,
@@ -449,6 +451,10 @@
         row.insert(ROW_MEM, vm.get_memory_pretty())
         row.insert(ROW_MEM_USAGE, vm.current_memory_percentage())
         row.insert(ROW_KEY, vm.get_uuid())
+        row.insert(ROW_DISK_RD, vm.disk_read_rate())
+        row.insert(ROW_DISK_WR, vm.disk_write_rate())
+        row.insert(ROW_NET_RX, vm.network_rx_rate())
+        row.insert(ROW_NET_TX, vm.network_tx_rate())
         row.insert(ROW_HINT, None)
 
         iter = model.append(parent, row)
@@ -470,6 +476,10 @@
         row.insert(ROW_MEM_USAGE, conn.current_memory_percentage())
         row.insert(ROW_KEY, conn.get_uri())
         row.insert(ROW_HINT, conn.get_uri())
+        row.insert(ROW_DISK_RD, conn.disk_read_rate())
+        row.insert(ROW_DISK_WR, conn.disk_write_rate())
+        row.insert(ROW_NET_RX, conn.network_rx_rate())
+        row.insert(ROW_NET_TX, conn.network_tx_rate())
 
         iter = model.append(None, row)
         path = model.get_path(iter)
@@ -523,7 +533,7 @@
             return
 
         row = self.rows[vm.get_uuid()]
-        # Handle, name, ID, status, status icon, cpu, cpu graph, vcpus, mem, mem bar
+        # Handle, name, ID, status, status icon, cpu, cpu graph, vcpus, mem, mem bar, diskRead, diskWrite, netRx, netTx
         if vm.get_id() == -1:
             row[ROW_ID] = "-"
         else:
@@ -534,6 +544,10 @@
         row[ROW_VCPUS] = vm.vcpu_count()
         row[ROW_MEM] = vm.get_memory_pretty()
         row[ROW_MEM_USAGE] = vm.current_memory_percentage()
+        row[ROW_DISK_RD] = vm.disk_read_rate()
+        row[ROW_DISK_WR] = vm.disk_write_rate()
+        row[ROW_NET_RX] = vm.network_rx_rate()
+        row[ROW_NET_TX] = vm.network_tx_rate()
         model.row_changed(row.path, row.iter)
 
         if vm == self.current_vm():
@@ -558,6 +572,10 @@
         row[ROW_VCPUS] = conn.host_active_processor_count()
         row[ROW_MEM] = conn.pretty_current_memory()
         row[ROW_MEM_USAGE] = conn.current_memory_percentage()
+        row[ROW_DISK_RD] = conn.disk_read_rate()
+        row[ROW_DISK_WR] = conn.disk_write_rate()
+        row[ROW_NET_RX] = conn.network_rx_rate()
+        row[ROW_NET_TX] = conn.network_tx_rate()
         if conn.get_state() in [vmmConnection.STATE_DISCONNECTED, vmmConnection.STATE_CONNECTING]:
             # Connection went inactive, delete any VM child nodes
             parent = self.rows[conn.get_uri()].iter
@@ -786,8 +804,8 @@
     def prepare_vmlist(self):
         vmlist = self.window.get_widget("vm-list")
 
-        # Handle, name, ID, status, status icon, cpu, [cpu graph], vcpus, mem, mem bar, uuid
-        model = gtk.TreeStore(object, str, str, str, gtk.gdk.Pixbuf, str, int, str, int, str, str)
+        # Handle, name, ID, status, status icon, cpu, [cpu graph], vcpus, mem, mem bar, uuid, diskRead, diskWrite, netRx, netTx
+        model = gtk.TreeStore(object, str, str, str, gtk.gdk.Pixbuf, str, int, str, int, str, str, int, int, int, int)
         vmlist.set_model(model)
         try:
             vmlist.set_tooltip_column(ROW_HINT)
@@ -802,8 +820,9 @@
         cpuUsageCol = gtk.TreeViewColumn(_("CPU usage"))
         virtualCPUsCol = gtk.TreeViewColumn(_("VCPUs"))
         memoryUsageCol = gtk.TreeViewColumn(_("Memory usage"))
-        diskUsageCol = gtk.TreeViewColumn(_("Disk usage"))
-        networkTrafficCol = gtk.TreeViewColumn(_("Network traffic"))
+        # FIXME: add KBytes/s tooltip
+        diskIOCol = gtk.TreeViewColumn(_("Disk I/O"))
+        networkTrafficCol = gtk.TreeViewColumn(_("Network I/O"))
 
         vmlist.append_column(nameCol)
         vmlist.append_column(idCol)
@@ -811,7 +830,7 @@
         vmlist.append_column(cpuUsageCol)
         vmlist.append_column(virtualCPUsCol)
         vmlist.append_column(memoryUsageCol)
-        vmlist.append_column(diskUsageCol)
+        vmlist.append_column(diskIOCol)
         vmlist.append_column(networkTrafficCol)
 
         # For the columns which follow, we deliberately bind columns
@@ -825,12 +844,12 @@
 
         name_txt = gtk.CellRendererText()
         nameCol.pack_start(name_txt, True)
-        nameCol.add_attribute(name_txt, 'text', 1)
+        nameCol.add_attribute(name_txt, 'text', ROW_NAME)
         nameCol.set_sort_column_id(VMLIST_SORT_NAME)
 
         id_txt = gtk.CellRendererText()
         idCol.pack_start(id_txt, True)
-        idCol.add_attribute(id_txt, 'text', 2)
+        idCol.add_attribute(id_txt, 'text', ROW_ID)
         idCol.set_visible(self.config.is_vmlist_domain_id_visible())
         idCol.set_sort_column_id(VMLIST_SORT_ID)
 
@@ -838,44 +857,48 @@
         status_icon = gtk.CellRendererPixbuf()
         statusCol.pack_start(status_icon, False)
         statusCol.pack_start(status_txt, False)
-        statusCol.add_attribute(status_txt, 'text', 3)
-        statusCol.add_attribute(status_icon, 'pixbuf', 4)
+        statusCol.add_attribute(status_txt, 'text', ROW_STATUS)
+        statusCol.add_attribute(status_icon, 'pixbuf', ROW_STATUS_ICON)
         statusCol.set_visible(self.config.is_vmlist_status_visible())
 
         cpuUsage_txt = gtk.CellRendererText()
         cpuUsage_img = sparkline.CellRendererSparkline()
         cpuUsageCol.pack_start(cpuUsage_txt, False)
         cpuUsageCol.pack_start(cpuUsage_img, False)
-        cpuUsageCol.add_attribute(cpuUsage_txt, 'text', 5)
+        cpuUsageCol.add_attribute(cpuUsage_txt, 'text', ROW_CPU)
         cpuUsageCol.set_cell_data_func(cpuUsage_img, self.cpu_usage_img, None)
         cpuUsageCol.set_visible(self.config.is_vmlist_cpu_usage_visible())
         cpuUsageCol.set_sort_column_id(VMLIST_SORT_CPU_USAGE)
 
         virtualCPUs_txt = gtk.CellRendererText()
         virtualCPUsCol.pack_start(virtualCPUs_txt, False)
-        virtualCPUsCol.add_attribute(virtualCPUs_txt, 'text', 6)
+        virtualCPUsCol.add_attribute(virtualCPUs_txt, 'text', ROW_VCPUS)
         virtualCPUsCol.set_visible(self.config.is_vmlist_virtual_cpus_visible())
 
         memoryUsage_txt = gtk.CellRendererText()
         memoryUsage_img = gtk.CellRendererProgress()
         memoryUsageCol.pack_start(memoryUsage_txt, False)
         memoryUsageCol.pack_start(memoryUsage_img, False)
-        memoryUsageCol.add_attribute(memoryUsage_txt, 'text', 7)
-        memoryUsageCol.add_attribute(memoryUsage_img, 'value', 8)
+        memoryUsageCol.add_attribute(memoryUsage_txt, 'text', ROW_MEM)
+        memoryUsageCol.add_attribute(memoryUsage_img, 'value', ROW_MEM_USAGE)
         memoryUsageCol.set_visible(self.config.is_vmlist_memory_usage_visible())
         memoryUsageCol.set_sort_column_id(VMLIST_SORT_MEMORY_USAGE)
 
-        diskUsage_txt = gtk.CellRendererText()
-        diskUsage_img = gtk.CellRendererProgress()
-        diskUsageCol.pack_start(diskUsage_txt, False)
-        diskUsageCol.pack_start(diskUsage_img, False)
-        diskUsageCol.set_visible(self.config.is_vmlist_disk_usage_visible())
-        diskUsageCol.set_sort_column_id(VMLIST_SORT_DISK_USAGE)
+        diskIOIn_txt = gtk.CellRendererText()
+        diskIOOut_txt = gtk.CellRendererText()
+        diskIOCol.pack_start(diskIOIn_txt, False)
+        diskIOCol.pack_start(diskIOOut_txt, False)
+        diskIOCol.add_attribute(diskIOIn_txt, 'text', ROW_DISK_RD)
+        diskIOCol.add_attribute(diskIOOut_txt, 'text', ROW_DISK_WR)
+        diskIOCol.set_visible(self.config.is_vmlist_disk_io_visible())
+        diskIOCol.set_sort_column_id(VMLIST_SORT_DISK_IO)
 
-        networkTraffic_txt = gtk.CellRendererText()
-        networkTraffic_img = gtk.CellRendererProgress()
-        networkTrafficCol.pack_start(networkTraffic_txt, False)
-        networkTrafficCol.pack_start(networkTraffic_img, False)
+        networkTrafficIn_txt = gtk.CellRendererText()
+        networkTrafficOut_txt = gtk.CellRendererText()
+        networkTrafficCol.pack_start(networkTrafficIn_txt, False)
+        networkTrafficCol.pack_start(networkTrafficOut_txt, False)
+        networkTrafficCol.add_attribute(networkTrafficIn_txt, 'text', ROW_NET_RX)
+        networkTrafficCol.add_attribute(networkTrafficOut_txt, 'text', ROW_NET_TX)
         networkTrafficCol.set_visible(self.config.is_vmlist_network_traffic_visible())
         networkTrafficCol.set_sort_column_id(VMLIST_SORT_NETWORK_USAGE)
 
@@ -883,7 +906,7 @@
         model.set_sort_func(VMLIST_SORT_NAME, self.vmlist_name_sorter)
         model.set_sort_func(VMLIST_SORT_CPU_USAGE, self.vmlist_cpu_usage_sorter)
         model.set_sort_func(VMLIST_SORT_MEMORY_USAGE, self.vmlist_memory_usage_sorter)
-        model.set_sort_func(VMLIST_SORT_DISK_USAGE, self.vmlist_disk_usage_sorter)
+        model.set_sort_func(VMLIST_SORT_DISK_IO, self.vmlist_disk_io_sorter)
         model.set_sort_func(VMLIST_SORT_NETWORK_USAGE, self.vmlist_network_usage_sorter)
 
         model.set_sort_column_id(VMLIST_SORT_NAME, gtk.SORT_ASCENDING)
@@ -901,11 +924,11 @@
     def vmlist_memory_usage_sorter(self, model, iter1, iter2):
         return cmp(model.get_value(iter1, ROW_HANDLE).current_memory_percentage(), model.get_value(iter2, ROW_HANDLE).current_memory_percentage())
 
-    def vmlist_disk_usage_sorter(self, model, iter1, iter2):
-        return cmp(model.get_value(iter1, ROW_HANDLE).disk_usage(), model.get_value(iter2, ROW_HANDLE).disk_usage())
+    def vmlist_disk_io_sorter(self, model, iter1, iter2):
+        return cmp(model.get_value(iter1, ROW_HANDLE).disk_io_rate(), model.get_value(iter2, ROW_HANDLE).disk_io_rate())
 
     def vmlist_network_usage_sorter(self, model, iter1, iter2):
-        return cmp(model.get_value(iter1, ROW_HANDLE).network_traffic(), model.get_value(iter2, ROW_HANDLE).network_traffic())
+        return cmp(model.get_value(iter1, ROW_HANDLE).network_traffic_rate(), model.get_value(iter2, ROW_HANDLE).network_traffic_rate())
 
     def toggle_domain_id_visible_conf(self, menu):
         self.config.set_vmlist_domain_id_visible(menu.get_active())
@@ -952,14 +975,14 @@
         col = vmlist.get_column(COL_MEM)
         col.set_visible(self.config.is_vmlist_memory_usage_visible())
 
-    def toggle_disk_usage_visible_conf(self, menu):
-        self.config.set_vmlist_disk_usage_visible(menu.get_active())
+    def toggle_disk_io_visible_conf(self, menu):
+        self.config.set_vmlist_disk_io_visible(menu.get_active())
 
-    def toggle_disk_usage_visible_widget(self, ignore1, ignore2, ignore3, ignore4):
-        menu = self.window.get_widget("menu_view_disk_usage")
+    def toggle_disk_io_visible_widget(self, ignore1, ignore2, ignore3, ignore4):
+        menu = self.window.get_widget("menu_view_disk_io")
         vmlist = self.window.get_widget("vm-list")
         col = vmlist.get_column(COL_DISK)
-        col.set_visible(self.config.is_vmlist_disk_usage_visible())
+        col.set_visible(self.config.is_vmlist_disk_io_visible())
 
     def toggle_network_traffic_visible_conf(self, menu):
         self.config.set_vmlist_network_traffic_visible(menu.get_active())
diff -r b5d4d81dfa57 -r 359355108e78 src/vmm-details.glade
--- a/src/vmm-details.glade	Tue Oct 14 15:39:04 2008 -0400
+++ b/src/vmm-details.glade	Sat Oct 18 21:21:33 2008 +0200
@@ -1248,23 +1248,6 @@
 				  <property name="column_spacing">3</property>
 
 				  <child>
-				    <widget class="GtkProgressBar" id="overview-disk-usage-bar">
-				      <property name="visible">True</property>
-				      <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property>
-				      <property name="fraction">0.119999997318</property>
-				      <property name="pulse_step">0.10000000149</property>
-				      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-				    </widget>
-				    <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"></property>
-				    </packing>
-				  </child>
-
-				  <child>
 				    <widget class="GtkLabel" id="label45">
 				      <property name="visible">True</property>
 				      <property name="label" translatable="yes">CPU usage:</property>
@@ -1323,7 +1306,7 @@
 				  <child>
 				    <widget class="GtkLabel" id="overview-disk-usage-label">
 				      <property name="visible">True</property>
-				      <property name="label" translatable="yes">Disk usage:</property>
+				      <property name="label" translatable="yes">Disk I/O:</property>
 				      <property name="use_underline">False</property>
 				      <property name="use_markup">False</property>
 				      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -1351,7 +1334,7 @@
 				  <child>
 				    <widget class="GtkLabel" id="overview-network-traffic-label">
 				      <property name="visible">True</property>
-				      <property name="label" translatable="yes">Network usage:</property>
+				      <property name="label" translatable="yes">Network I/O:</property>
 				      <property name="use_underline">False</property>
 				      <property name="use_markup">False</property>
 				      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -1435,7 +1418,7 @@
 				  <child>
 				    <widget class="GtkLabel" id="overview-disk-usage-text">
 				      <property name="visible">True</property>
-				      <property name="label" translatable="yes">20 bits/sec</property>
+				      <property name="label" translatable="yes">20 KBytes/s</property>
 				      <property name="use_underline">False</property>
 				      <property name="use_markup">False</property>
 				      <property name="justify">GTK_JUSTIFY_LEFT</property>
diff -r b5d4d81dfa57 -r 359355108e78 src/vmm-manager.glade
--- a/src/vmm-manager.glade	Tue Oct 14 15:39:04 2008 -0400
+++ b/src/vmm-manager.glade	Sat Oct 18 21:21:33 2008 +0200
@@ -260,19 +260,19 @@
 		  </child>
 
 		  <child>
-		    <widget class="GtkCheckMenuItem" id="menu_view_disk_usage">
+		    <widget class="GtkCheckMenuItem" id="menu_view_disk_io">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">Disk usage</property>
+		      <property name="label" translatable="yes">Disk I/O</property>
 		      <property name="use_underline">True</property>
 		      <property name="active">True</property>
-		      <signal name="activate" handler="on_menu_view_disk_usage_activate" last_modification_time="Tue, 28 Mar 2006 16:35:00 GMT"/>
+		      <signal name="activate" handler="on_menu_view_disk_io_activate" last_modification_time="Tue, 28 Mar 2006 16:35:00 GMT"/>
 		    </widget>
 		  </child>
 
 		  <child>
 		    <widget class="GtkCheckMenuItem" id="menu_view_network_traffic">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">Network traffic</property>
+		      <property name="label" translatable="yes">Network I/O</property>
 		      <property name="use_underline">True</property>
 		      <property name="active">True</property>
 		      <signal name="activate" handler="on_menu_view_network_traffic_activate" last_modification_time="Tue, 28 Mar 2006 16:35:00 GMT"/>
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

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

  Powered by Linux