def test_determine_vm_mode_returns_is_not_pv(self): self.mox.StubOutWithMock(vm_mode, "get_from_instance") self.mox.StubOutWithMock(vm_utils, "determine_is_pv") fake_instance = {"os_type": "foo"} fake_vdis = {"root": {"ref": "fake"}} fake_disk_type = "disk" vm_mode.get_from_instance(fake_instance).AndReturn(None) vm_utils.determine_is_pv(self._session, "fake", fake_disk_type, "foo").AndReturn(False) self.mox.ReplayAll() self.assertEquals(vm_mode.HVM, self._vmops._determine_vm_mode(fake_instance, fake_vdis, fake_disk_type)) self.mox.VerifyAll()
def test_determine_vm_mode_returns_is_pv(self): self.mox.StubOutWithMock(vm_mode, 'get_from_instance') self.mox.StubOutWithMock(vm_utils, 'determine_is_pv') fake_instance = {"os_type": "foo"} fake_vdis = {'root': {"ref": 'fake'}} fake_disk_type = "disk" vm_mode.get_from_instance(fake_instance).AndReturn(None) vm_utils.determine_is_pv(self._session, "fake", fake_disk_type, "foo").AndReturn(True) self.mox.ReplayAll() self.assertEquals(vm_mode.XEN, self._vmops._determine_vm_mode(fake_instance, fake_vdis, fake_disk_type)) self.mox.VerifyAll()
def test_determine_vm_mode_returns_is_not_pv(self): self.mox.StubOutWithMock(vm_mode, 'get_from_instance') self.mox.StubOutWithMock(vm_utils, 'determine_is_pv') fake_instance = {"os_type": "foo"} fake_vdis = {'root': {"ref": 'fake'}} fake_disk_type = "disk" vm_mode.get_from_instance(fake_instance).AndReturn(None) vm_utils.determine_is_pv(self._session, "fake", fake_disk_type, "foo").AndReturn(False) self.mox.ReplayAll() self.assertEquals(vm_mode.HVM, self._vmops._determine_vm_mode(fake_instance, fake_vdis, fake_disk_type)) self.mox.VerifyAll()