swevm / scaleio-py

ScaleIO API Bindings
Apache License 2.0
13 stars 14 forks source link

api versions compatibility #34

Open suslikas opened 8 years ago

suslikas commented 8 years ago

Hi,

I try to use you code to make monitoring for ScaleIO API version 2.0 cluster and find big problems in code constructions and implementation. You miss flexibility and make very hard implementation for switching between API versions.

Example:

    def __init__(self,
        id=None,
        name=None,
        systemVersionName=None,
        primaryMdmActorIpList = None, #List
        primaryMdmActorPort = None,
        secondaryMdmActorIpList = None, #List
        secondaryMdmActorPort = None,.
        tiebreakerMdmIpList = None,  #List
        tiebreakerMdmPort = None, # This one is defined in ScaleIO 1.30 API, but seem not present in 1.31??
        tiebreakerMdmActorPort = None,
        mdmMode = None, #Single or Cluster
        mdmClusterState = None, # NotClustered or ClusteredNormal or ClusteredDegraded or ClusteredTiebreakerDown or ClusteredDegradedTiebreakerDown
        mdmManagementIpList = None, # List
        mdmManagementPort = None,.
        capacityAlertHighThresholdPercent = None,
        capacityAlertCriticalThresholdPercent = None,
        installId = None,.
        swid = None, # This one seem not to return anything. Its define din 1.30. What about 1.31????
        daysInstalled = None,.
        maxCapacityInGb = None,
        capacityTimeLeftInDays = None,.
        enterpriseFeaturesEnabled = None,.
        defaultIsVolumeObfuscated = None,
        isInitialLicense = None,.
        restrictedSdcModeEnabled = None,
        remoteReadOnlyLimitState = None,
        links = None,

You define all, nice, but we got more variables in new API version

        sdcSocketAllocationFailuresCounterParameters = None,
        cliPasswordAllowed = None,
        authenticationMethod = None,
        performanceParameters = None,
        sdcLongOperationsCounterParameters = None,
        sdcMdmNetworkDisconnectionsCounterParameters = None,
        managementClientSecureCommunicationEnabled = None,
        mdmToSdsPolicy = None,
        tlsVersion = None,
        currentProfilePerformanceParameters = None,
        mdmCluster = None,
        sdcMemoryAllocationFailuresCounterParameters = None,
        upgradeState = None,
        showGuid = None,
        sdcSdsNetworkDisconnectionsCounterParameters = None

In version 2.1 we can get on top +1, then +1.... and you always must add new..., better to implement exclusions and dynamically and recursive read all what you get from API. In this way you will need just create functions wrappers who adopt calls to oldest api version if some value are deprecated or renamed...