示例#1
0
    def create(self):
        if self.obj_attr_is_set('id'):
            raise exception.ObjectActionError(action='create',
                                              reason=_('already created'))

        updates = self.karbor_obj_get_changes()
        self._convert_operation_definition_to_db_format(updates)
        db_op = db.scheduled_operation_create(self._context, updates)
        self._from_db_object(self._context, self, db_op)
示例#2
0
 def _create_scheduled_operation():
     values = {
         'id': '0354ca9ddcd046b693340d78759fd274',
         'name': 'protect vm',
         'operation_type': 'protect',
         'user_id': self.ctxt.user_id,
         'project_id': self.ctxt.tenant,
         'trigger_id': '0354ca9ddcd046b693340d78759fd275',
         'operation_definition': '{}'
     }
     return db.scheduled_operation_create(self.ctxt, values)
示例#3
0
 def _create_scheduled_operation():
     values = {
         'id': '0354ca9ddcd046b693340d78759fd274',
         'name': 'protect vm',
         'operation_type': 'protect',
         'user_id': self.ctxt.user_id,
         'project_id': self.ctxt.tenant,
         'trigger_id': '0354ca9ddcd046b693340d78759fd275',
         'operation_definition': '{}'
     }
     return db.scheduled_operation_create(self.ctxt, values)