コード例 #1
0
 def action_start(cls, context, instance_uuid, action_name,
                  want_result=True):
     values = compute_utils.pack_action_start(context, instance_uuid,
                                              action_name)
     db_action = db.action_start(context, values)
     if want_result:
         return cls._from_db_object(context, cls(), db_action)
コード例 #2
0
ファイル: instance_action.py プロジェクト: bopopescu/nova-40
 def action_start(cls, context, instance_uuid, action_name,
                  want_result=True):
     values = compute_utils.pack_action_start(context, instance_uuid,
                                              action_name)
     db_action = db.action_start(context, values)
     if want_result:
         return cls._from_db_object(context, cls(), db_action)
コード例 #3
0
 def test_action_start_no_result(self, mock_start):
     expected_packed_values = compute_utils.pack_action_start(
         self.context, 'fake-uuid', 'fake-action')
     mock_start.return_value = fake_action
     action = instance_action.InstanceAction.action_start(
         self.context, 'fake-uuid', 'fake-action', want_result=False)
     mock_start.assert_called_once_with(self.context,
                                        expected_packed_values)
     self.assertIsNone(action)
コード例 #4
0
 def test_action_start_no_result(self):
     self.mox.StubOutWithMock(db, 'action_start')
     db.action_start(self.context, compute_utils.pack_action_start(
             self.context, 'fake-uuid', 'fake-action')).AndReturn(
                 fake_action)
     self.mox.ReplayAll()
     action = instance_action.InstanceAction.action_start(
         self.context, 'fake-uuid', 'fake-action', want_result=False)
     self.assertEqual(None, action)
コード例 #5
0
 def test_action_start(self):
     self.mox.StubOutWithMock(db, 'action_start')
     db.action_start(self.context, compute_utils.pack_action_start(
             self.context, 'fake-uuid', 'fake-action')).AndReturn(
                 fake_action)
     self.mox.ReplayAll()
     action = instance_action.InstanceAction.action_start(
         self.context, 'fake-uuid', 'fake-action')
     self.assertEqual(fake_action['id'], action.id)
コード例 #6
0
 def test_action_start_no_result(self, mock_start):
     expected_packed_values = compute_utils.pack_action_start(
         self.context, 'fake-uuid', 'fake-action')
     mock_start.return_value = fake_action
     action = instance_action.InstanceAction.action_start(self.context,
                                                          'fake-uuid',
                                                          'fake-action',
                                                          want_result=False)
     mock_start.assert_called_once_with(self.context,
                                        expected_packed_values)
     self.assertIsNone(action)
コード例 #7
0
 def test_action_start(self):
     self.mox.StubOutWithMock(db, 'action_start')
     db.action_start(
         self.context,
         compute_utils.pack_action_start(
             self.context, 'fake-uuid',
             'fake-action')).AndReturn(fake_action)
     self.mox.ReplayAll()
     action = instance_action.InstanceAction.action_start(
         self.context, 'fake-uuid', 'fake-action')
     self.assertEqual(fake_action['id'], action.id)
コード例 #8
0
 def test_action_start_no_result(self):
     self.mox.StubOutWithMock(db, 'action_start')
     db.action_start(
         self.context,
         compute_utils.pack_action_start(
             self.context, 'fake-uuid',
             'fake-action')).AndReturn(fake_action)
     self.mox.ReplayAll()
     action = instance_action.InstanceAction.action_start(self.context,
                                                          'fake-uuid',
                                                          'fake-action',
                                                          want_result=False)
     self.assertEqual(None, action)
コード例 #9
0
 def test_finish(self):
     timeutils.set_time_override()
     self.mox.StubOutWithMock(db, 'action_start')
     self.mox.StubOutWithMock(db, 'action_finish')
     db.action_start(self.context, compute_utils.pack_action_start(
             self.context, 'fake-uuid', 'fake-action')).AndReturn(
                 fake_action)
     db.action_finish(self.context, compute_utils.pack_action_finish(
             self.context, 'fake-uuid')).AndReturn(fake_action)
     self.mox.ReplayAll()
     action = instance_action.InstanceAction.action_start(
         self.context, 'fake-uuid', 'fake-action')
     action.finish()
コード例 #10
0
 def test_finish(self):
     timeutils.set_time_override()
     ctxt = context.get_admin_context()
     self.mox.StubOutWithMock(db, 'action_start')
     self.mox.StubOutWithMock(db, 'action_finish')
     db.action_start(
         ctxt,
         compute_utils.pack_action_start(
             ctxt, 'fake-uuid', 'fake-action')).AndReturn(fake_action)
     db.action_finish(ctxt,
                      compute_utils.pack_action_finish(
                          ctxt, 'fake-uuid')).AndReturn(fake_action)
     self.mox.ReplayAll()
     action = instance_action.InstanceAction.action_start(
         ctxt, 'fake-uuid', 'fake-action')
     action.finish()
コード例 #11
0
 def _create_action_here(self, ctxt, instance_uuids):
     for instance_uuid in instance_uuids:
         action = compute_utils.pack_action_start(ctxt, instance_uuid,
                                                  instance_actions.CREATE)
         self.db.action_start(ctxt, action)
コード例 #12
0
ファイル: scheduler.py プロジェクト: itskewpie/nova
 def _create_action_here(self, ctxt, instance_uuids):
     for instance_uuid in instance_uuids:
         action = compute_utils.pack_action_start(ctxt, instance_uuid,
                 instance_actions.CREATE)
         self.db.action_start(ctxt, action)
コード例 #13
0
ファイル: compute.py プロジェクト: rohit-k/NovaOrc
 def _record_action_start(self, context, instance, action):
     act = compute_utils.pack_action_start(context, instance['uuid'],
                                           action)
     self.db.action_start(context, act)