[PATCH] [TEST] Add the emulator to the guest created by LXC cimtest

# HG changeset patch # User Richard Maciel <richardm@br.ibm.com> # Date 1258573335 7200 # Node ID 815eeee7df1d386da57a3e1e6a477bebb0be0aab # Parent f834593694d2f3eefc3b0285ac62032ddc68edd0 [TEST] Add the emulator to the guest created by LXC cimtest Signed-off-by: Richard Maciel <rmaciel@linux.vnet.ibm.com> diff -r f834593694d2 -r 815eeee7df1d suites/libvirt-cim/lib/XenKvmLib/const.py --- a/suites/libvirt-cim/lib/XenKvmLib/const.py Wed Nov 18 17:24:36 2009 -0200 +++ b/suites/libvirt-cim/lib/XenKvmLib/const.py Wed Nov 18 17:42:15 2009 -0200 @@ -104,6 +104,7 @@ #vxml.LXCXML LXC_init_path = os.path.join(_image_dir, 'cimtest_lxc_init') +LXC_default_emulator = '/usr/libexec/libvirt_lxc' LXC_default_tty = '/dev/ptmx' LXC_default_mp = '/tmp' LXC_default_source = '/var/lib/libvirt/images/lxc_files' diff -r f834593694d2 -r 815eeee7df1d suites/libvirt-cim/lib/XenKvmLib/vxml.py --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Nov 18 17:24:36 2009 -0200 +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Nov 18 17:42:15 2009 -0200 @@ -987,7 +987,7 @@ mem, const.default_mallocunits, None, grstype, address, port_num, keymap, irstype, btype, vnc_passwd) self._os(const.LXC_init_path) - self._devices(mac, ntype, net_name, const.LXC_default_tty) + self._devices(const.LXC_default_emulator, mac, ntype, net_name, const.LXC_default_tty) self.create_lxc_file(CIM_IP, const.LXC_init_path) def _os(self, os_init): @@ -995,9 +995,11 @@ self.add_sub_node(os, 'init', os_init) self.add_sub_node(os, 'type', 'exe') - def _devices(self, net_mac, net_type, net_name, tty_set): + def _devices(self, emu, net_mac, net_type, net_name, tty_set): devices = self.get_node('/domain/devices') - + + self.add_sub_node(devices, 'emulator', emu) #'/usr/libexec/libvirt_lxc') + if const.LXC_netns_support is True: self.set_interface_details(devices, net_mac, net_type, net_name, 'LXC')

diff -r f834593694d2 -r 815eeee7df1d suites/libvirt-cim/lib/XenKvmLib/vxml.py --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Nov 18 17:24:36 2009 -0200 +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Nov 18 17:42:15 2009 -0200 @@ -987,7 +987,7 @@ mem, const.default_mallocunits, None, grstype, address, port_num, keymap, irstype, btype, vnc_passwd) self._os(const.LXC_init_path) - self._devices(mac, ntype, net_name, const.LXC_default_tty) + self._devices(const.LXC_default_emulator, mac, ntype, net_name, const.LXC_default_tty)
I would modify the __init__ function of LXCXML to accept an emulator param. We do something similar with KVM. This provides the option for specifying other emulators (which might be useful in the future, or useful for testing negative test cases).
self.create_lxc_file(CIM_IP, const.LXC_init_path)
def _os(self, os_init): @@ -995,9 +995,11 @@ self.add_sub_node(os, 'init', os_init) self.add_sub_node(os, 'type', 'exe')
- def _devices(self, net_mac, net_type, net_name, tty_set): + def _devices(self, emu, net_mac, net_type, net_name, tty_set): devices = self.get_node('/domain/devices') - + + self.add_sub_node(devices, 'emulator', emu) #'/usr/libexec/libvirt_lxc')
Can you remove the comment here? If we change the value of the emulator in const.py, it's likely the comment won't get updated.
+ if const.LXC_netns_support is True: self.set_interface_details(devices, net_mac, net_type, net_name, 'LXC')
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

On 11/18/2009 11:10 PM, Kaitlin Rupert wrote:
diff -r f834593694d2 -r 815eeee7df1d suites/libvirt-cim/lib/XenKvmLib/vxml.py --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Nov 18 17:24:36 2009 -0200 +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Nov 18 17:42:15 2009 -0200 @@ -987,7 +987,7 @@ mem, const.default_mallocunits, None, grstype, address, port_num, keymap, irstype, btype, vnc_passwd) self._os(const.LXC_init_path) - self._devices(mac, ntype, net_name, const.LXC_default_tty) + self._devices(const.LXC_default_emulator, mac, ntype, net_name, const.LXC_default_tty)
I would modify the __init__ function of LXCXML to accept an emulator param. We do something similar with KVM. This provides the option for specifying other emulators (which might be useful in the future, or useful for testing negative test cases).
None of the other virtualization classes (KVMXML, XenXML, XenFVXML) include the emulator as a param in their __init__. Instead, they define a set_emulator method that lets the user change it. So, I changed my code following the established convention.
self.create_lxc_file(CIM_IP, const.LXC_init_path)
def _os(self, os_init): @@ -995,9 +995,11 @@ self.add_sub_node(os, 'init', os_init) self.add_sub_node(os, 'type', 'exe')
- def _devices(self, net_mac, net_type, net_name, tty_set): + def _devices(self, emu, net_mac, net_type, net_name, tty_set): devices = self.get_node('/domain/devices') - + + self.add_sub_node(devices, 'emulator', emu) #'/usr/libexec/libvirt_lxc')
Can you remove the comment here? If we change the value of the emulator in const.py, it's likely the comment won't get updated.
+ if const.LXC_netns_support is True: self.set_interface_details(devices, net_mac, net_type, net_name, 'LXC')
-- Richard Maciel, MSc IBM Linux Technology Center rmaciel@linux.vnet.ibm.com

Richard Maciel wrote:
On 11/18/2009 11:10 PM, Kaitlin Rupert wrote:
diff -r f834593694d2 -r 815eeee7df1d suites/libvirt-cim/lib/XenKvmLib/vxml.py --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Nov 18 17:24:36 2009 -0200 +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Nov 18 17:42:15 2009 -0200 @@ -987,7 +987,7 @@ mem, const.default_mallocunits, None, grstype, address, port_num, keymap, irstype, btype, vnc_passwd) self._os(const.LXC_init_path) - self._devices(mac, ntype, net_name, const.LXC_default_tty) + self._devices(const.LXC_default_emulator, mac, ntype, net_name, const.LXC_default_tty)
I would modify the __init__ function of LXCXML to accept an emulator param. We do something similar with KVM. This provides the option for specifying other emulators (which might be useful in the future, or useful for testing negative test cases).
None of the other virtualization classes (KVMXML, XenXML, XenFVXML) include the emulator as a param in their __init__. Instead, they define a set_emulator method that lets the user change it. So, I changed my code following the established convention.
Ah, yes - you're right. My mistake. I thought Deepti had added this at some point. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Kaitlin Rupert
-
Richard Maciel