def _create_qemu_target(extra_device_config={}): create_config('lava-dispatcher.conf', {}) device_config_data = {'device_type': 'qemu'} device_config_data.update(extra_device_config) device_config = create_device_config('qemu01', device_config_data) dispatcher_config = get_config() context = LavaContext('qemu01', dispatcher_config, None, None, None) return QEMUTarget(context, device_config)
def create_kvm_target(self, extra_device_config=None): if not extra_device_config: extra_device_config = {} create_config('lava-dispatcher.conf', {}) device_config_data = {'device_type': 'kvm'} device_config_data.update(extra_device_config) device_config = create_device_config('fakekvm', device_config_data) # use a device name unlikely to exist dispatcher_config = get_config() context = LavaContext('fakekvm', dispatcher_config, None, None, None) return QEMUTarget(context, device_config)
def create_vm_target(self, name, extra_device_config={}): fake_qemu = os.path.join(os.path.dirname(__file__), 'test-config', 'bin', 'fake-qemu') create_config('lava-dispatcher.conf', { 'LAVA_SERVER_IP': '99.99.99.99', }) extra_device_config.update({'qemu_binary': fake_qemu}) device_config_data = {'device_type': 'dynamic-vm'} device_config_data.update(extra_device_config) device_config = create_device_config(name, device_config_data) dispatcher_config = get_config() self.data['target'] = name context = LavaContext(name, dispatcher_config, None, None, None) return DynamicVmTarget(context, device_config)
def create_kvm_target(self, extra_device_config=None): if not extra_device_config: extra_device_config = {} create_config('lava-dispatcher.conf', {}) device_config_data = {'device_type': 'kvm'} device_config_data.update(extra_device_config) device_config = create_device_config( 'fakekvm', device_config_data) # use a device name unlikely to exist dispatcher_config = get_config() context = LavaContext('fakekvm', dispatcher_config, None, None, None) return QEMUTarget(context, device_config)
def create_qemu_target(self, name, extra_device_config={}): """ create a device just for the test suite in /tmp :param name: hostname to check against the returned target :param extra_device_config: hash of device config values :return: a fake QEMU target using the specified hostname """ fake_qemu = os.path.join(os.path.dirname(__file__), 'test-config', 'bin', 'fake-qemu') create_config('lava-dispatcher.conf', { 'LAVA_SERVER_IP': '99.99.99.99', }) extra_device_config.update({'qemu_binary': fake_qemu}) device_config_data = {'device_type': 'qemu'} device_config_data.update(extra_device_config) device_config = create_device_config(name, device_config_data) dispatcher_config = get_config() self.data['target'] = name context = LavaContext(name, dispatcher_config, None, None, None) return QEMUTarget(context, device_config)