Skip to content

Commit

Permalink
Added additional check for cloning a VM
Browse files Browse the repository at this point in the history
An attempt to clone a VM to a name that is already in use will
fail more gracefully and with an explicit warning message.
  • Loading branch information
marmarta committed May 3, 2019
1 parent 733f00d commit ddb70fe
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion qubesmanager/qube_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ def __init__(self, qt_app, qubes_app, dispatcher, parent=None):
# 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
Expand Down Expand Up @@ -852,6 +852,15 @@ def action_clonevm_triggered(self):
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)
Expand Down

0 comments on commit ddb70fe

Please sign in to comment.