From 45496f73dec46b012551877fd654bd6132659105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Mon, 8 Jan 2018 20:05:25 +0100 Subject: [PATCH] Added warning that the VM is currently running Added warning that the VM is currently running. User still must shut it manually (by design). --- qubesmanager/bootfromdevice.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/qubesmanager/bootfromdevice.py b/qubesmanager/bootfromdevice.py index 839104a..518c7fb 100644 --- a/qubesmanager/bootfromdevice.py +++ b/qubesmanager/bootfromdevice.py @@ -45,6 +45,8 @@ class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, QtGui.QDialog): # populate buttons and such self.__init_buttons__() + # warn user if the VM is currently running + self.__warn_if_running__() def reject(self): self.done(0) @@ -62,8 +64,21 @@ class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, QtGui.QDialog): self.tr("ERROR!"), self.tr("No file or block device selected; please select one.")) return + + # warn user if the VM is currently running + self.__warn_if_running__() + qvm_start.main(['--cdrom', cdrom_location, self.vm.name]) + def __warn_if_running__(self): + if self.vm.is_running(): + QtGui.QMessageBox.warning( + None, + self.tr("Warning!"), + self.tr("VM must be turned off before booting it from" + "device. Please turn off the VM.") + ) + def __init_buttons__(self): self.fileVM.setEnabled(False) self.selectFileButton.setEnabled(False)