示例#1
0
    def test_delete_no_host(self):
        share = fake_share('fakeid')
        share['host'] = None

        self.mox.StubOutWithMock(db_driver, 'share_delete')
        db_driver.share_delete(mox.IsA(context.RequestContext), 'fakeid')
        self.mox.ReplayAll()
        self.api.delete(self.context, share)
示例#2
0
    def test_delete_no_host(self):
        share = fake_share("fakeid")
        share["host"] = None

        self.mox.StubOutWithMock(db_driver, "share_delete")
        db_driver.share_delete(mox.IsA(context.RequestContext), "fakeid")
        self.mox.ReplayAll()
        self.api.delete(self.context, share)
示例#3
0
    def _delete(self, context, resource, force=True):
        # Delete all share group snapshots
        for snap in resource['snapshots']:
            db.share_group_snapshot_destroy(context, snap['id'])

        # Delete all shares in share group
        for share in db.get_all_shares_by_share_group(context, resource['id']):
            db.share_delete(context, share['id'])

        db.share_group_destroy(context.elevated(), resource['id'])