|
@@ -29,7 +29,7 @@ class QubesException(Exception):
|
|
|
class QubesVMNotFoundError(QubesException, KeyError):
|
|
|
'''Domain cannot be found in the system'''
|
|
|
def __init__(self, vmname):
|
|
|
- super(QubesVMNotFoundError, self).__init__(
|
|
|
+ super().__init__(
|
|
|
'No such domain: {!r}'.format(vmname))
|
|
|
self.vmname = vmname
|
|
|
|
|
@@ -41,13 +41,13 @@ class QubesVMNotFoundError(QubesException, KeyError):
|
|
|
class QubesVMError(QubesException):
|
|
|
'''Some problem with domain state.'''
|
|
|
def __init__(self, vm, msg):
|
|
|
- super(QubesVMError, self).__init__(msg)
|
|
|
+ super().__init__(msg)
|
|
|
self.vm = vm
|
|
|
|
|
|
class QubesVMInUseError(QubesVMError):
|
|
|
'''VM is in use, cannot remove.'''
|
|
|
def __init__(self, vm, msg=None):
|
|
|
- super(QubesVMInUseError, self).__init__(vm,
|
|
|
+ super().__init__(vm,
|
|
|
msg or 'Domain is in use: {!r}'.format(vm.name))
|
|
|
|
|
|
class QubesVMNotStartedError(QubesVMError):
|
|
@@ -57,7 +57,7 @@ class QubesVMNotStartedError(QubesVMError):
|
|
|
(that is, either running or paused).
|
|
|
'''
|
|
|
def __init__(self, vm, msg=None):
|
|
|
- super(QubesVMNotStartedError, self).__init__(vm,
|
|
|
+ super().__init__(vm,
|
|
|
msg or 'Domain is powered off: {!r}'.format(vm.name))
|
|
|
|
|
|
|
|
@@ -68,7 +68,7 @@ class QubesVMNotRunningError(QubesVMNotStartedError):
|
|
|
halted or paused.
|
|
|
'''
|
|
|
def __init__(self, vm, msg=None):
|
|
|
- super(QubesVMNotRunningError, self).__init__(vm,
|
|
|
+ super().__init__(vm,
|
|
|
msg or 'Domain not running (either powered off or paused): {!r}' \
|
|
|
.format(vm.name))
|
|
|
|
|
@@ -79,7 +79,7 @@ class QubesVMNotPausedError(QubesVMNotStartedError):
|
|
|
This exception is thrown when machine should be paused, but is not.
|
|
|
'''
|
|
|
def __init__(self, vm, msg=None):
|
|
|
- super(QubesVMNotPausedError, self).__init__(vm,
|
|
|
+ super().__init__(vm,
|
|
|
msg or 'Domain is not paused: {!r}'.format(vm.name))
|
|
|
|
|
|
|
|
@@ -90,7 +90,7 @@ class QubesVMNotSuspendedError(QubesVMError):
|
|
|
halted or running.
|
|
|
'''
|
|
|
def __init__(self, vm, msg=None):
|
|
|
- super(QubesVMNotSuspendedError, self).__init__(vm,
|
|
|
+ super().__init__(vm,
|
|
|
msg or 'Domain is not suspended: {!r}'.format(vm.name))
|
|
|
|
|
|
|
|
@@ -101,7 +101,7 @@ class QubesVMNotHaltedError(QubesVMError):
|
|
|
running or paused).
|
|
|
'''
|
|
|
def __init__(self, vm, msg=None):
|
|
|
- super(QubesVMNotHaltedError, self).__init__(vm,
|
|
|
+ super().__init__(vm,
|
|
|
msg or 'Domain is not powered off: {!r}'.format(vm.name))
|
|
|
|
|
|
class QubesVMShutdownTimeoutError(QubesVMError):
|
|
@@ -109,21 +109,21 @@ class QubesVMShutdownTimeoutError(QubesVMError):
|
|
|
|
|
|
'''
|
|
|
def __init__(self, vm, msg=None):
|
|
|
- super(QubesVMShutdownTimeoutError, self).__init__(vm,
|
|
|
+ super().__init__(vm,
|
|
|
msg or 'Domain shutdown timed out: {!r}'.format(vm.name))
|
|
|
|
|
|
|
|
|
class QubesNoTemplateError(QubesVMError):
|
|
|
'''Cannot start domain, because there is no template'''
|
|
|
def __init__(self, vm, msg=None):
|
|
|
- super(QubesNoTemplateError, self).__init__(vm,
|
|
|
+ super().__init__(vm,
|
|
|
msg or 'Template for the domain {!r} not found'.format(vm.name))
|
|
|
|
|
|
|
|
|
class QubesPoolInUseError(QubesException):
|
|
|
'''VM is in use, cannot remove.'''
|
|
|
def __init__(self, pool, msg=None):
|
|
|
- super(QubesPoolInUseError, self).__init__(
|
|
|
+ super().__init__(
|
|
|
msg or 'Storage pool is in use: {!r}'.format(pool.name))
|
|
|
|
|
|
|
|
@@ -135,7 +135,7 @@ class QubesPropertyValueError(QubesValueError):
|
|
|
'''Cannot set value of qubes.property, because user-supplied value is wrong.
|
|
|
'''
|
|
|
def __init__(self, holder, prop, value, msg=None):
|
|
|
- super(QubesPropertyValueError, self).__init__(
|
|
|
+ super().__init__(
|
|
|
msg or 'Invalid value {!r} for property {!r} of {!r}'.format(
|
|
|
value, prop.__name__, holder))
|
|
|
self.holder = holder
|
|
@@ -147,7 +147,7 @@ class QubesNoSuchPropertyError(QubesException, AttributeError):
|
|
|
'''Requested property does not exist
|
|
|
'''
|
|
|
def __init__(self, holder, prop_name, msg=None):
|
|
|
- super(QubesNoSuchPropertyError, self).__init__(
|
|
|
+ super().__init__(
|
|
|
msg or 'Invalid property {!r} of {!s}'.format(
|
|
|
prop_name, holder))
|
|
|
self.holder = holder
|
|
@@ -157,14 +157,14 @@ class QubesNoSuchPropertyError(QubesException, AttributeError):
|
|
|
class QubesNotImplementedError(QubesException, NotImplementedError):
|
|
|
'''Thrown at user when some feature is not implemented'''
|
|
|
def __init__(self, msg=None):
|
|
|
- super(QubesNotImplementedError, self).__init__(
|
|
|
+ super().__init__(
|
|
|
msg or 'This feature is not available')
|
|
|
|
|
|
|
|
|
class BackupCancelledError(QubesException):
|
|
|
'''Thrown at user when backup was manually cancelled'''
|
|
|
def __init__(self, msg=None):
|
|
|
- super(BackupCancelledError, self).__init__(
|
|
|
+ super().__init__(
|
|
|
msg or 'Backup cancelled')
|
|
|
|
|
|
|
|
@@ -172,21 +172,21 @@ class BackupAlreadyRunningError(QubesException):
|
|
|
'''Thrown at user when they try to run the same backup twice at
|
|
|
the same time'''
|
|
|
def __init__(self, msg=None):
|
|
|
- super(BackupAlreadyRunningError, self).__init__(
|
|
|
+ super().__init__(
|
|
|
msg or 'Backup already running')
|
|
|
|
|
|
|
|
|
class QubesMemoryError(QubesVMError, MemoryError):
|
|
|
'''Cannot start domain, because not enough memory is available'''
|
|
|
def __init__(self, vm, msg=None):
|
|
|
- super(QubesMemoryError, self).__init__(vm,
|
|
|
+ super().__init__(vm,
|
|
|
msg or 'Not enough memory to start domain {!r}'.format(vm.name))
|
|
|
|
|
|
|
|
|
class QubesFeatureNotFoundError(QubesException, KeyError):
|
|
|
'''Feature not set for a given domain'''
|
|
|
def __init__(self, domain, feature):
|
|
|
- super(QubesFeatureNotFoundError, self).__init__(
|
|
|
+ super().__init__(
|
|
|
'Feature not set for domain {}: {}'.format(domain, feature))
|
|
|
self.feature = feature
|
|
|
self.vm = domain
|