예제 #1
0
    def test_node_list_show_deleted(self, notify):
        node = self.eng.node_create(self.ctx, 'n1', self.profile['id'])
        result = self.eng.node_list(self.ctx)
        self.assertEqual(1, len(result))
        self.assertEqual(node['id'], result[0]['id'])

        db_api.node_delete(self.ctx, node['id'])

        result = self.eng.node_list(self.ctx)
        self.assertEqual(0, len(result))

        result = self.eng.node_list(self.ctx, show_deleted=True)
        self.assertEqual(1, len(result))
        self.assertEqual(node['id'], result[0]['id'])
예제 #2
0
    def test_node_list_show_deleted(self, notify):
        node = self.eng.node_create(self.ctx, "n1", self.profile["id"])
        result = self.eng.node_list(self.ctx)
        self.assertEqual(1, len(result))
        self.assertEqual(node["id"], result[0]["id"])

        db_api.node_delete(self.ctx, node["id"])

        result = self.eng.node_list(self.ctx)
        self.assertEqual(0, len(result))

        result = self.eng.node_list(self.ctx, show_deleted=True)
        self.assertEqual(1, len(result))
        self.assertEqual(node["id"], result[0]["id"])
예제 #3
0
파일: node.py 프로젝트: tengqm/senlin
    def do_delete(self, context):
        if not self.physical_id:
            db_api.node_delete(context, self.id)
            return True

        # TODO(Qiming): check if actions are working on it and can be canceled
        # TODO(Qiming): log events
        self.set_status(context, self.DELETING, reason='Deletion in progress')
        res = profile_base.Profile.delete_object(context, self)
        if res:
            db_api.node_delete(context, self.id)
            return True
        else:
            self.set_status(context, self.ERROR, reason='Deletion failed')
            return False
예제 #4
0
    def test_node_find_show_deleted(self, notify):
        node = self.eng.node_create(self.ctx, "n1", self.profile["id"])
        nodeid = node["id"]
        db_api.node_delete(self.ctx, nodeid)

        for identity in [nodeid, nodeid[:6], "n1"]:
            self.assertRaises(exception.NodeNotFound, self.eng.node_find, self.ctx, identity)

        # short id and name based finding does not support show_deleted
        for identity in [nodeid[:6], "n-1"]:
            self.assertRaises(exception.NodeNotFound, self.eng.node_find, self.ctx, identity)

        # ID based finding is okay with show_deleted
        result = self.eng.node_find(self.ctx, nodeid, show_deleted=True)
        self.assertIsNotNone(result)
예제 #5
0
    def test_node_find_show_deleted(self, notify):
        node = self.eng.node_create(self.ctx, 'n1', self.profile['id'])
        nodeid = node['id']
        db_api.node_delete(self.ctx, nodeid)

        for identity in [nodeid, nodeid[:6], 'n1']:
            self.assertRaises(exception.NodeNotFound, self.eng.node_find,
                              self.ctx, identity)

        # short id and name based finding does not support show_deleted
        for identity in [nodeid[:6], 'n-1']:
            self.assertRaises(exception.NodeNotFound, self.eng.node_find,
                              self.ctx, identity)

        # ID based finding is okay with show_deleted
        result = self.eng.node_find(self.ctx, nodeid, show_deleted=True)
        self.assertIsNotNone(result)
예제 #6
0
파일: node.py 프로젝트: Cloudxtreme/senlin
    def do_delete(self, context):
        if not self.physical_id:
            db_api.node_delete(context, self.id)
            return True

        # TODO(Qiming): check if actions are working on it and can be canceled
        self.set_status(context, self.DELETING, reason='Deletion in progress')
        try:
            res = profile_base.Profile.delete_object(context, self)
        except exception.ResourceStatusError as ex:
            self._handle_exception(context, 'delete', self.ERROR, ex)
            res = False

        if res:
            db_api.node_delete(context, self.id)
            return True
        else:
            self.set_status(context, self.ERROR, reason='Deletion failed')
            return False
예제 #7
0
파일: node.py 프로젝트: KongJustin/senlin
    def do_delete(self, context):
        if not self.physical_id:
            db_api.node_delete(context, self.id)
            return True

        # TODO(Qiming): check if actions are working on it and can be canceled
        self.set_status(context, self.DELETING, reason='Deletion in progress')
        event_mod.info(context, self, 'delete')
        try:
            res = profile_base.Profile.delete_object(context, self)
        except exception.ResourceStatusError as ex:
            self._handle_exception(context, 'delete', self.ERROR, ex)
            res = False

        if res:
            db_api.node_delete(context, self.id)
            return True
        else:
            self.set_status(context, self.ERROR, reason='Deletion failed')
            return False
예제 #8
0
 def delete(cls, context, obj_id):
     return db_api.node_delete(context, obj_id)
예제 #9
0
파일: node.py 프로젝트: jonnary/senlin
 def delete(cls, context, obj_id):
     db_api.node_delete(context, obj_id)