2018-10-20 18:34:15 +02:00
|
|
|
#!/usr/bin/python2
|
|
|
|
#
|
|
|
|
# The Qubes OS Project, http://www.qubes-os.org
|
|
|
|
#
|
|
|
|
# Copyright (C) 2011 Marek Marczykowski <marmarek@mimuw.edu.pl>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public License along
|
|
|
|
# with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
from PyQt4 import QtCore # pylint: disable=import-error
|
|
|
|
from qubesadmin import exc
|
|
|
|
|
|
|
|
|
2018-10-22 10:14:26 +02:00
|
|
|
# pylint: disable=too-few-public-methods
|
2018-10-20 18:34:15 +02:00
|
|
|
class RemoveVMThread(QtCore.QThread):
|
|
|
|
def __init__(self, vm):
|
|
|
|
QtCore.QThread.__init__(self)
|
|
|
|
self.vm = vm
|
2018-10-22 20:00:37 +02:00
|
|
|
self.msg = None
|
2018-10-20 18:34:15 +02:00
|
|
|
|
|
|
|
def run(self):
|
|
|
|
try:
|
|
|
|
del self.vm.app.domains[self.vm.name]
|
|
|
|
except exc.QubesException as ex:
|
2018-10-22 20:00:37 +02:00
|
|
|
self.msg = ("Error removing Qube!", str(ex))
|
2018-10-20 18:34:15 +02:00
|
|
|
|
|
|
|
|
2018-10-22 10:14:26 +02:00
|
|
|
# pylint: disable=too-few-public-methods
|
2018-10-20 18:34:15 +02:00
|
|
|
class CloneVMThread(QtCore.QThread):
|
|
|
|
def __init__(self, src_vm, dst_name):
|
|
|
|
QtCore.QThread.__init__(self)
|
|
|
|
self.src_vm = src_vm
|
|
|
|
self.dst_name = dst_name
|
2018-10-22 20:00:37 +02:00
|
|
|
self.msg = None
|
2018-10-20 18:34:15 +02:00
|
|
|
|
|
|
|
def run(self):
|
|
|
|
try:
|
2018-10-20 23:01:35 +02:00
|
|
|
self.src_vm.app.clone_vm(self.src_vm, self.dst_name)
|
2018-10-22 20:00:37 +02:00
|
|
|
self.msg = ("Sucess", "The qube was cloned sucessfully.")
|
2018-10-20 18:34:15 +02:00
|
|
|
except exc.QubesException as ex:
|
2018-10-22 20:00:37 +02:00
|
|
|
self.msg = ("Error while cloning Qube!", str(ex))
|