On Mon, Jun 11, 2018 at 9:59 AM Germano Veit Michel <germano@redhat.com> wrote:
Hi,

I'm finding a bit confusing what is the correct way to import VDSM types/enums/contants when using the VDSM API.

For example, vdsmapi tests and the hosted-engine-ha daemons seem to use a bunch of values defined in constants or hardcoded, not really doing an import for this. i.e.:
ovirt_hosted_engine_ha/env/constants.py.in:66:STORAGE_TYPE_NFS = 1

I don't want to do this:
getStorageDomains(storageType=1)

If I want to avoid hard-coding constants on my program, what is the correct way to do it? Like this?

import vdsm.storage.sd
getStorageDomains(storageType=sd.NFS_DOMAIN)

Problem is vdsm.storage.sd does not seem to be part of the public API, clients shouldn't be seeing all that.

Correct, the constants are not part of the API, because vdsm API is
generally not a public supported API. So in your current scripts you need to 
hard code these values.

Can you file a bug to add the missing constants to the api?

I think all the values should be in the schema, and they should be
accessible via the vdsmclient package.

Nir
 

Hopefully there is an easy answer I am missing. I'm looking for something similar to ovirtsdk4.types.

Thanks,
Germano


_______________________________________________
Devel mailing list -- devel@ovirt.org
To unsubscribe send an email to devel-leave@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/
List Archives: https://lists.ovirt.org/archives/list/devel@ovirt.org/message/JGIW7MS6MPUM6YLINPMJ3JLVBKPXQK7A/