summaryrefslogtreecommitdiff
path: root/virtinst/xmlbuilder.py
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2015-09-04 16:07:01 -0400
committerCole Robinson <crobinso@redhat.com>2015-09-04 16:16:25 -0400
commit4d87d2f27b6b2a1bf0c5db5a816a5698ddd66f06 (patch)
tree166d2da08d1acd55f0d437362ccf80f2d4d47493 /virtinst/xmlbuilder.py
parentacfb988945dd62de36576b217dbc1013d1415765 (diff)
downloadvirt-manager-4d87d2f27b6b2a1bf0c5db5a816a5698ddd66f06.tar.gz
cli: Make child lookup not specific to guest devices
<seclabel> is not singleton nowadays, so we need to extend our infrastructure to handle non-device child properties. This is part of that
Diffstat (limited to 'virtinst/xmlbuilder.py')
-rw-r--r--virtinst/xmlbuilder.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/virtinst/xmlbuilder.py b/virtinst/xmlbuilder.py
index 84bbc24c..3b6e3dd6 100644
--- a/virtinst/xmlbuilder.py
+++ b/virtinst/xmlbuilder.py
@@ -984,6 +984,16 @@ class XMLBuilder(object):
_remove_xpath_node(self._xmlstate.xml_ctx, xpath, dofree=False)
self._set_child_xpaths()
+ def list_children_for_class(self, klass):
+ """
+ Return a list of all XML child objects with the passed class
+ """
+ ret = []
+ for prop in self._all_child_props().values():
+ ret += [obj for obj in util.listify(prop._get(self))
+ if obj.__class__ == klass]
+ return ret
+
#################################
# Private XML building routines #