def test_get_guest_storage_config_not_rescue(self): qemuwindriver = QemuWinDriver() qemuwindriver.virtapi = mock.Mock() qemuwindriver.virtapi.instance_update = mock.Mock() instance = {'uuid': 'fakeuuid'} image_meta = 'fakeimagemeta' disk_info = {'mapping': ['disk', 'disk.local', 'disk.swap']} rescue = False block_device_info = 'fakeblockdeviceinfo' inst_type = 'fakeinsttype' expected_result = ['fakediskosconfig', 'fakedisklocalconfig', 'fakediskephconfig', 'fakediskswapconfig', 'fakevolumedriverconfig'] actual_result = qemuwindriver.get_guest_storage_config(instance, image_meta, disk_info, rescue, block_device_info, inst_type) assert qemuwindriver.set_cache_mode.called
def test_get_guest_config(self, mock_conf): qemuwindriver = QemuWinDriver() qemuwindriver.virtapi = mock.Mock() qemuwindriver.virtapi.instance_type_get.return_value = {'memory_mb': 'fakememory', 'vcpus': 'fakevcpus', 'extra_specs': {'quota:cpu_quota' : 'fake_value'}} qemuwindriver.virtapi.instance_update = mock.Mock() qemuwindriver.vif_driver = mock.Mock() qemuwindriver.vif_driver.get_config.return_value = 'fakevifdriverconfig ' mock_conf.libvirt_type = 'fakevirttype' mock_conf.vcpu_pin_set = 'fakecpuset' mock_conf.vnc_enabled = 'True' mock_conf.use_usb_tablet = 'fakeneedusbtablet' mock_conf.spice = mock.Mock() mock_conf.spice.enable = 'fakespiceenabled' mock_conf.spice.agent_enabled = 'fakespiceagentenabled' instance = {'instance_type_id': 'fakeinstancetypeid', 'name': 'fakename', 'uuid': 'fakeuuid', 'kernel_id' : False, 'os_type' : 'windows'} network_info = ['fakevif'] image_meta = {'properties': {'hw_qemu_guest_agent': 'fakehw_qga'}} disk_info ={'mapping': {'root': {'dev': 'fakedev'}}} actual_result = qemuwindriver.get_guest_config(instance, network_info, image_meta, disk_info)