New Network Infrastructure for Xm-Test
PATCH 1/3 New Network Infrastructure for Xm-Test
Hi,
This patch and the two that will follow add a new network infrastructure to xm-test. The goal is to make writing tests with networking easy. The patches add a new XenDevice class and NetConfig class. The XenDevice and the XenNetDevice subclass represent devices in xm-test and are linked to the XenDomains. The NetConfig class manages xm-test's network configuration.
The patches make it possible to easily create a domain with a network device. The XmTestNetDomain class creates a domain with a single ethernet device. It automatically grabs an IP and runs the necessary commands on the guest domain - ifconfig - for you. Or, you can create domains with XmTestDomain and then use the new device factory to add new devices to the domain:
domain = XmTestDomain()domain.newDevice(XenNetDevice, "eth0")
Xm-test networking must be configured when it's made. There are new options for configure that set IP address range - it uses the zeroconf range as default, IP network address, and IP netmask. Xm-test refers to this range for grabbing and configuring IPs for test domains.
NOTE: Xm-Test with these patches will only support a bridged environment and the range of addresses provided.
Features that need to be added following this set:
1) DHCP - setting configuration to use DHCP for IPs rather than a configured range.
2) NAT environment
3) Routed environment
4) Attaching and detaching devices to existing domains.
The first patch, which is included, creates a domain type attribute for XenDomain, marking the domain as either PV for Para-virt domU or HVM for a fully virtualized domain. The XenNetDevice checks to see what the current domain is to set specific parameters.
All comments are welcome.
Thanks,
Dan
# HG changeset patch
# User [email protected] # Node ID 5562ee51bb7506266dc6d422af028a9e566d5305 # Parent a5fcffc826f3c77a8b28a78fbf099fde7ea27f0b
First step to network infrastructure, add a type to XenDomain to identify it as HVM or PV rather than using the config time option. The forthcoming XenNetDevice will need to check. This is also the first step toward running PV and HVM domains at the same time.
tools/xm-test/lib/XmTestLib/XenDomain.py +13 -5
@@ -193,6 +193,12 @@ self.name = getUniqueName() self.config = config + # Set domain type, either PV for ParaVirt domU or HVM for + # FullVirt domain + if ENABLE_HVM_SUPPORT: + self.type = "HVM" + else: + self.type = "PV" def start(self):
@@ -203,6 +209,10 @@ extra=output, errorcode=ret) + # HVM domains require waiting for boot + if self.getDomainType() == "HVM": + waitForBoot() + def stop(self): prog = "xm" cmd = " shutdown "
@@ -224,6 +234,9 @@ def getId(self): return domid(self.getName()); + + def getDomainType(self): + return self.type class XmTestDomain(XenDomain):
@@ -246,11 +259,6 @@ XenDomain.__init__(self, config.getOpt("name"), config=config) - def start(self): - XenDomain.start(self) - if ENABLE_HVM_SUPPORT: - waitForBoot() - def minSafeMem(self): return 32
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel