Forráskód Böngészése

Added warning that the VM is currently running

Added warning that the VM is currently running. User still must shut it manually (by design).
Marta Marczykowska-Górecka 6 éve
szülő
commit
45496f73de
1 módosított fájl, 15 hozzáadás és 0 törlés
  1. 15 0
      qubesmanager/bootfromdevice.py

+ 15 - 0
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)