[ovirt-users] Missing feature in python SDK4

Juan Hernández jhernand at redhat.com
Thu Apr 20 14:35:54 UTC 2017


On 04/20/2017 12:26 PM, Fabrice Bacchella wrote:
> I didn't find a way to find the writer that correspond to a given type. Is there a way to do that, or it's up to the end user to manually manage this mapping ?
> 

Yes that is missing. We have it for reading, but not for writing. This
patch should address that:

  Add generic writer
  https://gerrit.ovirt.org/75699

Please open a bug so that we can decide what version should contain this
fix.

Note that you should try to avoid using directly the writer/reader
classes, as they are an internal implementation detail and may change in
the future. The contract for reading/writing is using the Reader and
Writer classes. For example, to generate the XML for an object (once the
patch is merged):

  from ovirtsdk4 import types
  from ovirtsdk4 import writer
  from ovirtsdk4 import writers

  vm = types.Vm(
    id="123",
    name="myvm",
    ...
  )

  xml = writer.Writer.write(vm)

  print(xml)


More information about the Users mailing list