def save(self):
     updates = self.karbor_obj_get_changes()
     if updates and self.operation_id:
         db.scheduled_operation_state_update(self._context,
                                             self.operation_id,
                                             updates)
         self.obj_reset_changes()
Пример #2
0
 def save(self):
     updates = self.karbor_obj_get_changes()
     if updates and self.operation_id:
         db.scheduled_operation_state_update(self._context,
                                             self.operation_id,
                                             updates)
         self.obj_reset_changes()
Пример #3
0
    def test_scheduled_operation_state_update(self):
        state_ref = self._create_scheduled_operation_state()
        operation_id = state_ref['operation_id']
        state_ref = db.scheduled_operation_state_update(
            self.ctxt, operation_id, {"state": "success"})
        self.assertEqual('success', state_ref['state'])

        state_ref = db.scheduled_operation_state_get(self.ctxt, operation_id)
        self.assertEqual('success', state_ref['state'])

        self.assertRaises(exception.ScheduledOperationStateNotFound,
                          db.scheduled_operation_state_update, self.ctxt,
                          '100', {"state": "success"})
Пример #4
0
    def test_scheduled_operation_state_update(self):
        state_ref = self._create_scheduled_operation_state()
        operation_id = state_ref['operation_id']
        state_ref = db.scheduled_operation_state_update(self.ctxt,
                                                        operation_id,
                                                        {"state": "success"})
        self.assertEqual('success', state_ref['state'])

        state_ref = db.scheduled_operation_state_get(self.ctxt, operation_id)
        self.assertEqual('success', state_ref['state'])

        self.assertRaises(exception.ScheduledOperationStateNotFound,
                          db.scheduled_operation_state_update,
                          self.ctxt, '100', {"state": "success"})