Change in vdsm[master]: vdsmapi: vdsmapi support for gluster vdsm verbs
avishwan at redhat.com
avishwan at redhat.com
Mon Apr 15 10:42:01 UTC 2013
Aravinda VK has uploaded a new change for review.
Change subject: vdsmapi: vdsmapi support for gluster vdsm verbs
......................................................................
vdsmapi: vdsmapi support for gluster vdsm verbs
Reads vdsmapi-gluster-schema.json from gluster directory if
vdsm-gluster is installed.
Change-Id: Id10b51a41d103afcf81cb76c460f3b9821238317
Signed-off-by: Aravinda VK <avishwan at redhat.com>
---
M vdsm.spec.in
M vdsm/gluster/Makefile.am
A vdsm/gluster/vdsmapi-gluster-schema.json
M vdsm_api/vdsmapi.py
4 files changed, 27 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/13921/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 658de19..4f26c94 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -1160,6 +1160,7 @@
%dir %{_datadir}/%{vdsm_name}/gluster
%doc COPYING
%{_datadir}/%{vdsm_name}/gluster/api.py*
+%{_datadir}/%{vdsm_name}/gluster/vdsmapi-gluster-schema.json
%endif
%changelog
diff --git a/vdsm/gluster/Makefile.am b/vdsm/gluster/Makefile.am
index abecfff..2dd3933 100644
--- a/vdsm/gluster/Makefile.am
+++ b/vdsm/gluster/Makefile.am
@@ -27,3 +27,7 @@
cli.py \
exception.py \
hostname.py
+
+dist_vdsmgluster_DATA = \
+ vdsmapi-gluster-schema.json \
+ $(NULL)
diff --git a/vdsm/gluster/vdsmapi-gluster-schema.json b/vdsm/gluster/vdsmapi-gluster-schema.json
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/vdsm/gluster/vdsmapi-gluster-schema.json
diff --git a/vdsm_api/vdsmapi.py b/vdsm_api/vdsmapi.py
index f154e99..7c190a3 100644
--- a/vdsm_api/vdsmapi.py
+++ b/vdsm_api/vdsmapi.py
@@ -127,6 +127,19 @@
localpath, installedpath)
+def find_gluster_schema():
+ """
+ Find the API schema file in gluster dir
+ from an installed location
+ """
+ installedpath = os.path.join(constants.P_VDSM, 'gluster')
+ path = os.path.join(installedpath, 'vdsmapi-gluster-schema.json')
+ if os.access(path, os.R_OK):
+ return path
+ else:
+ return None
+
+
_api_info = None
@@ -177,13 +190,22 @@
to which the source type may be cast.
"""
global _api_info
+ gluster_schema = None
info_key = schema
if schema is None:
schema = find_schema()
+ gluster_schema = find_gluster_schema()
+
with open(schema) as f:
symbols = parse_schema(f)
+ # If gluster schema file present inside gluster directory then read and
+ # parse, append to symbols
+ if gluster_schema:
+ with open(gluster_schema) as f:
+ symbols += parse_schema(f)
+
info = {'types': {}, 'enums': {}, 'aliases': {}, 'maps': {},
'commands': {}, 'unions': {}}
--
To view, visit http://gerrit.ovirt.org/13921
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id10b51a41d103afcf81cb76c460f3b9821238317
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Aravinda VK <avishwan at redhat.com>
More information about the vdsm-patches
mailing list