From: Stefan Berger Subject: [PATCH] [Xend/Xm/ACM] [1/2] Implement legacy XML-RPC interface for ACM commands Date: Mon, 03 Dec 2007 07:14:26 -0500 Message-ID: <1196684067.11145.16.camel@941e-2.watson.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-LgWysZmiJ/7hKTFNNJdo" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org --=-LgWysZmiJ/7hKTFNNJdo Content-Type: text/plain Content-Transfer-Encoding: 7bit This patch implements a (non Xen-API) legacy XML-RPC interface for the ACM commands and funnels the calls into code introduced by the Xen-API support for ACM security management. Since some of the functionality has changed, also the xm applications have changed. In particular the following old commands have been removed along with some tools the have become obsolete now: - loadpolicy (included in: setpolicy) - makepolicy (included in: setpolicy) - cfgbootpolicy (included in: setpolicy) and the following commands been introduced: - setpolicy - getpolicy - resetpolicy All tools have been adapted to work in Xen-API and legacy XML-RPC mode. Both modes support the same functionality. An update to the documentation will follow as well as new test cases. I have run this and the 2nd patch with the xm-test suite on the tip of the staging tree and they caused no regressions. Signed-off-by: Stefan Berger --=-LgWysZmiJ/7hKTFNNJdo Content-Disposition: attachment; filename=security_commands_through_xend.diff Content-Type: text/x-vhdl; name=security_commands_through_xend.diff; charset=utf-8 Content-Transfer-Encoding: 7bit --- xen-unstable.hg/docs/man/xm.pod.1 | 61 xen-unstable.hg/tools/python/xen/util/acmpolicy.py | 30 xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py | 319 +- xen-unstable.hg/tools/python/xen/util/xsm/dummy/dummy.py | 66 xen-unstable.hg/tools/python/xen/util/xsm/flask/flask.py | 3 xen-unstable.hg/tools/python/xen/xend/XendConfig.py | 23 xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py | 16 xen-unstable.hg/tools/python/xen/xend/XendXSPolicyAdmin.py | 12 xen-unstable.hg/tools/python/xen/xend/server/XMLRPCServer.py | 6 xen-unstable.hg/tools/python/xen/xm/activatepolicy.py | 111 xen-unstable.hg/tools/python/xen/xm/addlabel.py | 112 xen-unstable.hg/tools/python/xen/xm/cfgbootpolicy.py | 227 - xen-unstable.hg/tools/python/xen/xm/create.py | 124 xen-unstable.hg/tools/python/xen/xm/dry-run.py | 107 xen-unstable.hg/tools/python/xen/xm/getlabel.py | 62 xen-unstable.hg/tools/python/xen/xm/getpolicy.py | 101 xen-unstable.hg/tools/python/xen/xm/labels.py | 34 xen-unstable.hg/tools/python/xen/xm/loadpolicy.py | 70 xen-unstable.hg/tools/python/xen/xm/main.py | 33 xen-unstable.hg/tools/python/xen/xm/makepolicy.py | 51 xen-unstable.hg/tools/python/xen/xm/resetpolicy.py | 162 + xen-unstable.hg/tools/python/xen/xm/resources.py | 8 xen-unstable.hg/tools/python/xen/xm/rmlabel.py | 94 xen-unstable.hg/tools/python/xen/xm/setpolicy.py | 176 - xen-unstable.hg/tools/security/Makefile | 9 xen-unstable.hg/tools/security/policies/example/client_v1-security_policy.xml | 4 xen-unstable.hg/tools/security/policies/example/ste/client_v1-security_policy.xml | 149 - xen-unstable.hg/tools/security/secpol_xml2bin.c | 1457 ---------- xen-unstable.hg/tools/security/secpol_xml2bin.h | 166 - xen-unstable.hg/tools/xm-test/lib/XmTestLib/acm.py | 58 xen-unstable.hg/tools/xm-test/tests/security-acm/01_security-acm_basic.py | 6 xen-unstable.hg/tools/xm-test/tests/security-acm/acm_utils.py | 2 32 files changed, 1000 insertions(+), 2859 deletions(-) Index: root/xen-unstable.hg/tools/python/xen/xend/server/XMLRPCServer.py =================================================================== --- root.orig/xen-unstable.hg/tools/python/xen/xend/server/XMLRPCServer.py +++ root/xen-unstable.hg/tools/python/xen/xend/server/XMLRPCServer.py @@ -207,6 +207,12 @@ class XMLRPCServer: self.server.register_function(domain_create, 'xend.domain.create') self.server.register_function(domain_restore, 'xend.domain.restore') + # A couple of the security functions + from xen.util.xsm import xsm as security + for name in security.xmlrpc_exports: + fn = getattr(security, name) + self.server.register_function(fn, "xend.security.%s" % name) + self.server.register_introspection_functions() self.ready = True Index: root/xen-unstable.hg/tools/python/xen/xm/addlabel.py =================================================================== --- root.orig/xen-unstable.hg/tools/python/xen/xm/addlabel.py +++ root/xen-unstable.hg/tools/python/xen/xm/addlabel.py @@ -22,7 +22,6 @@ import os import sys -from xen.util import dictio import xen.util.xsm.xsm as security from xen.xm.opts import OptionError from xen.util import xsconstants @@ -37,14 +36,12 @@ def help(): xm addlabel