summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/xenserver/xenapi/contrib/rpmbuild/SPECS/openstack-xen-plugins.spec1
-rwxr-xr-xplugins/xenserver/xenapi/etc/xapi.d/plugins/config_file19
2 files changed, 20 insertions, 0 deletions
diff --git a/plugins/xenserver/xenapi/contrib/rpmbuild/SPECS/openstack-xen-plugins.spec b/plugins/xenserver/xenapi/contrib/rpmbuild/SPECS/openstack-xen-plugins.spec
index 66c13967e..b93c7b071 100644
--- a/plugins/xenserver/xenapi/contrib/rpmbuild/SPECS/openstack-xen-plugins.spec
+++ b/plugins/xenserver/xenapi/contrib/rpmbuild/SPECS/openstack-xen-plugins.spec
@@ -31,6 +31,7 @@ rm -rf $RPM_BUILD_ROOT
/etc/xapi.d/plugins/agent
/etc/xapi.d/plugins/bandwidth
/etc/xapi.d/plugins/bittorrent
+/etc/xapi.d/plugins/config_file
/etc/xapi.d/plugins/glance
/etc/xapi.d/plugins/kernel
/etc/xapi.d/plugins/migration
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/config_file b/plugins/xenserver/xenapi/etc/xapi.d/plugins/config_file
new file mode 100755
index 000000000..417c477b4
--- /dev/null
+++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/config_file
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+import XenAPIPlugin
+
+
+def get_val(session, args):
+ config_key = args['key']
+ config_file = open('/etc/xapi.conf')
+ try:
+ for line in config_file:
+ split = line.split('=')
+ if (len(split) == 2) and (split[0].strip() == config_key):
+ return split[1].strip()
+ return ""
+ finally:
+ config_file.close()
+
+if __name__ == '__main__':
+ XenAPIPlugin.dispatch({"get_val": get_val})