summaryrefslogtreecommitdiff
path: root/virtinst/xmlbuilder.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix pylint/pycodestyle warnings with latest versionsCole Robinson2022-12-131-3/+3
| | | | Signed-off-by: Cole Robinson <crobinso@redhat.com>
* xmlbuilder: Make XMLManualActions work more like XMLChildPropertyCole Robinson2022-02-271-23/+49
| | | | | | | This will help us in upcoming patches add xpath subarguments to cli device options Signed-off-by: Cole Robinson <crobinso@redhat.com>
* xmlbuilder: Make embedded device XML print correctlyCole Robinson2021-10-121-1/+8
| | | | | | | | | | If you call get_xml() on a device that's part of a Guest class, the last element has correct indent but not the first element. Steal the indent from the last element and prepend it to the returned XML Signed-off-by: Cole Robinson <crobinso@redhat.com>
* cli: Add --xml xpath option for virt-install and virt-xmlCole Robinson2020-09-111-0/+40
| | | | | | | | | | | | | | | | | | | The --xml option allows users to request raw XML edits to virt-install or virt-xml generated XML. This gives users a bit of a workaround incase we don't have proper support for some XML property. The --xml option can gain more features in the future if it makes sense, like setting XML namespaces for example. Basic usage is like: virt-install --xml ./@foo=bar ... Which will change the generated <domain> XML to have <domain foo='bar' ... virt-xml works similarly. It can only be combined with --edit currently. This only works with xpaths rooted against the entire document. Signed-off-by: Cole Robinson <crobinso@redhat.com>
* xmlutil: Centralize all 'programming error' exceptionsCole Robinson2020-07-171-12/+13
| | | | | | | Raise them directly instead of adding the hard to read conditional into the function Signed-off-by: Cole Robinson <crobinso@redhat.com>
* setup: Use xgettext --add-comments=translatorsCole Robinson2020-07-111-2/+3
| | | | | | | So in the code we can prefix comments with 'translators:' before translated strings to have them show up in .pot file output Signed-off-by: Cole Robinson <crobinso@redhat.com>
* po: Fix message format warnings printed from xgettextCole Robinson2020-07-111-3/+4
| | | | Signed-off-by: Cole Robinson <crobinso@redhat.com>
* virtinst: trivial codespell fixesDaniel Henrique Barboza2020-07-041-1/+1
| | | | | Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
* Switch to more traditional logging structureCole Robinson2019-06-171-3/+3
| | | | | | | | Init a shared log instance in virtinst/logger.py, and use that throughout the code base, so we aren't calling directly into 'logging'. This helps protect our logging output from being cluttered with other library output, as happens with some 'requests' usage
* virtinst: Add full test coverage for xml*.py filesCole Robinson2019-06-091-22/+20
|
* virtinst: Rename util to xmlutilCole Robinson2019-06-071-5/+5
| | | | | The only functions left in there are largely for xml handling, so make it explicit
* util: move validate_name to XMLBuilder.validate_generic_nameCole Robinson2019-06-071-0/+15
|
* util: Replace xml_indent with textwrap.indentCole Robinson2019-06-061-3/+4
|
* xmlbuilder: Add replace_childCole Robinson2019-06-051-0/+18
| | | | This will be used for UI XML editing of devices
* xmlbuilder: Validate root element of object parsexmlCole Robinson2019-05-131-0/+4
| | | | Ensure that for example a DeviceDisk is actually passed <disk> XML
* xmlbuilder: Make is_* handling more future proofCole Robinson2019-05-121-13/+33
| | | | | If libvirt changes XML handling in the future, we shouldn't restrict what we return to the user with the is_yesno/is_onoff convertors
* Fix pylint 'Unnecessary pass statement'Cole Robinson2019-04-141-1/+0
|
* Remove Author lines from file headersCole Robinson2019-01-081-1/+0
| | | | | | | Similar to what was done in libvirt. See these commits: https://github.com/libvirt/libvirt/commit/600462834f4ec1955a9a48a1b6b4a390b9c31553 https://github.com/libvirt/libvirt/commit/c99e954973ea330e32e392c71ed17db5b359381b
* installer: Order install CDROM before any manual CDROMsCole Robinson2018-10-131-2/+7
| | | | | | | This is important for the virtio-win case: --cdrom media should always be ordered first, so it's the boot preference. https://www.redhat.com/archives/virt-tools-list/2018-September/msg00048.html
* pycodestyle: fix W605 invalid escape sequenceCole Robinson2018-09-291-1/+1
|
* xmlapi: Move namespace mappings to the relevant classesCole Robinson2018-09-131-0/+5
| | | | So we don't need to update xmlapi.py to account for additions
* xmlbuilder: Drop last usages of set_converterCole Robinson2018-09-041-13/+2
| | | | | Unfold most of them into manual property() wrappers. It's a bit noisier but the logic is easier to follow.
* xmlbuilder: Drop last remaining validate_cb usageCole Robinson2018-09-041-9/+4
| | | | Fold the interface bits into the existing validate() function
* xmlbuilder: Remove the default_cb and default_name logicCole Robinson2018-09-041-63/+9
| | | | | | It was always very hard to follow the logic chain with default_* settings, having it explicit in set_defaults() function calls is much easier to follow and more flexible for the future
* domain: features: Add set_defaultsCole Robinson2018-09-041-0/+8
| | | | | | | | And move all the Guest logic there. We need to add an xmlbuilder helper _prop_is_unset to be able to determine if a bool property is unset, in our quest to remove default_* xmlbuilder bits
* xmlbuilder: Rename get_xml_config -> get_xmlCole Robinson2018-08-311-5/+5
| | | | The config part is redundant. Should have done this a long time ago
* Fix copyright header to specify GPLv2 or later, not GPLv2 only.Daniel P. Berrangé2018-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | The copyright headers in every file were chjanged in this previous commit commit b6dcee8eb7ec4de999058c187162fe4aedef36b4 Author: Cole Robinson <crobinso@redhat.com> Date: Tue Mar 20 15:00:02 2018 -0400 Use consistent and minimal license header for every file Where before this they said " "either version 2 of the License, or (at your option) any later version." Now they just say "GNU GPLv2" This fixes it to say "GNU GPLv2 or later" again. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* domain: Drop most device list wrappersCole Robinson2018-03-211-0/+11
| | | | | | There's lots of hacks stuffed into the domain device lists. Formalize some of it, move some of the specific stuff to details.py, and drop a lot of the needless API wrappers
* xmlbuilder: Separate out the property cacheCole Robinson2018-03-211-73/+100
| | | | | Add a few more mappings to simplify certain lookups, and add some more validation to prevent programming errors
* virtinst: s/_XML_ROOT_NAME/XML_NAME/gCole Robinson2018-03-211-4/+4
| | | | No reason for it to be privatized, could be useful in some cases
* xmlbuilder: Remove relative_xpath substitution supportCole Robinson2018-03-211-15/+7
| | | | | This only has one user in interface.py. That case is indeed weird but we can implement it there, rather than in generic code
* xmlbuilder: Use OrderedDict for propstoreCole Robinson2018-03-211-11/+5
| | | | Let's us drop proporder
* cli: Have parser classes reference property names, not xmlbuildersCole Robinson2018-03-211-17/+0
| | | | | | propertys already give us ways to access the backing class, and switching to this method lets us drop some infrastructure in xmlbuilder
* xmlbuilder: Drop s/child_classes/child_class/Cole Robinson2018-03-211-41/+19
| | | | | The only user was Guest._devices hackery, which has been dropped, so clean up all this stuff
* Use consistent and minimal license header for every fileCole Robinson2018-03-211-14/+2
|
* virtinst: Give device classes consistent DeviceX namingCole Robinson2018-03-211-2/+2
| | | | | Previous state was inconsistenty and needlessly wordy. Fix up a few other class namings that have redundant Virtual in the name
* xmlbuilder: Move xml_indent to utilCole Robinson2018-03-201-15/+1
|
* tests: Add xmlns remove_child test caseCole Robinson2018-02-261-2/+2
| | | | And tighten up the xmlbuilder xmlns hackery
* xmlbuilder: Make sure split out XML has xmlns as neededCole Robinson2018-02-231-5/+9
| | | | Otherwise libxml2 whines
* virtinst: Drop doc= for propertiesCole Robinson2018-02-221-3/+1
| | | | | This data never gets to the user and largely is just duplicating libvirt docs. It's redundant
* xmlbuilder: Remove get_xml_config prep wrappersCole Robinson2018-02-221-36/+10
| | | | | The only user was Guest, and in fact it's not needed for the standard get_xml_config, only for the custom _get_install_xml. So drop it
* xmlbuilder: Order child props before serializingCole Robinson2018-02-201-1/+1
| | | | | We were implicitly depending on dict hash ordering here, which was causing some different XML output in centos CI
* xmlbuilder: Abstract libxml2 API and cleanupCole Robinson2018-02-201-447/+100
| | | | | | | | | | | Moves the libxml2 bits to a separate xmlapi file and class, a bunch of cleanups to xmlbuilder internals dealing with XML stuff. The main point is to experiment with different XML library impls, since libxml2 is unfun to deal with and we are having python3 issues like https://bugzilla.gnome.org/show_bug.cgi?id=776815
* xmlbuilder: Move xpath string ops to their own classCole Robinson2018-02-141-56/+69
| | | | This streamlines the actual libxml2 interaction quite a bit
* xmlbuilder: Move all libxml2 interaction to a single classCole Robinson2018-02-141-217/+235
| | | | Makes the boundaries clearer
* xmlbuilder: Remove more redundant xml stateCole Robinson2018-02-141-48/+24
| | | | | We don't need to carry around a separate xml_node. Dropping it simplifies a few things
* Convert docstrings to standard reStructuredText param formatCole Robinson2018-02-141-16/+14
|
* xmlbuilder: Remove unused codeCole Robinson2018-02-141-25/+0
|
* Don't use count() for substring checkingCole Robinson2018-02-141-4/+4
| | | | Use the idiomatic 'X in Y'
* xmlbuilder: centralize adding child new child prop instancesCole Robinson2018-02-081-1/+33
| | | | | | | | | | | | | | | | | | | Currently the domain CPU class has a child property like: siblings = XMLChildProperty(_CPUCellSibling) If a user wants to add a new sibling, we add a convenience function: def add_sibling(self): obj = _CPUCellSibling(self.conn) self.add_child(obj) return obj Rather than require every child property to define a similar matching helper function, this adds infrastructure in xmlbuilder to do this generically for every child property. Now callers can do obj = guest.cpu.siblings.add_new()