Advertisement
adhioutlined

XENSERVER-CONFIG_myLiberty_XSNEUTRON

Sep 20th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.44 KB | None | 0 0
  1. XENSERVER
  2. ================================================
  3. nova_plugin_version
  4. ================================================
  5. #!/usr/bin/env python
  6.  
  7. # Copyright (c) 2013 OpenStack Foundation
  8. # Copyright (c) 2013 Citrix Systems, Inc.
  9. #
  10. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  11. # not use this file except in compliance with the License. You may obtain
  12. # a copy of the License at
  13. #
  14. # http://www.apache.org/licenses/LICENSE-2.0
  15. #
  16. # Unless required by applicable law or agreed to in writing, software
  17. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  18. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  19. # License for the specific language governing permissions and limitations
  20. # under the License.
  21.  
  22. # NOTE: XenServer still only supports Python 2.4 in it's dom0 userspace
  23. # which means the Nova xenapi plugins must use only Python 2.4 features
  24.  
  25. """Returns the version of the nova plugins"""
  26.  
  27. import utils
  28.  
  29. # MAJOR VERSION: Incompatible changes
  30. # MINOR VERSION: Compatible changes, new plugins, etc
  31.  
  32. # 1.0 - Initial version.
  33. # 1.1 - New call to check GC status
  34. # 1.2 - Added support for pci passthrough devices
  35. # 1.3 - Add vhd2 functions for doing glance operations by url
  36. # 1.4 - Add support of Glance v2 api
  37. # 1.5 - Added function for network configuration on ovs bridge
  38. # 1.6 - Add function for network configuration on Linux bridge
  39. # 1.7 - Add Partition utilities plugin
  40. PLUGIN_VERSION = "1.7"
  41.  
  42.  
  43. def get_version(session):
  44. return PLUGIN_VERSION
  45.  
  46. if __name__ == '__main__':
  47. utils.register_plugin_calls(get_version)
  48. [root@vagxen2-srg plugins]# cat nova_plugin_version | egrep -v "(^#.*|^$)"
  49. """Returns the version of the nova plugins"""
  50. import utils
  51. PLUGIN_VERSION = "1.7"
  52. def get_version(session):
  53. return PLUGIN_VERSION
  54. if __name__ == '__main__':
  55. utils.register_plugin_calls(get_version)
  56. [root@vagxen2-srg plugins]# cat nova_plugin_version | egrep -v "(^#.*|^$)"
  57. """Returns the version of the nova plugins"""
  58. import utils
  59. PLUGIN_VERSION = "1.7"
  60. def get_version(session):
  61. return PLUGIN_VERSION
  62. if __name__ == '__main__':
  63. utils.register_plugin_calls(get_version)
  64.  
  65. ================================================
  66.  
  67.  
  68.  
  69. ================================================
  70. netwrap
  71. ================================================
  72. import gettext
  73. gettext.install('neutron', unicode=1)
  74. try:
  75. import json
  76. except ImportError:
  77. import simplejson as json
  78. import subprocess
  79. import XenAPIPlugin
  80. ALLOWED_CMDS = [
  81. 'ipset', 'iptables-save', 'iptables-restore', 'ip6tables-save', 'ip6tables-restore',
  82. 'ip',
  83. # NOTE(yamamoto): of_interface=native doesn't use ovs-ofctl
  84. 'ovs-ofctl',
  85. 'ovs-vsctl',
  86. 'ovsdb-client',
  87. 'sysctl',
  88. 'conntrack',
  89. ]
  90. class PluginError(Exception):
  91. """Base Exception class for all plugin errors."""
  92. def __init__(self, *args):
  93. Exception.__init__(self, *args)
  94. def _run_command(cmd, cmd_input):
  95. """Abstracts out the basics of issuing system commands. If the command
  96. returns anything in stderr, a PluginError is raised with that information.
  97. Otherwise, the output from stdout is returned.
  98. """
  99. pipe = subprocess.PIPE
  100. proc = subprocess.Popen(cmd, shell=False, stdin=pipe, stdout=pipe,
  101. stderr=pipe, close_fds=True)
  102. (out, err) = proc.communicate(cmd_input)
  103. if err:
  104. raise PluginError(err)
  105. return out
  106. def run_command(session, args):
  107. cmd = json.loads(args.get('cmd'))
  108. if cmd and cmd[0] not in ALLOWED_CMDS:
  109. msg = _("Dom0 execution of '%s' is not permitted") % cmd[0]
  110. raise PluginError(msg)
  111. result = _run_command(cmd, json.loads(args.get('cmd_input', 'null')))
  112. return json.dumps(result)
  113. if __name__ == "__main__":
  114. XenAPIPlugin.dispatch({"run_command": run_command})
  115. ================================================
  116.  
  117.  
  118. ================================================
  119. sysctl.conf
  120. ================================================
  121. # System default settings live in /usr/lib/sysctl.d/00-system.conf.
  122. # To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
  123. #
  124. # For more information, see sysctl.conf(5) and sysctl.d(5).
  125. net.ipv4.conf.all.rp_filter=0
  126. net.ipv4.conf.default.rp_filter=0
  127. net.bridge.bridge-nf-call-iptables=1
  128. net.bridge.bridge-nf-call-ip6tables=1
  129. ================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement