OBS User unknown 2008-02-25 16:47:18 +00:00 committed by Git OBS Bridge
parent d91ac00663
commit ddd44b391b
4 changed files with 252 additions and 13 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Feb 20 13:59:20 MST 2008 - dpmerrill@novell.com
- Added virtman-timewatch to minimize window after
- inactivity to work around memory leaks in GTK and DBus
- bnc#287366 (L3)
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Feb 14 16:38:43 MST 2008 - dpmerrill@novell.com Thu Feb 14 16:38:43 MST 2008 - dpmerrill@novell.com

View File

@ -19,7 +19,7 @@ Name: virt-manager
%define virtinst_rel 2 %define virtinst_rel 2
%define virtinst_name virtinst-%{virtinst_maj}.%{virtinst_min}.%{virtinst_rel} %define virtinst_name virtinst-%{virtinst_maj}.%{virtinst_min}.%{virtinst_rel}
Version: 0.5.3 Version: 0.5.3
Release: 3 Release: 4
Summary: Virtual Machine Manager Summary: Virtual Machine Manager
Group: System/Monitoring Group: System/Monitoring
License: GPL v2 or later License: GPL v2 or later
@ -34,6 +34,7 @@ Patch2: virtman-xen-uri.diff
Patch3: virtman-vminstall.diff Patch3: virtman-vminstall.diff
Patch4: virtman-pointer.diff Patch4: virtman-pointer.diff
Patch5: virtman-detect.diff Patch5: virtman-detect.diff
Patch6: virtman-timewatch.diff
# These two are just the oldest version tested # These two are just the oldest version tested
# Requires: pygtk2 >= 1.99.12-6 # Requires: pygtk2 >= 1.99.12-6
Requires: python-gtk Requires: python-gtk
@ -108,6 +109,7 @@ Authors:
%patch3 -p1 %patch3 -p1
%patch4 -p1 %patch4 -p1
%patch5 -p1 %patch5 -p1
%patch6 -p1
%build %build
# autoreconf -i # autoreconf -i
@ -191,6 +193,10 @@ fi
%dir %{_datadir}/applications/YaST2 %dir %{_datadir}/applications/YaST2
%changelog %changelog
* Wed Feb 20 2008 dpmerrill@novell.com
- Added virtman-timewatch to minimize window after
- inactivity to work around memory leaks in GTK and DBus
- bnc#287366 (L3)
* Thu Feb 14 2008 dpmerrill@novell.com * Thu Feb 14 2008 dpmerrill@novell.com
- Changed virtman-xen-uri to correct the case where no - Changed virtman-xen-uri to correct the case where no
- connection param is passed in and uri is None - connection param is passed in and uri is None

View File

@ -1,8 +1,7 @@
Index: virt-manager-0.5.3/src/virtManager/connection.py diff -Nuar virt-manager-0.5.3.orig/src/virtManager/connection.py virt-manager-0.5.3/src/virtManager/connection.py
=================================================================== --- virt-manager-0.5.3.orig/src/virtManager/connection.py 2008-02-20 14:13:33.000000000 -0700
--- virt-manager-0.5.3.orig/src/virtManager/connection.py 2008-01-10 18:17:51.000000000 -0700 +++ virt-manager-0.5.3/src/virtManager/connection.py 2008-02-20 14:14:31.000000000 -0700
+++ virt-manager-0.5.3/src/virtManager/connection.py 2008-02-02 00:44:16.000000000 -0700 @@ -136,6 +136,20 @@
@@ -136,6 +136,18 @@
self.detect_network_devices() self.detect_network_devices()
@ -10,6 +9,8 @@ Index: virt-manager-0.5.3/src/virtManager/connection.py
+ # this is a temporary workaround that can be removed when we get + # this is a temporary workaround that can be removed when we get
+ # a newer hald/hald_dbus.c + # a newer hald/hald_dbus.c
+ def _query_capability(self, device_interface, str_capability): + def _query_capability(self, device_interface, str_capability):
+ if device_interface == None:
+ return False
+ if not device_interface.PropertyExists('info.capabilities'): + if not device_interface.PropertyExists('info.capabilities'):
+ return False + return False
+ cap_set = set(device_interface.GetProperty('info.capabilities')) + cap_set = set(device_interface.GetProperty('info.capabilities'))
@ -21,7 +22,7 @@ Index: virt-manager-0.5.3/src/virtManager/connection.py
def detect_network_devices(self): def detect_network_devices(self):
try: try:
# Get a connection to the SYSTEM bus # Get a connection to the SYSTEM bus
@@ -161,7 +173,7 @@ @@ -161,7 +175,7 @@
def _device_added(self, path): def _device_added(self, path):
obj = self.bus.get_object("org.freedesktop.Hal", path) obj = self.bus.get_object("org.freedesktop.Hal", path)
@ -30,11 +31,10 @@ Index: virt-manager-0.5.3/src/virtManager/connection.py
name = obj.GetPropertyString("net.interface") name = obj.GetPropertyString("net.interface")
mac = obj.GetPropertyString("net.address") mac = obj.GetPropertyString("net.address")
Index: virt-manager-0.5.3/src/virtManager/opticalhelper.py diff -Nuar virt-manager-0.5.3.orig/src/virtManager/opticalhelper.py virt-manager-0.5.3/src/virtManager/opticalhelper.py
=================================================================== --- virt-manager-0.5.3.orig/src/virtManager/opticalhelper.py 2008-02-20 14:13:33.000000000 -0700
--- virt-manager-0.5.3.orig/src/virtManager/opticalhelper.py 2008-01-10 18:17:51.000000000 -0700 +++ virt-manager-0.5.3/src/virtManager/opticalhelper.py 2008-02-20 14:14:57.000000000 -0700
+++ virt-manager-0.5.3/src/virtManager/opticalhelper.py 2008-02-02 00:44:40.000000000 -0700 @@ -41,6 +41,19 @@
@@ -41,6 +41,17 @@
self.hal_iface = None self.hal_iface = None
raise raise
@ -42,6 +42,8 @@ Index: virt-manager-0.5.3/src/virtManager/opticalhelper.py
+ # this is a temporary workaround that can be removed when we get + # this is a temporary workaround that can be removed when we get
+ # a newer hald/hald_dbus.c + # a newer hald/hald_dbus.c
+ def _query_capability(self, device_interface, str_capability): + def _query_capability(self, device_interface, str_capability):
+ if device_interface == None:
+ return False
+ if not device_interface.PropertyExists('info.capabilities'): + if not device_interface.PropertyExists('info.capabilities'):
+ return False + return False
+ cap_set = set(device_interface.GetProperty('info.capabilities')) + cap_set = set(device_interface.GetProperty('info.capabilities'))
@ -52,7 +54,7 @@ Index: virt-manager-0.5.3/src/virtManager/opticalhelper.py
def populate_opt_media(self): def populate_opt_media(self):
# get a list of optical devices with data discs in, for FV installs # get a list of optical devices with data discs in, for FV installs
vollabel = {} vollabel = {}
@@ -71,7 +82,7 @@ @@ -71,7 +84,7 @@
def _device_added(self, path): def _device_added(self, path):
vol = self.bus.get_object("org.freedesktop.Hal", path) vol = self.bus.get_object("org.freedesktop.Hal", path)

224
virtman-timewatch.diff Normal file
View File

@ -0,0 +1,224 @@
diff -Nuar virt-manager-0.5.3.orig/src/virtManager/config.py virt-manager-0.5.3/src/virtManager/config.py
--- virt-manager-0.5.3.orig/src/virtManager/config.py 2008-02-20 10:23:45.000000000 -0700
+++ virt-manager-0.5.3/src/virtManager/config.py 2008-02-20 10:58:37.000000000 -0700
@@ -172,6 +172,8 @@
return 10
return history
+ def get_stats_minimize_minutes(self):
+ return self.conf.get_int(self.conf_dir + "/stats/minimize-minutes")
def set_stats_update_interval(self, interval):
self.conf.set_int(self.conf_dir + "/stats/update-interval", interval)
@@ -179,6 +181,8 @@
def set_stats_history_length(self, length):
self.conf.set_int(self.conf_dir + "/stats/history-length", length)
+ def set_stats_minimize_minutes(self, minutes):
+ self.conf.set_int(self.conf_dir + "/stats/minimize-minutes", minutes)
def on_stats_update_interval_changed(self, callback):
self.conf.notify_add(self.conf_dir + "/stats/update-interval", callback)
@@ -186,6 +190,9 @@
def on_stats_history_length_changed(self, callback):
self.conf.notify_add(self.conf_dir + "/stats/history-length", callback)
+ def on_stats_minimize_minutes_changed(self, callback):
+ self.conf.notify_add(self.conf_dir + "/stats/minimize-minutes", callback)
+
def on_console_popup_changed(self, callback):
self.conf.notify_add(self.conf_dir + "/console/popup", callback)
diff -Nuar virt-manager-0.5.3.orig/src/virtManager/connection.py virt-manager-0.5.3/src/virtManager/connection.py
--- virt-manager-0.5.3.orig/src/virtManager/connection.py 2008-02-20 10:23:45.000000000 -0700
+++ virt-manager-0.5.3/src/virtManager/connection.py 2008-02-20 11:53:08.000000000 -0700
@@ -467,7 +467,7 @@
os.remove(frm)
return status
- def tick(self, noStatsUpdate=False):
+ def tick(self, noStatsUpdate=False, sleeping=False):
if self.state != self.STATE_ACTIVE:
return
@@ -488,11 +488,12 @@
logging.warn("Unable to list inactive networks")
# check of net devices
- newPaths = []
- if self.hal_iface:
- newPaths = self.hal_iface.FindDeviceByCapability("net")
- for newPath in newPaths:
- self._device_added(newPath)
+ if sleeping == False:
+ newPaths = []
+ if self.hal_iface:
+ newPaths = self.hal_iface.FindDeviceByCapability("net")
+ for newPath in newPaths:
+ self._device_added(newPath)
for name in newActiveNetNames:
net = self.vmm.networkLookupByName(name)
diff -Nuar virt-manager-0.5.3.orig/src/virtManager/engine.py virt-manager-0.5.3/src/virtManager/engine.py
--- virt-manager-0.5.3.orig/src/virtManager/engine.py 2008-02-20 10:23:45.000000000 -0700
+++ virt-manager-0.5.3/src/virtManager/engine.py 2008-02-20 11:51:52.000000000 -0700
@@ -149,7 +149,11 @@
def _tick(self):
for uri in self.connections.keys():
try:
- self.connections[uri]["connection"].tick()
+ if self.windowManager != None:
+ sleeping= self.windowManager.timewatch.process_clock(self.windowManager.window.get_widget("vmm-manager"))
+ else:
+ sleeping= False
+ self.connections[uri]["connection"].tick(sleeping = sleeping)
except KeyboardInterrupt:
raise KeyboardInterrupt
except:
diff -Nuar virt-manager-0.5.3.orig/src/virtManager/manager.py virt-manager-0.5.3/src/virtManager/manager.py
--- virt-manager-0.5.3.orig/src/virtManager/manager.py 2008-02-20 10:23:45.000000000 -0700
+++ virt-manager-0.5.3/src/virtManager/manager.py 2008-02-20 12:11:22.000000000 -0700
@@ -33,6 +33,8 @@
from virtManager.asyncjob import vmmAsyncJob
from virtManager.error import vmmErrorDialog
+import timex
+
VMLIST_SORT_ID = 1
VMLIST_SORT_NAME = 2
VMLIST_SORT_CPU_USAGE = 3
@@ -101,6 +103,14 @@
self.connections = {}
self.prepare_vmlist()
+ self.timewatch= timex.timex()
+ if self.config.get_stats_minimize_minutes() == -1:
+ logging.debug("minimize_minutes value unset - defaulting to 120")
+ self.config.set_stats_minimize_minutes(120)
+ self.timewatch.set_timeout_minutes(self.config.get_stats_minimize_minutes())
+ self.config.on_stats_minimize_minutes_changed(self.reschedule_minimize)
+ logging.debug("minimize_minutes set to %s" % str(self.config.get_stats_minimize_minutes()))
+
self.config.on_vmlist_domain_id_visible_changed(self.toggle_domain_id_visible_widget)
self.config.on_vmlist_status_visible_changed(self.toggle_status_visible_widget)
self.config.on_vmlist_cpu_usage_visible_changed(self.toggle_cpu_usage_visible_widget)
@@ -232,6 +242,15 @@
"on_menu_help_activate": self.show_help,
})
+ self.window.get_widget("vmm-manager" ).connect("window_state_event",self.timewatch.handle_window_state_event)
+ self.window.get_widget("vm-list" ).connect("button_press_event",self.timewatch.handle_reset_clock_event )
+ widget= self.window.get_widget("vmm-manager")
+ self.window.get_widget("vm-new" ).connect("clicked" ,self.timewatch.handle_reset_clock_event, widget )
+ self.window.get_widget("vm-open" ).connect("clicked" ,self.timewatch.handle_reset_clock_event, widget )
+ self.window.get_widget("vm-details" ).connect("clicked" ,self.timewatch.handle_reset_clock_event, widget )
+ self.window.get_widget("vm-delete" ).connect("clicked" ,self.timewatch.handle_reset_clock_event, widget )
+ self.window.get_widget("menu_edit_details" ).connect("activate" ,self.timewatch.handle_reset_clock_event, widget )
+
self.vm_selected(None)
self.window.get_widget("vm-list").get_selection().connect("changed", self.vm_selected)
@@ -481,6 +500,9 @@
def vm_resources_sampled(self, vm):
+ if self.timewatch.process_clock(self.window.get_widget("vmm-manager")):
+ return
+
vmlist = self.window.get_widget("vm-list")
model = vmlist.get_model()
@@ -519,6 +541,9 @@
def conn_refresh_resources(self, conn):
+ if self.timewatch.process_clock(self.window.get_widget("vmm-manager")):
+ return
+
vmlist = self.window.get_widget("vm-list")
model = vmlist.get_model()
row = self.rows[conn.get_uri()]
@@ -1039,6 +1064,10 @@
dg.hide()
dg.destroy()
+ def reschedule_minimize(self,ignore1,ignore2,ignore3,ignore4):
+ self.timewatch.set_timeout_minutes(self.config.get_stats_minimize_minutes())
+ logging.debug("minimize_minutes rescheduled to %s" % str(self.config.get_stats_minimize_minutes()))
+
def _err_dialog(self, summary, details):
dg = vmmErrorDialog(None, 0, gtk.MESSAGE_ERROR,
gtk.BUTTONS_CLOSE, summary, details)
diff -Nuar virt-manager-0.5.3.orig/src/virtManager/timex.py virt-manager-0.5.3/src/virtManager/timex.py
--- virt-manager-0.5.3.orig/src/virtManager/timex.py 1969-12-31 17:00:00.000000000 -0700
+++ virt-manager-0.5.3/src/virtManager/timex.py 2008-02-20 10:24:05.000000000 -0700
@@ -0,0 +1,44 @@
+import gtk
+import time
+
+class timex:
+
+ def __init__(self):
+ self.iconify_adjust_minutes= 0
+ self.iconify_time= 0
+ self.iconified= False
+ self.widgets = {}
+
+ # call with minutes= 0 to stop timer
+ def set_timeout_minutes(self,minutes):
+ self.iconify_adjust_minutes= minutes
+ if self.iconify_adjust_minutes == 0:
+ self.iconify_time= 0
+
+ def reset_clock(self):
+ if self.iconify_adjust_minutes:
+ self.iconify_time= time.time() + (self.iconify_adjust_minutes*60)
+
+ def handle_reset_clock_event(self,widget,event):
+ self.reset_clock()
+
+ def handle_window_state_event(self,widget,event):
+ new_state = event.new_window_state
+ if new_state & gtk.gdk.WINDOW_STATE_ICONIFIED:
+ self.widgets[widget.get_name()]= True
+ else:
+ self.widgets[widget.get_name()] = False
+ self.reset_clock()
+
+ # return True if caller should skip processing
+ def process_clock(self,widget):
+ if self.widgets.has_key(widget.get_name()):
+ if self.widgets[widget.get_name()] == True:
+ return True
+ if self.iconify_time == 0:
+ return False
+ if time.time() <= self.iconify_time:
+ return False
+ widget.iconify()
+ return True
+
diff -Nuar virt-manager-0.5.3.orig/src/virt-manager.schemas.in virt-manager-0.5.3/src/virt-manager.schemas.in
--- virt-manager-0.5.3.orig/src/virt-manager.schemas.in 2008-02-20 10:23:45.000000000 -0700
+++ virt-manager-0.5.3/src/virt-manager.schemas.in 2008-02-20 12:16:20.000000000 -0700
@@ -118,6 +118,21 @@
</schema>
<schema>
+ <key>/schemas/apps/::PACKAGE::/stats/minimize-minutes</key>
+ <applyto>/apps/::PACKAGE::/stats/minimize-minutes</applyto>
+ <owner>::PACKAGE::</owner>
+ <type>int</type>
+ <default>-1</default>
+
+ <locale name="C">
+ <short>Minimize main window minutes</short>
+ <long>The number of minutes to wait before minimizing main window due to
+ inactivity. Setting to 0 will disable the minimizing feature, but
+ while window is un-minimized, GTK and DBus will leak memory.</long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/::PACKAGE::/urls/url-list-length</key>
<applyto>/apps/::PACKAGE::/urls/url-list-length</applyto>
<owner>::PACKAGE::</owner>