示例#1
0
 def test_host_delete(self):
     ctxt = context.get_admin_context()
     result = self._create_host(self._get_fake_values())
     db.host_delete(ctxt, result['uuid'])
     self.assertRaises(exception.HostNotFound,
                       db.host_get_by_uuid, self.ctxt,
                       uuidsentinel.fake_uuid)
示例#2
0
    def destroy(self):
        if not self.obj_attr_is_set('id'):
            raise exception.ObjectActionError(action='destroy',
                                              reason='already destroyed')
        if not self.obj_attr_is_set('uuid'):
            raise exception.ObjectActionError(action='destroy',
                                              reason='no uuid')

        db.host_delete(self._context, self.uuid)
        delattr(self, base.get_attrname('id'))
示例#3
0
    def destroy(self):
        if not self.obj_attr_is_set('id'):
            raise exception.ObjectActionError(action='destroy',
                                              reason='already destroyed')
        if not self.obj_attr_is_set('uuid'):
            raise exception.ObjectActionError(action='destroy',
                                              reason='no uuid')

        db.host_delete(self._context, self.uuid)
        delattr(self, base.get_attrname('id'))
示例#4
0
    def destroy(self):
        if not self.obj_attr_is_set('id'):
            raise exception.ObjectActionError(action='destroy',
                                              reason='already destroyed')
        if not self.obj_attr_is_set('uuid'):
            raise exception.ObjectActionError(action='destroy',
                                              reason='no uuid')

        api_utils.notify_about_host_api(self._context, self,
            action=fields.EventNotificationAction.HOST_DELETE,
            phase=fields.EventNotificationPhase.START)

        db.host_delete(self._context, self.uuid)

        api_utils.notify_about_host_api(self._context, self,
            action=fields.EventNotificationAction.HOST_DELETE,
            phase=fields.EventNotificationPhase.END)

        delattr(self, base.get_attrname('id'))
示例#5
0
文件: host.py 项目: iorchard/okidoki
    def destroy(self):
        if not self.obj_attr_is_set('id'):
            raise exception.ObjectActionError(action='destroy',
                                              reason='already destroyed')
        if not self.obj_attr_is_set('uuid'):
            raise exception.ObjectActionError(action='destroy',
                                              reason='no uuid')

        api_utils.notify_about_host_api(
            self._context,
            self,
            action=fields.EventNotificationAction.HOST_DELETE,
            phase=fields.EventNotificationPhase.START)

        db.host_delete(self._context, self.uuid)

        api_utils.notify_about_host_api(
            self._context,
            self,
            action=fields.EventNotificationAction.HOST_DELETE,
            phase=fields.EventNotificationPhase.END)

        delattr(self, base.get_attrname('id'))