Improve vm.is_*vm functions
Do not refer to other VM class explicitly from QubesVm
This commit is contained in:
parent
7343fea255
commit
b733754165
@ -592,19 +592,19 @@ class QubesVm(object):
|
|||||||
self.create_appmenus(verbose=False)
|
self.create_appmenus(verbose=False)
|
||||||
|
|
||||||
def is_template(self):
|
def is_template(self):
|
||||||
return isinstance(self, QubesTemplateVm)
|
return False
|
||||||
|
|
||||||
def is_appvm(self):
|
def is_appvm(self):
|
||||||
return isinstance(self, QubesAppVm)
|
return False
|
||||||
|
|
||||||
def is_netvm(self):
|
def is_netvm(self):
|
||||||
return isinstance(self, QubesNetVm)
|
return False
|
||||||
|
|
||||||
def is_proxyvm(self):
|
def is_proxyvm(self):
|
||||||
return isinstance(self, QubesProxyVm)
|
return False
|
||||||
|
|
||||||
def is_disposablevm(self):
|
def is_disposablevm(self):
|
||||||
return isinstance(self, QubesDisposableVm)
|
return False
|
||||||
|
|
||||||
def get_xl_dominfo(self):
|
def get_xl_dominfo(self):
|
||||||
if dry_run:
|
if dry_run:
|
||||||
@ -1729,6 +1729,9 @@ class QubesTemplateVm(QubesVm):
|
|||||||
def updateable(self):
|
def updateable(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def is_template(self):
|
||||||
|
return True
|
||||||
|
|
||||||
def get_firewall_defaults(self):
|
def get_firewall_defaults(self):
|
||||||
return { "rules": list(), "allow": False, "allowDns": False, "allowIcmp": False, "allowYumProxy": True }
|
return { "rules": list(), "allow": False, "allowDns": False, "allowIcmp": False, "allowYumProxy": True }
|
||||||
|
|
||||||
@ -1910,6 +1913,9 @@ class QubesNetVm(QubesVm):
|
|||||||
def type(self):
|
def type(self):
|
||||||
return "NetVM"
|
return "NetVM"
|
||||||
|
|
||||||
|
def is_netvm(self):
|
||||||
|
return True
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def gateway(self):
|
def gateway(self):
|
||||||
return self.__gateway
|
return self.__gateway
|
||||||
@ -2059,6 +2065,9 @@ class QubesProxyVm(QubesNetVm):
|
|||||||
def type(self):
|
def type(self):
|
||||||
return "ProxyVM"
|
return "ProxyVM"
|
||||||
|
|
||||||
|
def is_proxyvm(self):
|
||||||
|
return True
|
||||||
|
|
||||||
def _set_netvm(self, new_netvm):
|
def _set_netvm(self, new_netvm):
|
||||||
old_netvm = self.netvm
|
old_netvm = self.netvm
|
||||||
super(QubesProxyVm, self)._set_netvm(new_netvm)
|
super(QubesProxyVm, self)._set_netvm(new_netvm)
|
||||||
@ -2296,6 +2305,9 @@ class QubesDisposableVm(QubesVm):
|
|||||||
def type(self):
|
def type(self):
|
||||||
return "DisposableVM"
|
return "DisposableVM"
|
||||||
|
|
||||||
|
def is_disposablevm(self):
|
||||||
|
return True
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ip(self):
|
def ip(self):
|
||||||
if self.netvm is not None:
|
if self.netvm is not None:
|
||||||
@ -2333,6 +2345,9 @@ class QubesAppVm(QubesVm):
|
|||||||
def type(self):
|
def type(self):
|
||||||
return "AppVM"
|
return "AppVM"
|
||||||
|
|
||||||
|
def is_appvm(self):
|
||||||
|
return True
|
||||||
|
|
||||||
def create_on_disk(self, verbose, source_template = None):
|
def create_on_disk(self, verbose, source_template = None):
|
||||||
if dry_run:
|
if dry_run:
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user