Exemplo n.º 1
0
 def test_call_agent_fails_with_not_implemented(self, mock_uuid):
     session = mock.Mock()
     self.assertRaises(exception.AgentNotImplemented,
                       self._call_agent_setup,
                       session, mock_uuid,
                       exception=xenapi_fake.Failure(["NOT IMPLEMENTED:"]))
     self._assert_agent_called(session, mock_uuid)
Exemplo n.º 2
0
 def test_call_agent_fails_with_other_error(self, mock_uuid):
     session = mock.Mock()
     self.assertRaises(exception.AgentError,
                       self._call_agent_setup,
                       session,
                       mock_uuid,
                       exception=xenapi_fake.Failure(["asdf"]))
     self._assert_agent_called(session, mock_uuid)
Exemplo n.º 3
0
 def test_call_agent_fails_with_timeout(self, mock_uuid):
     session = mock.Mock()
     self.assertRaises(exception.AgentTimeout,
                       self._call_agent_setup,
                       session,
                       mock_uuid,
                       exception=xenapi_fake.Failure(["TIMEOUT:fake"]))
     self._assert_agent_called(session, mock_uuid)
Exemplo n.º 4
0
Arquivo: stubs.py Projeto: termie/nova
 def VM_start(self, _1, ref, _2, _3):
     vm = fake.get_record('VM', ref)
     if vm['power_state'] != 'Halted':
         raise fake.Failure(
             ['VM_BAD_POWER_STATE', ref, 'Halted', vm['power_state']])
     vm['power_state'] = 'Running'
     vm['is_a_template'] = False
     vm['is_control_domain'] = False
Exemplo n.º 5
0
Arquivo: stubs.py Projeto: termie/nova
 def VDI_introduce(self, _1, uuid, _2, _3, _4, _5, _6, _7, _8, _9, _10,
                   _11):
     valid_vdi = False
     refs = fake.get_all('VDI')
     for ref in refs:
         rec = fake.get_record('VDI', ref)
         if rec['uuid'] == uuid:
             valid_vdi = True
     if not valid_vdi:
         raise fake.Failure([['INVALID_VDI', 'session', self._session]])
Exemplo n.º 6
0
Arquivo: stubs.py Projeto: kiall/nova
    def _fake_fetch_image_glance_disk(context, session, instance, image,
                                      image_type):
        if raise_failure:
            raise fake.Failure("Test Exception raised by "
                               "fake fetch_image_glance_disk")
        elif image_type == vm_utils.ImageType.KERNEL:
            filename = "kernel"
        elif image_type == vm_utils.ImageType.RAMDISK:
            filename = "ramdisk"
        else:
            filename = "unknown"

        vdi_type = vm_utils.ImageType.to_string(image_type)
        return {vdi_type: dict(uuid=None, file=filename)}
Exemplo n.º 7
0
Arquivo: stubs.py Projeto: termie/nova
 def VDI_introduce(self, _1, uuid, _2, _3, _4, _5, _6, _7, _8, _9, _10,
                   _11):
     # This is for testing failure
     raise fake.Failure([['INVALID_VDI', 'session', self._session]])
Exemplo n.º 8
0
Arquivo: stubs.py Projeto: termie/nova
 def f(cls, *args):
     raise fake.Failure("Test Exception raised by " + "fake create_vm")
Exemplo n.º 9
0
Arquivo: stubs.py Projeto: termie/nova
 def f(cls, *args):
     raise fake.Failure("Test Exception raised by " +
                        "fake fetch_image_glance_disk")