
On Mon, Jun 11, 2018 at 10:47 PM, Dan Kenigsberg <danken@redhat.com> wrote:
On Mon, Jun 11, 2018 at 1:26 PM, Nir Soffer <nsoffer@redhat.com> wrote:
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.
... which brings up the question: why do you need to access it Germano?
Just sending a simple change to the sos plugin, and I need to pass a constant. https://gerrit.ovirt.org/#/c/92153/
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.
Hi Nir, thanks for helping. Well, the value is part of the schema AFAICS. Maybe I'm doing something wrong, but this is what I get: 1. I want to set domainClass on a getStorageDomains() call. # vdsm-client Host getStorageDomains -h usage: vdsm-client Host getStorageDomains [-h] [arg=value [arg=value ...]] positional arguments: arg=value storageType: Limit to Domains of this StorageDomainType storagepoolID: Limit to Domains belonging to this Storage Pool remotePath: Limit to Domains having this remotePath. domainClass: Limit to Domains of this StorageDomainImageClass <--------------- JSON representation: { "storageType": { "StorageDomainType": "enum ['FCP', 'CIFS', 'UNKNOWN', 'ISCSI', 'GLUSTERFS', 'LOCALFS', 'NFS', 'SHAREDFS']" }, "storagepoolID": { "UUID": "UUID" }, "remotePath": "string", "domainClass": { "StorageDomainImageClass": "enum ['Iso', 'Data', 'Backup', 'Unknown']" } } This is its type: StorageDomainImageClass: &StorageDomainImageClass added: '3.1' description: An enumeration of Storage Domain classes. name: StorageDomainImageClass type: enum values: Backup: The Storage Domain is used for import and export of disk images Data: The Storage Domain is used for virtual machine disk images Iso: The Storage Domain is used for storing ISO images Unknown: The class is not known But if I do this (or in sos.py) # vdsm-client Host getStorageDomains domainClass=Data Then the "Data" parameter ends up a unicode 'Data' and the comparison to the actual integer constant (1=DATA_DOMAIN) returns False, giving me no storage domains at all: 2018-06-12 13:58:31,266+1000 INFO (jsonrpc/5) [vdsm.api] START getStorageDomainsList(spUUID=None, domainClass=u'Data', storageType=None, remotePath=None, options=None) from=::1,60192, task_id=be93ee8d-d4d4-42c2-a292-9aeadf88e3da (api:46) 2018-06-12 13:58:31,608+1000 INFO (jsonrpc/5) [vdsm.api] FINISH getStorageDomainsList return={'domlist': []} from=::1,60192, task_id=be93ee8d-d4d4-42c2-a292-9aeadf88e3da (api:52) That is why I'm trying to import the constant from the API. Am I missing something? Is there a special way to use these values defined by enums?
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/
_______________________________________________ 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/ WXY2PKBB2XUKLCREUITVORP3WZD5VTPT/