mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-03 01:17:56 +03:00
* Added info to client for managing new service form
This commit is contained in:
parent
c8f8ee054c
commit
6c7a5e8d58
@ -125,8 +125,8 @@ class Provider(ServiceProvider):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def test(env, data):
|
def test(env, data):
|
||||||
'''
|
'''
|
||||||
Create your test method here so the admin can push the "check" button
|
Test ovirt Connectivity
|
||||||
and this gets executed.
|
|
||||||
Args:
|
Args:
|
||||||
env: environment passed for testing (temporal environment passed)
|
env: environment passed for testing (temporal environment passed)
|
||||||
|
|
||||||
@ -138,11 +138,6 @@ class Provider(ServiceProvider):
|
|||||||
(True is all right, false is error),
|
(True is all right, false is error),
|
||||||
second is an String with error, preferably internacionalizated..
|
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:
|
#try:
|
||||||
# # We instantiate the provider, but this may fail...
|
# # We instantiate the provider, but this may fail...
|
||||||
|
@ -172,9 +172,17 @@ class Client(object):
|
|||||||
A dictionary with following values
|
A dictionary with following values
|
||||||
'name'
|
'name'
|
||||||
'id'
|
'id'
|
||||||
'storage_type'
|
'storage_type' -> ('isisi', 'nfs', ....)
|
||||||
'storage_format'
|
'storage_format' -> ('v1', v2')
|
||||||
'description'
|
'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)
|
dcKey = self.__getKey('o-dc'+datacenterId)
|
||||||
val = self._cache.get(dcKey)
|
val = self._cache.get(dcKey)
|
||||||
@ -188,9 +196,21 @@ class Client(object):
|
|||||||
api = self.__getApi()
|
api = self.__getApi()
|
||||||
|
|
||||||
d = api.datacenters.get(id=datacenterId)
|
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(),
|
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)
|
self._cache.put(dcKey, res, Client.CACHE_TIME_HIGH)
|
||||||
|
return res
|
||||||
|
except Exception as e:
|
||||||
|
print e
|
||||||
finally:
|
finally:
|
||||||
lock.release()
|
lock.release()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user