コード例 #1
0
ファイル: base.py プロジェクト: inspur-storage/cinder-test
    def add(self, ver, updates):
        if ver in self.versions:
            msg = 'Version %s already exists in history.' % ver
            raise exception.ProgrammingError(reason=msg)

        self[ver] = self[self.get_current()].copy()
        self.versions.append(ver)
        self[ver].update(updates)
コード例 #2
0
ファイル: base.py プロジェクト: nvazquez13alexa/cinder
 def cinder_ovo_cls_init(cls):
     """This method is called on OVO registration and sets the DB model."""
     # Persistent Versioned Objects Classes should have a DB model, and if
     # they don't, then we have a problem and we must raise an exception on
     # registration.
     try:
         cls.model = db.get_model_for_versioned_object(cls)
     except (ImportError, AttributeError):
         msg = _("Couldn't find ORM model for Persistent Versioned "
                 "Object %s.") % cls.obj_name()
         raise exception.ProgrammingError(reason=msg)
コード例 #3
0
ファイル: backup.py プロジェクト: lubidl0/cinder-1
 def is_snapshot(self):
     if self.obj_attr_is_set('snapshot') == self.obj_attr_is_set('volume'):
         msg = _("Either snapshot or volume field should be set.")
         raise exception.ProgrammingError(message=msg)
     return self.obj_attr_is_set('snapshot')