Allow manually update dom0 from GUI

This commit is contained in:
Marek Marczykowski 2011-12-18 14:03:16 +01:00
parent d1d254fa18
commit 2777f7686b

View File

@ -632,7 +632,7 @@ class VmManagerWindow(QMainWindow):
self.action_shutdownvm.setEnabled(not vm.is_netvm() and vm.last_power_state and vm.qid != 0) self.action_shutdownvm.setEnabled(not vm.is_netvm() and vm.last_power_state and vm.qid != 0)
self.action_appmenus.setEnabled(not vm.is_netvm()) self.action_appmenus.setEnabled(not vm.is_netvm())
self.action_editfwrules.setEnabled(vm.is_networked() and not (vm.is_netvm() and not vm.is_proxyvm())) self.action_editfwrules.setEnabled(vm.is_networked() and not (vm.is_netvm() and not vm.is_proxyvm()))
self.action_updatevm.setEnabled(vm.is_updateable()) self.action_updatevm.setEnabled(vm.is_updateable() or vm.qid == 0)
def get_minimum_table_width(self): def get_minimum_table_width(self):
tbl_W = 0 tbl_W = 0
@ -910,15 +910,19 @@ class VmManagerWindow(QMainWindow):
app.processEvents() app.processEvents()
time.sleep (0.2) time.sleep (0.2)
if thread_monitor.success: if vm.qid != 0:
# gpk-update-viewer was started, don't know if user installs updates, but touch stat file anyway if thread_monitor.success:
open(vm.dir_path + '/' + updates_stat_file, 'w').close() # gpk-update-viewer was started, don't know if user installs updates, but touch stat file anyway
else: open(vm.dir_path + '/' + updates_stat_file, 'w').close()
QMessageBox.warning (None, "Error VM update!", "ERROR: {0}".format(thread_monitor.error_msg)) else:
QMessageBox.warning (None, "Error VM update!", "ERROR: {0}".format(thread_monitor.error_msg))
def do_update_vm(self, vm, thread_monitor): def do_update_vm(self, vm, thread_monitor):
try: try:
qubesutils.run_in_vm(vm, "user:gpk-update-viewer", verbose=False, autostart=True) if vm.qid == 0:
subprocess.check_call (["/usr/bin/qvm-dom0-update", "--gui"])
else:
qubesutils.run_in_vm(vm, "user:gpk-update-viewer", verbose=False, autostart=True)
except Exception as ex: except Exception as ex:
thread_monitor.set_error_msg(str(ex)) thread_monitor.set_error_msg(str(ex))
thread_monitor.set_finished() thread_monitor.set_finished()