diff options
author | Cole Robinson <crobinso@redhat.com> | 2018-03-20 11:56:12 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2018-03-21 14:32:47 -0400 |
commit | 4b26348290f08c135a4e30bc1a578422c0406f22 (patch) | |
tree | c8af8a185c9964b88c84627886a74ecf65ae2b5c /virtinst/storage.py | |
parent | 5b111b3d9fab6e3931e42a8c016932385b3fa330 (diff) | |
download | virt-manager-4b26348290f08c135a4e30bc1a578422c0406f22.tar.gz |
xmlbuilder: Separate out the property cache
Add a few more mappings to simplify certain lookups, and add
some more validation to prevent programming errors
Diffstat (limited to 'virtinst/storage.py')
-rw-r--r-- | virtinst/storage.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/virtinst/storage.py b/virtinst/storage.py index d39a5939..656ab9e7 100644 --- a/virtinst/storage.py +++ b/virtinst/storage.py @@ -70,6 +70,15 @@ def _get_default_pool_path(conn): return path +class _EnumerateSource(XMLBuilder): + XML_NAME = "source" + + +class _EnumerateSources(XMLBuilder): + XML_NAME = "sources" + sources = XMLChildProperty(_EnumerateSource) + + class _Host(XMLBuilder): _XML_PROP_ORDER = ["name", "port"] XML_NAME = "host" @@ -151,13 +160,6 @@ class StoragePool(_StorageObject): return [] raise - class _EnumerateSource(XMLBuilder): - XML_NAME = "source" - class _EnumerateSources(XMLBuilder): - XML_NAME = "sources" - sources = XMLChildProperty(_EnumerateSource) - - ret = [] sources = _EnumerateSources(conn, xml) for source in sources.sources: |