⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 04_security-acm_dom_res.py

📁 xen虚拟机源代码安装包
💻 PY
字号:
#!/usr/bin/python# Copyright (C) International Business Machines Corp., 2006# Author: Stefan Berger <stefanb@us.ibm.com>## Simple test that starts two labeled domains using labeled resources each#from XmTestLib import *from acm_utils import *import commandsimport ostestlabel1 = "green"resource1  = "phy:ram0"testlabel2 = "red"resource2  = "phy:/dev/ram1"config = {"access_control":"policy=%s,label=%s" % (testpolicy,testlabel1),          "disk"          :"%s,hda1,w" % (resource1)}domain1 = XmTestDomain(name="domain-%s" % testlabel1,                       extraConfig=config)# Explicity label the resourceACMLabelResource(resource1, testlabel1)try:    domain1.start(noConsole=True)except DomainError, e:    if verbose:        print e.extra    FAIL("Unable to start 1st labeled test domain.")# Verify with xm dry-runstatus, output = traceCommand("xm dry-run /tmp/xm-test.conf | "                              "grep -v \"Dry Run\"")if status != 0:    FAIL("'xm dry-run' failed")if not re.search("%s: PERMITTED" % resource1, output):    FAIL("'xm dry-run' did not succeed.")config = {"access_control":"policy=%s,label=%s" % (testpolicy,testlabel2),          "disk"          :"%s,hda1,w" % (resource2)}domain2 = XmTestDomain(name="domain-%s" % testlabel2,                       extraConfig=config)# Explicity label the resourceACMLabelResource(resource2, testlabel2)try:    domain2.start(noConsole=True)except DomainError, e:    if verbose:        print e.extra    FAIL("Unable to start 2nd labeled test domain.")# Verify with xm dry-runstatus, output = traceCommand("xm dry-run /tmp/xm-test.conf | "                              "grep -v \"Dry Run\"")if status != 0:    FAIL("'xm dry-run' failed")if not re.search("%s: PERMITTED" % resource2, output):    FAIL("'xm dry-run' did not succeed.")domain2.destroy()domain1.destroy()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -