Added additional check for cloning a VM

An attempt to clone a VM to a name that is already in use will
fail more gracefully and with an explicit warning message.
This commit is contained in:
Marta Marczykowska-Górecka 2019-04-30 16:12:27 +02:00
parent 733f00ddf2
commit ddb70fe8ea
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B

View File

@ -504,7 +504,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
# Check Updates Timer
timer = QtCore.QTimer(self)
timer.timeout.connect(self.check_updates)
timer.start(1000 * 30) # 30s
timer.start(1000 * 30) # 30s
self.check_updates()
def keyPressEvent(self, event): # pylint: disable=invalid-name
@ -852,6 +852,15 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
if not ok or clone_name == "":
return
name_in_use = clone_name in self.qubes_app.domains
if name_in_use:
QtGui.QMessageBox.warning(
None, self.tr("Name already in use!"),
self.tr("There already exists a qube called '{}'. "
"Cloning aborted.").format(clone_name))
return
self.progress = QtGui.QProgressDialog(
self.tr(
"Cloning Qube..."), "", 0, 0)