import yaml
+@xenrt.irregularName
class xst(object):
def __init__(self, host, name):
self.host = host
def path(self, f):
return "/sys/kernel/debug/xst/%s/%s" % (self.name, f)
+ @xenrt.irregularName
def set_params(self, params):
for p in params:
self.host.execdom0("echo %d > %s" % (p[1], self.path(p[0])))
+import xenrt
from zope.interface import Interface, Attribute
__all__=["Toolstack", "OSParent", "OS", "InstallMethodPV", "InstallMethodIso", "InstallMethodIsoWithAnswerFile"]
_osParent_hypervisorType = Attribute("Hypervisor (or native) on which the OS is running")
+ @xenrt.irregularName
def _osParent_getIP(trafficType, timeout, level):
"""Get the IP for the OS"""
+ @xenrt.irregularName
def _osParent_getPort(trafficType):
"""Get the port for the traffic type"""
+ @xenrt.irregularName
def _osParent_setIP(ip):
"""Set the IP for the OS"""
+ @xenrt.irregularName
def _osParent_start():
"""Start the OS container (VM/host)"""
+ @xenrt.irregularName
def _osParent_stop():
"""Stop the OS container (VM/host)"""
+ @xenrt.irregularName
def _osParent_ejectIso():
"""Eject the ISO from the OS container"""
+ @xenrt.irregularName
def _osParent_setIso(isoName, isoRepo):
"""Set the ISO to the specified iso"""
+ @xenrt.irregularName
def _osParent_pollPowerState(state, timeout, level, pollperiod):
"""Poll for a change in power state"""
+ @xenrt.irregularName
def _osParent_getPowerState():
"""Get the current power state"""
self.special = {}
@property
+ @xenrt.irregularName
def _osParent_name(self):
return self.name
@property
+ @xenrt.irregularName
def _osParent_hypervisorType(self):
return self.toolstack.instanceHypervisorType(self)
self.toolstack.discoverInstanceAdvancedNetworking(self)
self.os.populateFromExisting()
+ @xenrt.irregularName
def _osParent_pollPowerState(self, state, timeout=600, level=xenrt.RC_FAIL, pollperiod=15):
"""Poll for reaching the specified state"""
deadline = xenrt.timenow() + timeout
(self.name, state), level)
xenrt.sleep(15, log=False)
+ @xenrt.irregularName
def _osParent_getPort(self, trafficType):
if self.inboundmap.has_key(trafficType):
return self.inboundmap[trafficType][1]
else:
return self.os.tcpCommunicationPorts[trafficType]
+ @xenrt.irregularName
def _osParent_getIP(self, trafficType=None, timeout=600, level=xenrt.RC_ERROR):
if trafficType:
if trafficType == "OUTBOUND":
return self.mainip
return self.toolstack.getInstanceIP(self, timeout, level)
+ @xenrt.irregularName
def _osParent_setIP(self, ip):
raise xenrt.XRTError("Not implemented")
+ @xenrt.irregularName
def _osParent_start(self):
self.toolstackStart()
+ @xenrt.irregularName
def _osParent_stop(self):
self.stop()
def getPowerState(self):
return self.toolstack.getInstancePowerState(self)
+ @xenrt.irregularName
def _osParent_getPowerState(self):
return self.getPowerState()
+ @xenrt.irregularName
def _osParent_setIso(self, isoName, isoRepo=None):
return self.setIso(isoName, isoRepo)
def setIso(self, isoName, isoRepo=None):
return self.toolstack.setInstanceIso(self, isoName, isoRepo)
+ @xenrt.irregularName
def _osParent_ejectIso(self):
return self.ejectIso()
self.os = xenrt.lib.opsys.osFactory(self.distro, self)
@property
+ @xenrt.irregularName
def _osParent_name(self):
return "Static-%s" % self.mainip
@property
+ @xenrt.irregularName
def _osParent_hypervisorType(self):
return None
+ @xenrt.irregularName
def _osParent_pollPowerState(self, state, timeout=600, level=xenrt.RC_FAIL, pollperiod=15):
"""Poll for reaching the specified state"""
raise xenrt.XRTError("Not supported")
+ @xenrt.irregularName
def _osParent_getIP(self, trafficType=None, timeout=600, level=xenrt.RC_ERROR):
return self.mainip
+ @xenrt.irregularName
def _osParent_getPort(self, trafficType):
return None
+ @xenrt.irregularName
def _osParent_getPowerState(self):
raise xenrt.XRTError("Not implemented")
+ @xenrt.irregularName
def _osParent_setIP(self, ip):
raise xenrt.XRTError("Not implemented")
+ @xenrt.irregularName
def _osParent_start(self):
raise xenrt.XRTError("Not implemented")
+ @xenrt.irregularName
def _osParent_stop(self):
raise xenrt.XRTError("Not implemented")
+ @xenrt.irregularName
def _osParent_setIso(self, isoName, isoRepo=None):
raise xenrt.XRTError("Not implemented")
+ @xenrt.irregularName
def _osParent_ejectIso(self):
raise xenrt.XRTError("Not implemented")
self.memory = None # Default to template memory.
self.vcpus = None # Default to template vcpus.
+ @xenrt.irregularName
def _osParent_ejectIso(self):
self.changeCD(None)
+ @xenrt.irregularName
def _osParent_setIso(self, isoName, isoRepo=None):
self.changeCD(isoName)
##### Methods from OSParent #####
@property
+ @xenrt.irregularName
def _osParent_name(self):
return self.getName()
@property
+ @xenrt.irregularName
def _osParent_hypervisorType(self):
# This refers to the Hypervisor type of the control domain, which for most purposes can assumed to be Native
return xenrt.HypervisorType.native
+ @xenrt.irregularName
def _osParent_getIP(self, trafficType=None, timeout=600, level=xenrt.RC_ERROR):
if self.machine and self.use_ipv6:
return self.machine.ipaddr6
return self.machine.ipaddr
return None
+ @xenrt.irregularName
def _osParent_getPort(self, trafficType):
return None
+ @xenrt.irregularName
def _osParent_setIP(self,ip):
if self.machine:
obj = IPy.IP(ip)
else:
raise xenrt.XRTError("No host Object Found")
+ @xenrt.irregularName
def _osParent_start(self):
self.machine.powerctl.on()
+ @xenrt.irregularName
def _osParent_stop(self):
self.machine.powerctl.off()
+ @xenrt.irregularName
def _osParent_ejectIso(self):
# TODO implement this with Virtual Media
raise xenrt.XRTError("Not implemented")
+ @xenrt.irregularName
def _osParent_setIso(self, isoName, isoRepo=None):
# TODO implement this with Virtual Media
raise xenrt.XRTError("Not implemented")
+ @xenrt.irregularName
def _osParent_pollPowerState(self, state, timeout=600, level=xenrt.RC_FAIL, pollperiod=15):
"""Poll for reaching the specified state"""
raise xenrt.XRTError("Not supported")
+ @xenrt.irregularName
def _osParent_getPowerState(self):
"""Get the current power state"""
raise xenrt.XRTError("Not supported")
##### Methods from OSParent #####
@property
+ @xenrt.irregularName
def _osParent_name(self):
return self.name
@property
+ @xenrt.irregularName
def _osParent_hypervisorType(self):
return xenrt.HypervisorType.unknown
+ @xenrt.irregularName
def _osParent_getIP(self, trafficType=None, timeout=600, level=xenrt.RC_ERROR):
# TODO add arp sniffing capabilities here
return self.mainip
+ @xenrt.irregularName
def _osParent_getPort(self, trafficType):
return None
+ @xenrt.irregularName
def _osParent_setIP(self,ip):
self.mainip = ip
+ @xenrt.irregularName
def _osParent_start(self):
self.lifecycleOperation("vm-start")
+ @xenrt.irregularName
def _osParent_stop(self):
self.lifecycleOperation("vm-shutdown")
+ @xenrt.irregularName
def _osParent_ejectIso(self):
# TODO implement this with ISO SRs
raise xenrt.XRTError("Not implemented")
+ @xenrt.irregularName
def _osParent_setIso(self, isoName, isoRepo=None):
# TODO implement this with ISO SRs
raise xenrt.XRTError("Not implemented")
+ @xenrt.irregularName
def _osParent_pollPowerState(self, state, timeout=600, level=xenrt.RC_FAIL, pollperiod=15):
"""Poll for reaching the specified state"""
self.poll(self.STATE_MAPPING[state], timeout, level, pollperiod)
+ @xenrt.irregularName
def _osParent_getPowerState(self):
"""Get the current power state"""
return [x for x in self.STATE_MAPPING.keys() if self.STATE_MAPPING[x] == self.getState()][0]