diff --git a/karbor/objects/scheduled_operation.py b/karbor/objects/scheduled_operation.py index 4d4c411c..d479c1dd 100644 --- a/karbor/objects/scheduled_operation.py +++ b/karbor/objects/scheduled_operation.py @@ -104,6 +104,7 @@ class ScheduledOperation(base.KarborPersistentObject, base.KarborObject, def save(self): updates = self.karbor_obj_get_changes() if updates and self.id: + self._convert_operation_definition_to_db_format(updates) db.scheduled_operation_update(self._context, self.id, updates) diff --git a/karbor/tests/unit/objects/test_scheduled_operation.py b/karbor/tests/unit/objects/test_scheduled_operation.py index 5a78fe54..8efd95f5 100644 --- a/karbor/tests/unit/objects/test_scheduled_operation.py +++ b/karbor/tests/unit/objects/test_scheduled_operation.py @@ -93,12 +93,15 @@ class TestScheduledOperation(test_objects.BaseObjectsTestCase): op = self.Operation_Class._from_db_object(self.context, self.Operation_Class(), db_op) + fake_op_def = {'a': '1'} op.name = 'protect volume' + op.operation_definition = fake_op_def op.save() - operation_update.assert_called_once_with(self.context, - op.id, - {'name': 'protect volume'}) + operation_update.assert_called_once_with( + self.context, op.id, + {'name': 'protect volume', + 'operation_definition': jsonutils.dumps(fake_op_def)}) @mock.patch('karbor.db.scheduled_operation_delete') def test_destroy(self, operation_delete):