Suport for commit template changes

This commit is contained in:
Marek Marczykowski 2011-03-02 12:51:29 +01:00
parent 7ee1c52be2
commit 7ddd37deab

View File

@ -319,8 +319,8 @@ class VmManagerWindow(QMainWindow):
self.action_shutdownvm = self.createAction ("Shutdown VM", slot=self.shutdown_vm, self.action_shutdownvm = self.createAction ("Shutdown VM", slot=self.shutdown_vm,
icon="shutdownvm", tip="Shutdown a running VM") icon="shutdownvm", tip="Shutdown a running VM")
self.action_updatevm = self.createAction ("Update VM", slot=None, self.action_updatevm = self.createAction ("Commit VM changes", slot=self.update_vm,
icon="updateable", tip="Update VM (only for 'updateable' VMs, e.g. templates)") icon="updateable", tip="Commit changes to template (only for 'updateable' template VMs); VM must be stopped")
self.action_showallvms = self.createAction ("Show/Hide Inactive VMs", slot=None, checkable=True, self.action_showallvms = self.createAction ("Show/Hide Inactive VMs", slot=None, checkable=True,
icon="showallvms", tip="Show/Hide Inactive VMs") icon="showallvms", tip="Show/Hide Inactive VMs")
@ -491,6 +491,7 @@ class VmManagerWindow(QMainWindow):
#self.action_resumevm.setEnabled(not vm.is_running()) #self.action_resumevm.setEnabled(not vm.is_running())
#self.action_pausevm.setEnabled(vm.is_running() and vm.qid != 0) #self.action_pausevm.setEnabled(vm.is_running() and vm.qid != 0)
self.action_shutdownvm.setEnabled(vm.is_running() and vm.qid != 0) self.action_shutdownvm.setEnabled(vm.is_running() and vm.qid != 0)
self.action_updatevm.setEnabled(vm.is_updateable() and not vm.is_running())
def closeEvent (self, event): def closeEvent (self, event):
self.hide() self.hide()
@ -681,6 +682,15 @@ class VmManagerWindow(QMainWindow):
self.shutdown_monitor[vm.qid] = VmShutdownMonitor (vm) self.shutdown_monitor[vm.qid] = VmShutdownMonitor (vm)
QTimer.singleShot (vm_shutdown_timeout, self.shutdown_monitor[vm.qid].check_if_vm_has_shutdown) QTimer.singleShot (vm_shutdown_timeout, self.shutdown_monitor[vm.qid].check_if_vm_has_shutdown)
def update_vm(self):
vm = self.get_selected_vm()
try:
vm.commit_changes();
except Exception as ex:
QMessageBox.warning (None, "Error commiting changes!", "ERROR: {0}".format(ex))
return
def showcpuload(self): def showcpuload(self):
pass pass