# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1211269445 25200
# Node ID aa2d643c9807396aa429d641ab4cef4e5c2997fd
# Parent ff2aace1f86d0bd810dd20c5093c579873695681
[TEST] add LXCXML class in vxml.py
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r ff2aace1f86d -r aa2d643c9807 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Tue May 20 00:42:26 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Tue May 20 00:44:05 2008 -0700
@@ -141,6 +141,8 @@ class Virsh:
self.vuri = 'xen:///'
elif vir_type == 'kvm':
self.vuri = 'qemu:///system'
+ elif vir_type == 'lxc':
+ self.vuri = 'lxc:///system'
def run(self, ip, vcmd, param):
file_arg_cmds = ['define', 'create', 'net-create',
'pool-create', 'pool-destroy']
@@ -280,7 +282,7 @@ class VirtXML(Virsh, XMLClass):
raise NotImplementedError('virtual method, implement your own')
def issubinstance(self):
- return isinstance(self, (XenXML, KVMXML, XenFVXML))
+ return isinstance(self, (XenXML, KVMXML, XenFVXML, LXCXML))
def set_memory(self, mem):
self.set_cdata('/domain/memory', mem * 1024)
@@ -627,6 +629,27 @@ class XenFVXML(VirtXML):
def set_vbridge(self, ip):
return self._set_vbridge(ip, 'XenFV')
+class LXCXML(VirtXML):
+
+ def __init__(self, test_dom=const.default_domname,
+ mem=const.default_memory,
+ vcpus=const.default_vcpus,
+ tty=const.LXC_default_tty):
+ if not os.path.exists(const.LXC_init_path):
+ logger.error('ERROR: init_path does not exist')
+ sys.exit(1)
+ VirtXML.__init__(self, 'lxc', test_dom, set_uuid(), mem, vcpus)
+ self._os(const.LXC_init_path)
+ self._devices(const.LXC_default_tty)
+
+ def _os(self, os_init):
+ os = self.get_node('/domain/os')
+ self.add_sub_node(os, 'init', os_init)
+
+ def _devices(self, tty):
+ devices = self.get_node('/domain/devices')
+
+ interface = self.add_sub_node(devices, 'console', tty)
def get_class(virt):
if virt in virt_types: