Do not mark get_attrs_config as internal private method

It is intended to at least be extended by subclasses, so isn't really
internal, rather part of API.
This commit is contained in:
Marek Marczykowski 2013-03-16 15:28:18 +01:00
parent 0f7308ceeb
commit 3ec6d3d237
7 changed files with 15 additions and 15 deletions

View File

@ -51,7 +51,7 @@ class QubesVm(object):
# In which order load this VM type from qubes.xml
load_order = 100
def _get_attrs_config(self):
def get_attrs_config(self):
""" Object attributes for serialization/deserialization
inner dict keys:
- order: initialization order (to keep dependency intact)
@ -169,7 +169,7 @@ class QubesVm(object):
kwargs["template"] = collection[int(template_qid)]
else:
raise ValueError("Unknown template with QID %s" % template_qid)
attrs = self._get_attrs_config()
attrs = self.get_attrs_config()
for attr_name in sorted(attrs, key=lambda _x: attrs[_x]['order'] if 'order' in attrs[_x] else 1000):
attr_config = attrs[attr_name]
attr = attr_name
@ -1491,7 +1491,7 @@ class QubesVm(object):
def get_xml_attrs(self):
attrs = {}
attrs_config = self._get_attrs_config()
attrs_config = self.get_attrs_config()
for attr in attrs_config:
attr_config = attrs_config[attr]
if 'save' in attr_config:

View File

@ -37,8 +37,8 @@ class QubesTemplateVm(QubesVm):
# In which order load this VM type from qubes.xml
load_order = 50
def _get_attrs_config(self):
attrs_config = super(QubesTemplateVm, self)._get_attrs_config()
def get_attrs_config(self):
attrs_config = super(QubesTemplateVm, self).get_attrs_config()
attrs_config['dir_path']['eval'] = 'value if value is not None else os.path.join(system_path["qubes_templates_dir"], self.name)'
attrs_config['label']['default'] = defaults["template_label"]

View File

@ -33,8 +33,8 @@ class QubesNetVm(QubesVm):
# In which order load this VM type from qubes.xml
load_order = 70
def _get_attrs_config(self):
attrs_config = super(QubesNetVm, self)._get_attrs_config()
def get_attrs_config(self):
attrs_config = super(QubesNetVm, self).get_attrs_config()
attrs_config['dir_path']['eval'] = 'value if value is not None else os.path.join(system_path["qubes_servicevms_dir"], self.name)'
attrs_config['label']['default'] = defaults["servicevm_label"]
attrs_config['memory']['default'] = 200

View File

@ -34,8 +34,8 @@ class QubesProxyVm(QubesNetVm):
A class that represents a ProxyVM, ex FirewallVM. A child of QubesNetVM.
"""
def _get_attrs_config(self):
attrs_config = super(QubesProxyVm, self)._get_attrs_config()
def get_attrs_config(self):
attrs_config = super(QubesProxyVm, self).get_attrs_config()
attrs_config['uses_default_netvm']['eval'] = 'False'
# Save netvm prop again
attrs_config['netvm']['save'] = 'str(self.netvm.qid) if self.netvm is not None else "none"'

View File

@ -27,8 +27,8 @@ class QubesAppVm(QubesVm):
"""
A class that represents an AppVM. A child of QubesVm.
"""
def _get_attrs_config(self):
attrs_config = super(QubesAppVm, self)._get_attrs_config()
def get_attrs_config(self):
attrs_config = super(QubesAppVm, self).get_attrs_config()
attrs_config['dir_path']['eval'] = 'value if value is not None else os.path.join(system_path["qubes_appvms_dir"], self.name)'
return attrs_config

View File

@ -43,8 +43,8 @@ class QubesDisposableVm(QubesVm):
# In which order load this VM type from qubes.xml
load_order = 120
def _get_attrs_config(self):
attrs_config = super(QubesDisposableVm, self)._get_attrs_config()
def get_attrs_config(self):
attrs_config = super(QubesDisposableVm, self).get_attrs_config()
# New attributes
attrs_config['dispid'] = { 'save': 'str(self.dispid)' }

View File

@ -41,8 +41,8 @@ class QubesHVm(QubesVm):
# FIXME: logically should inherit after QubesAppVm, but none of its methods
# are useful for HVM
def _get_attrs_config(self):
attrs = super(QubesHVm, self)._get_attrs_config()
def get_attrs_config(self):
attrs = super(QubesHVm, self).get_attrs_config()
attrs.pop('kernel')
attrs.pop('kernels_dir')
attrs.pop('kernelopts')