diff --git a/server/src/uds/services/OVirt/OVirtProvider.py b/server/src/uds/services/OVirt/OVirtProvider.py index eabd5d3c..35834647 100644 --- a/server/src/uds/services/OVirt/OVirtProvider.py +++ b/server/src/uds/services/OVirt/OVirtProvider.py @@ -125,8 +125,8 @@ class Provider(ServiceProvider): @staticmethod def test(env, data): ''' - Create your test method here so the admin can push the "check" button - and this gets executed. + Test ovirt Connectivity + Args: env: environment passed for testing (temporal environment passed) @@ -138,11 +138,6 @@ class Provider(ServiceProvider): (True is all right, false is error), second is an String with error, preferably internacionalizated.. - In this case, wi well do nothing more that use the provider params - - Note also that this is an static method, that will be invoked using - the admin user provided data via administration client, and a temporary - environment that will be erased after invoking this method ''' #try: # # We instantiate the provider, but this may fail... diff --git a/server/src/uds/services/OVirt/client/oVirtClient.py b/server/src/uds/services/OVirt/client/oVirtClient.py index 819ec49b..64aab8f6 100644 --- a/server/src/uds/services/OVirt/client/oVirtClient.py +++ b/server/src/uds/services/OVirt/client/oVirtClient.py @@ -172,9 +172,17 @@ class Client(object): A dictionary with following values 'name' 'id' - 'storage_type' - 'storage_format' + 'storage_type' -> ('isisi', 'nfs', ....) + 'storage_format' -> ('v1', v2') 'description' + 'storage' -> array of dictionaries, with: + 'id' -> Storage id + 'name' -> Storage name + 'type' -> Storage type ('data', 'iso') + 'available' -> Space available, in bytes + 'used' -> Space used, in bytes + 'active' -> True or False + ''' dcKey = self.__getKey('o-dc'+datacenterId) val = self._cache.get(dcKey) @@ -188,9 +196,21 @@ class Client(object): api = self.__getApi() d = api.datacenters.get(id=datacenterId) + storage = [] + for dd in d.storagedomains.list(): + storage.append( { 'id' : dd.get_id(), 'name' : dd.get_name(), 'type' : dd.get_type(), + 'available' : dd.get_available(), 'used' : dd.get_used(), + 'active' : dd.get_status().get_state() == 'active' } ) + + res = { 'name' : d.get_name(), 'id' : d.get_id(), 'storage_type' : d.get_storage_type(), - 'storage_format' : d.get_storage_format(), 'description' : d.get_description() } + 'storage_format' : d.get_storage_format(), 'description' : d.get_description(), + 'storage' : storage } + self._cache.put(dcKey, res, Client.CACHE_TIME_HIGH) + return res + except Exception as e: + print e finally: lock.release()