from xen.xend import XendAPIConstants import xen.util.xsm.xsm as security from xen.util import acmpolicy, xsconstants from xen.util.acmpolicy import ACMPolicy from xen.xend.XendDomain import DOM0_UUID from XmTestLib.acm import * import commands import os import base64 if not isACMEnabled(): SKIP("Not running this test since ACM not enabled.") try: session = xapi.connect() except: SKIP("Skipping this test since xm is not using the Xen-API.") xm_test = {} xm_test['policyname'] = "xm-test" xm_test['date'] = "Fri Sep 29 14:44:38 2006" xm_test['url'] = None vm_label_red = "%s:xm-test:red" % xsconstants.ACM_POLICY_ID vm_label_green = "%s:xm-test:green" % xsconstants.ACM_POLICY_ID vm_label_blue = "%s:xm-test:blue" % xsconstants.ACM_POLICY_ID vm_label_sys = "%s:xm-test:SystemManagement" % xsconstants.ACM_POLICY_ID vm_label_black = "%s:xm-test:black"
from XmTestLib import xapi from XmTestLib.XenAPIDomain import XmTestAPIDomain from XmTestLib import * from xen.xend import XendAPIConstants import commands import os try: # XmTestAPIDomain tries to establish a connection to XenD domain = XmTestAPIDomain() except Exception, e: SKIP("Skipping test. Error: %s" % str(e)) vm_uuid = domain.get_uuid() session = xapi.connect() domain.start(startpaused=True) res = session.xenapi.VM.get_power_state(vm_uuid) if res != XendAPIConstants.XEN_API_VM_POWER_STATE[XendAPIConstants.XEN_API_VM_POWER_STATE_PAUSED]: FAIL("VM was not started in 'paused' state") res = session.xenapi.VM.unpause(vm_uuid) res = session.xenapi.VM.get_power_state(vm_uuid) if res != XendAPIConstants.XEN_API_VM_POWER_STATE[XendAPIConstants.XEN_API_VM_POWER_STATE_RUNNING]: FAIL("VM could not be put into 'running' state")